Exemple #1
0
 protected void GvData_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         DataTable   dtInfo = new DataTable();
         GridViewRow gvrow  = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
         hdUniqueId.Value = GvData.DataKeys[gvrow.RowIndex].Value.ToString();
         // fill the Location information for edit
         if (e.CommandName == "EditEntry")
         {
             objValidateData.ClearAllInputField(pnlDataEntry);
             dtInfo = objLtmsService.GetLotteryDtlById(Convert.ToInt64(hdUniqueId.Value));
             if (dtInfo.Rows.Count > 0)
             {
                 txtLotteryName.Text          = dtInfo.Rows[0]["LotteryName"].ToString();
                 ddlLotteryType.SelectedValue = dtInfo.Rows[0]["LotteryTypeId"].ToString();
                 txtNoOfDigit.Text            = dtInfo.Rows[0]["NoOfDigit"].ToString();
                 txtSyndicateRate.Text        = dtInfo.Rows[0]["SyndicateRate"].ToString();
                 txtRateForSpl.Text           = dtInfo.Rows[0]["RateForSpl"].ToString();
                 txtTotTicketRate.Text        = dtInfo.Rows[0]["TotTicketRate"].ToString();
                 txtGstRate.Text             = dtInfo.Rows[0]["GstRate"].ToString();
                 txtPrizeCategory.Text       = dtInfo.Rows[0]["PrizeCategory"].ToString();
                 chkIncludeConsPrize.Checked = Convert.ToBoolean(dtInfo.Rows[0]["IncludeConsPrize"].ToString());
                 txtClaimDays.Text           = dtInfo.Rows[0]["ClaimDays"].ToString();
                 txtClaimDaysVariable.Text   = dtInfo.Rows[0]["ClaimDaysVariable"].ToString();
                 txtSizeOfTicket.Text        = dtInfo.Rows[0]["SizeOfTicket"].ToString();
                 txtPaperQuality.Text        = dtInfo.Rows[0]["PaperQuality"].ToString();
             }
             dtInfo.Dispose();
             pnlDataEntry.Visible   = true;
             pnlDataDisplay.Visible = false;
             btnSave.Text           = "Update";
             // lblSubHead.Text = "Update Location Information";
             txtLotteryName.Focus();
         }
         //Delete the location information
         if (e.CommandName == "DeleteEntry")
         {
             if (objMenuOptions.AllowDelete == false)
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('You do not have proper privilege for deleting a record.');", true);
                 return;
             }
             bool isDeleted = objLtmsService.DeleteInLottery(Convert.ToInt64(hdUniqueId.Value));
             if (isDeleted == true)
             {
                 BindGvData();
                 ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('Lottery information deleted.');", true);
                 // ResetSearchFilte();
                 //BindLocationInformationDetails(cmbSearch.SelectedValue.ToString(), "", cmbSearch.SelectedValue.ToString(), true);
             }
         }
         dtInfo.Dispose();
     }
     catch (Exception Ex)
     {
         objValidateData.SaveSystemErrorLog(Ex, Request.UserHostAddress);
         var message = new JavaScriptSerializer().Serialize("Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.");
         var script  = string.Format("alert({0});", message);
         ScriptManager.RegisterClientScriptBlock(this, GetType(), "", script, true);
     }
 }