• R/O
  • SSH
  • HTTPS

softbanking: Commit


Commit MetaInfo

Revision60 (tree)
Time2021-10-09 07:22:17
Authorhemaxvi_soft

Log Message

Se agrego el código para completar el botón eliminar NumerosGanadoresWF
de tal forma que al realizar dicho proceso, los tickets ganadores y el detalle de dicho tickets regresen a su estado original.

Change Summary

Incremental Difference

--- Capas/Datos/TransactionsDAL.cs (revision 59)
+++ Capas/Datos/TransactionsDAL.cs (revision 60)
@@ -335,9 +335,45 @@
335335 }
336336 return res;
337337 }
338-
339-
340- public Boolean Delete(LoginDAL loginDAL)
338+ public Boolean EditWiner(LoginDAL loginDAL)
339+ {
340+ ErrorCode = 0;
341+ ErrorDescription = "Successful";
342+ SqlConnection con = new SqlConnection();
343+ SqlParameter parametros;
344+ Boolean res = false;
345+ try
346+ {
347+ dbm.DataSource = loginDAL.DataSource; dbm.DataBase = loginDAL.DataBaseName; dbm.User = loginDAL.UserName; dbm.Password = loginDAL.UserPassword; con = dbm.getConexion(dbm);
348+ con.Open();
349+ SqlCommand cmd = new SqlCommand("TransactionsUpdateWiner", con);
350+
351+ parametros = cmd.Parameters.Add("@TransactionID", SqlDbType.BigInt);
352+ parametros.Value = TransactionID;
353+ parametros = cmd.Parameters.Add("@LotteryName", SqlDbType.VarChar);
354+ parametros.Value = lotteryName;
355+
356+ parametros = cmd.Parameters.Add("@StartDate", SqlDbType.DateTime);
357+ parametros.Value = Convert.ToDateTime(StartTime.ToShortDateString() + " 00:00:00");
358+
359+ parametros = cmd.Parameters.Add("@EndDate", SqlDbType.DateTime);
360+ parametros.Value = Convert.ToDateTime(EndTime.ToShortDateString() + " 23:59:59");
361+
362+ cmd.CommandType = CommandType.StoredProcedure;
363+ if (cmd.ExecuteNonQuery() > 0)
364+ res = true;
365+ con.Close();
366+ }
367+ catch (Exception e)
368+ {
369+ errorDescription = "Error de SQL :" + e.Message;
370+ errorCode = 0001;
371+ }
372+ return res;
373+ }
374+
375+
376+ public Boolean Delete(LoginDAL loginDAL)
341377 {
342378 SqlConnection con = new SqlConnection();
343379 SqlParameter parametros;
@@ -362,7 +398,68 @@
362398 return res;
363399 }
364400
401+ public List<TransactionsDAL> SearchWiner(LoginDAL loginDAL, bool usedDate = false)
402+ {
403+ ErrorCode = 0;
404+ ErrorDescription = "Successful";
405+ SqlConnection con = new SqlConnection();
406+ SqlParameter parametros;
407+ SqlDataReader dr = null;
408+ List<TransactionsDAL> transactionsList = new List<TransactionsDAL>();
409+ try
410+ {
411+ dbm.DataSource = loginDAL.DataSource; dbm.DataBase = loginDAL.DataBaseName; dbm.User = loginDAL.UserName; dbm.Password = loginDAL.UserPassword; con = dbm.getConexion(dbm);
412+ con.Open();
413+ SqlCommand cmd = new SqlCommand("TransactionsSearchWiner", con);
365414
415+ parametros = cmd.Parameters.Add("@LotteryName", SqlDbType.VarChar);
416+ parametros.Value = lotteryName;
417+
418+ parametros = cmd.Parameters.Add("@StartDate", SqlDbType.DateTime);
419+ parametros.Value = Convert.ToDateTime(StartTime.ToShortDateString() + " 00:00:00");
420+
421+ parametros = cmd.Parameters.Add("@EndDate", SqlDbType.DateTime);
422+ parametros.Value = Convert.ToDateTime(EndTime.ToShortDateString() + " 23:59:59");
423+
424+ cmd.CommandType = CommandType.StoredProcedure;
425+ dr = cmd.ExecuteReader();
426+ if (dr.HasRows)
427+ {
428+ while (dr.Read())
429+ {
430+ transactionsDAL = new TransactionsDAL();
431+ transactionsDAL.transactionID = dr.GetInt64(dr.GetOrdinal("TransactionID"));
432+ transactionsDAL.branchID = dr.GetInt32(dr.GetOrdinal("BranchID"));
433+ transactionsDAL.amount = dr.GetDecimal(dr.GetOrdinal("Amount"));
434+ transactionsDAL.shiftID = dr.GetInt32(dr.GetOrdinal("ShiftID"));
435+ transactionsDAL.date = dr.GetDateTime(dr.GetOrdinal("Date"));
436+ transactionsDAL.transactionStatusID = dr.GetInt32(dr.GetOrdinal("TransactionStatusID"));
437+ transactionsDAL.userID = dr.GetInt32(dr.GetOrdinal("UserID"));
438+ transactionsDAL.commission = dr.GetDecimal(dr.GetOrdinal("Commission"));
439+ transactionsDAL.partnerCommission = dr.GetDecimal(dr.GetOrdinal("PartnerCommission"));
440+ transactionsDAL.totalGainAmount = dr.GetInt32(dr.GetOrdinal("TotalGainAmount"));
441+ //transactionsDAL.branchName = dr.GetString(dr.GetOrdinal("BranchName"));
442+ //transactionsDAL.transactionStatusName = dr.GetString(dr.GetOrdinal("TransactionStatusName"));
443+ //transactionsDAL.shiftName = dr.GetString(dr.GetOrdinal("ShiftName"));
444+ // transactionsDAL.userName = dr.GetString(dr.GetOrdinal("UserName"));
445+ transactionsDAL.lotteryName = dr.GetString(dr.GetOrdinal("LotteryName"));
446+ transactionsDAL.ticketID = dr.GetString(dr.GetOrdinal("TicketID"));
447+ transactionsDAL.discount = dr.GetDecimal(dr.GetOrdinal("Discount"));
448+ //transactionsDAL.codeName = dr.GetString(dr.GetOrdinal("CodeName"));
449+ transactionsList.Add(transactionsDAL);
450+ }
451+ }
452+ con.Close();
453+ }
454+ catch (Exception e)
455+ {
456+ errorDescription = "Error de SQL :" + e.Message;
457+ errorCode = 1;
458+ }
459+
460+ return transactionsList;
461+ }
462+
366463 public List<TransactionsDAL> Search(LoginDAL loginDAL,bool usedDate = false)
367464 {
368465 ErrorCode = 0;
@@ -460,6 +557,7 @@
460557 return transactionsList;
461558 }
462559
560+
463561 public List<TransactionsDAL> SearchStadistic(LoginDAL loginDAL)
464562 {
465563 ErrorCode = 0;
--- NumerosGanadoresWF.aspx.cs (revision 59)
+++ NumerosGanadoresWF.aspx.cs (revision 60)
@@ -18,10 +18,10 @@
1818 if (Session["DatosUsuario"] != null)
1919 {
2020 loginDAL = (LoginDAL)Session["DatosUsuario"];
21-
21+
2222 if (!IsPostBack)
2323 {
24-
24+
2525 InputFecha.Value = DateTime.Now.ToString("yyyy-MM-dd");
2626 GvNumbers.DataSource = null;
2727 GvNumbers.DataBind();
@@ -33,7 +33,7 @@
3333 GvNumbers.Columns.RemoveAt(9);
3434 }
3535 else
36- {
36+ {
3737 menuUser.Style.Add("display", "none");
3838 }
3939
@@ -45,10 +45,10 @@
4545 {
4646 Response.Redirect("InicioWF.aspx");
4747 }
48-
49-
5048
5149
50+
51+
5252 }
5353
5454 /**Inicio Botones Menu Usuario Vendedor**********************/
@@ -175,16 +175,30 @@
175175
176176 protected void GvNumbersRowDeleting(object sender, GridViewDeleteEventArgs e)
177177 {
178- if (e.RowIndex >= 0)
178+
179+ try
179180 {
180- Borrar(GvNumbers.Rows[e.RowIndex].Cells[0].Text);
181+ if (e.RowIndex >= 0)
182+ {
183+ if (AnularGanadores(Convert.ToDateTime(GvNumbers.Rows[e.RowIndex].Cells[7].Text), GvNumbers.Rows[e.RowIndex].Cells[2].Text + " " + GvNumbers.Rows[e.RowIndex].Cells[8].Text))
184+ {
181185
182- //string title = "Estas seguro?";
183- //string text = "Una vez Borrado, ¡no podrá recuperar este registro!";
184- //ScriptManager.RegisterStartupScript(this, this.GetType(), null, "NotificacionYN('" + GvNumbers.Rows[e.RowIndex].Cells[0].Text + "','" + title + "','" + text + "','" + OpcionesNotificaciones.Borrar + "');", true);
185- //GvNumbers.DataSource = null;
186- //GvNumbers.DataBind();
186+ Borrar(GvNumbers.Rows[e.RowIndex].Cells[0].Text);
187+ }
188+
189+ //string title = "Estas seguro?";
190+ //string text = "Una vez Borrado, ¡no podrá recuperar este registro!";
191+ //ScriptManager.RegisterStartupScript(this, this.GetType(), null, "NotificacionYN('" + GvNumbers.Rows[e.RowIndex].Cells[0].Text + "','" + title + "','" + text + "','" + OpcionesNotificaciones.Borrar + "');", true);
192+ //GvNumbers.DataSource = null;
193+ //GvNumbers.DataBind();
194+ }
195+
187196 }
197+ catch (Exception)
198+ {
199+
200+ //throw;
201+ }
188202 }
189203 protected void GvNumbers_RowUpdating(object sender, GridViewUpdateEventArgs e)
190204 {
@@ -197,7 +211,7 @@
197211 protected void Borrar(string codigo)
198212 {
199213 WinNumbersDAL winNumbersDAL = new WinNumbersDAL();
200- // string result = "Congratulations!!!";
214+ // string result = "Congratulations!!!";
201215 try
202216 {
203217
@@ -205,7 +219,7 @@
205219 winNumbersDAL.Delete(loginDAL);
206220
207221 Cargar();
208- // result = "Registro Eliminado exitosamente!";
222+ // result = "Registro Eliminado exitosamente!";
209223
210224 }
211225 catch (Exception ex)
@@ -215,7 +229,42 @@
215229 winNumbersDAL = null;
216230
217231 }
232+ protected bool AnularGanadores(DateTime fecha, string loteria)
233+ {
234+ bool respuesta = false;
235+ TransactionsDAL transactionsDAL = new TransactionsDAL();
236+ List<TransactionsDAL> listTransactionsDAL = new List<TransactionsDAL>();
237+ // string result = "Congratulations!!!";
238+ try
239+ {
240+ transactionsDAL.LotteryName = loteria;
241+ transactionsDAL.StartTime = fecha;
242+ transactionsDAL.EndTime = fecha;
243+ listTransactionsDAL = transactionsDAL.SearchWiner(loginDAL);
244+ if (listTransactionsDAL.Count > 0)
245+ {
246+ foreach (TransactionsDAL item in listTransactionsDAL)
247+ {
248+ transactionsDAL.TransactionID = item.TransactionID;
249+ transactionsDAL.LotteryName = item.LotteryName;
250+ transactionsDAL.StartTime = fecha;
251+ transactionsDAL.StartTime = fecha;
252+ transactionsDAL.EditWiner(loginDAL);
253+ }
218254
255+ }
256+ respuesta = true;
257+
258+ }
259+ catch (Exception ex)
260+ {
261+ ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns", "alert('Algo salio mal, mas detalles: '" + ex.Message + ");", true);
262+ }
263+
264+ return respuesta;
265+
266+ }
267+
219268 //[WebMethod]
220269 //public static string Borrar(string codigo)
221270 //{
@@ -228,7 +277,7 @@
228277 // winNumbersDAL.Delete(loginDAL);
229278
230279 // result = "Registro Eliminado exitosamente!";
231-
280+
232281 // }
233282 // catch (Exception ex)
234283 // {
@@ -240,7 +289,7 @@
240289 // return result;
241290
242291 //}
243-
244-
292+
293+
245294 }
246295 }
\ No newline at end of file
Show on old repository browser