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); rdoReconStatus1.Checked = true; dtInfo = objLtmsService.GetDealerDepositDtlById(Convert.ToInt64(hdUniqueId.Value)); if (dtInfo.Rows.Count > 0) { txtDepositDate.Text = Convert.ToDateTime(dtInfo.Rows[0]["DepositDate"]).ToString("dd-MMM-yyyy"); txtDepositAmount.Text = dtInfo.Rows[0]["DepositAmount"].ToString(); txtDepositId.Text = dtInfo.Rows[0]["DepositId"].ToString().ToUpper(); ddlDepositMethod.SelectedValue = dtInfo.Rows[0]["DepositMethodId"].ToString().ToUpper(); txtRemarks.Text = dtInfo.Rows[0]["Remarks"].ToString().ToUpper(); txtReconRemarks.Text = dtInfo.Rows[0]["ReconRemarks"].ToString().ToUpper(); } dtInfo.Dispose(); pnlDataEntry.Visible = true; pnlDataDisplay.Visible = false; btnSave.Text = "Update"; // lblSubHead.Text = "Update Location Information"; txtReconRemarks.Focus(); } 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); } }
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.GetDealerDepositDtlById(Convert.ToInt64(hdUniqueId.Value)); if (dtInfo.Rows.Count > 0) { txtDepositDate.Text = Convert.ToDateTime(dtInfo.Rows[0]["DepositDate"]).ToString("dd-MMM-yyyy"); txtDepositAmount.Text = dtInfo.Rows[0]["DepositAmount"].ToString(); txtDepositId.Text = dtInfo.Rows[0]["DepositId"].ToString().ToUpper(); ddlDepositMethod.SelectedValue = dtInfo.Rows[0]["DepositMethodId"].ToString().ToUpper(); ddlDepositTo.SelectedValue = dtInfo.Rows[0]["DepositToId"].ToString().ToUpper(); txtRemarks.Text = dtInfo.Rows[0]["Remarks"].ToString().ToUpper(); SaveStatus = Convert.ToInt16(dtInfo.Rows[0]["SaveStatus"].ToString().ToUpper()); btnSave.Visible = true; btnConfirm.Visible = true; if (SaveStatus == 1) { btnSave.Visible = false; btnConfirm.Visible = false; } } dtInfo.Dispose(); pnlDataEntry.Visible = true; pnlDataDisplay.Visible = false; btnSave.Text = "Update"; // lblSubHead.Text = "Update Location Information"; txtDepositAmount.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; } //dtInfo = objMstLocation.IsChildRecordExistForLocation(hdUniqueId.Value); //if (dtInfo.Rows.Count > 0) //{ // ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('This data already exist in another dependent table. Deletion failed !');", true); // dtInfo.Dispose(); // return; //} bool isDeleted = objLtmsService.DeleteInDealerDeposit(Convert.ToInt64(hdUniqueId.Value)); if (isDeleted == true) { ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('Deposit information deleted.');", true); BindGvData(); // 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); } }