示例#1
0
 protected void GvData_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         int         SaveStatus = 0;
         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.GetRequisitionDtlById(Convert.ToInt64(hdUniqueId.Value));
             if (dtInfo.Rows.Count > 0)
             {
                 txtReqCode.Text     = dtInfo.Rows[0]["ReqCode"].ToString();
                 txtReqDate.Text     = Convert.ToDateTime(dtInfo.Rows[0]["ReqDate"]).ToString("dd-MMM-yyyy");
                 txtDrawNo.Text      = dtInfo.Rows[0]["DrawNo"].ToString();
                 txtDrawDate.Text    = Convert.ToDateTime(dtInfo.Rows[0]["DrawDate"]).ToString("dd-MMM-yyyy");
                 txtLotteryType.Text = dtInfo.Rows[0]["LotteryType"].ToString();
                 txtLotteryName.Text = dtInfo.Rows[0]["LotteryName"].ToString();
                 txtDrawNo.Text      = dtInfo.Rows[0]["DrawNo"].ToString();
                 SaveStatus          = Convert.ToInt16(dtInfo.Rows[0]["SaveStatus"].ToString().ToUpper());
                 btnConfirm.Visible  = true;
                 double    TotAmount        = 0;
                 DataTable dtReqTransaction = objLtmsService.GetAdjustmentDtlByRequisitionId(Convert.ToInt32(hdUniqueId.Value));
                 if (dtReqTransaction.Rows.Count > 0)
                 {
                     GvTransaction.DataSource = dtReqTransaction;
                     GvTransaction.DataBind();
                 }
                 CalculateRemainingBalence();
                 btnConfirm.Visible = true;
                 if (SaveStatus == 1000)
                 {
                     btnConfirm.Visible = false;
                 }
             }
             dtInfo.Dispose();
             pnlDataEntry.Visible   = true;
             pnlDataDisplay.Visible = false;
         }
         if (e.CommandName == "PrintEntry")
         {
             clsInputParameter objInputParameter = new clsInputParameter();
             objInputParameter.DataUniqueId = Convert.ToInt64(hdUniqueId.Value);
             objInputParameter.RequestUrl   = Request.QueryString["ID"].Trim();
             Session["InputParameter"]      = objInputParameter;
             Session["ReportName"]          = "TicketInventoryAdjustment";
             Response.Redirect("rptViewAppReport.aspx");
         }
         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);
     }
 }