protected void btnReset_Click(object sender, EventArgs e) { try { hdnSortExpression.Value = string.Empty; hdnSortDirection.Value = string.Empty; txtCustomerSearch.Text = string.Empty; txtLocalCustomerNo.Text = string.Empty; txtSourceCountry.Text = string.Empty; hdnChangeNotSaved.Value = "N"; hdnGridRowSelectedPrvious.Value = null; gvCustomerDetails.PageIndex = 0; hdnPageNumber.Value = "1"; hdnSortExpression.Value = ""; hdnSortDirection.Value = ""; customerMaintenanceBL = new CustomerMaintenanceBL(); DataSet initialData = customerMaintenanceBL.GetInitialData(out errorId); customerMaintenanceBL = null; if (initialData.Tables.Count != 0 && errorId != 2) { Session["CustomerData"] = initialData.Tables[0]; BindGrid(initialData.Tables[0]); } else { ExceptionHandler("Error in fetching data", string.Empty); } } catch (Exception ex) { ExceptionHandler("Error in reset.", ex.Message); } }
private void LoadData() { customerMaintenanceBL = new CustomerMaintenanceBL(); DataSet initialData = customerMaintenanceBL.GetInitialData(out errorId); customerMaintenanceBL = null; if (initialData.Tables.Count != 0 && errorId != 2) { Session["CustomerData"] = initialData.Tables[0]; Session["FilteredCustomerData"] = initialData.Tables[0]; hdnPageNumber.Value = "1"; BindGrid(initialData.Tables[0]); } else { ExceptionHandler("Error in fetching data", string.Empty); } }
protected void btnSaveChanges_Click(object sender, EventArgs e) { try { int rowIndex = Convert.ToInt32(hdnGridRowSelectedPrvious.Value); //Calculate the rowindex for validation int rowIndexValidation = (gvCustomerDetails.PageIndex * gvCustomerDetails.PageSize) + rowIndex; //Validate Page.Validate("GroupUpdate_" + rowIndexValidation + ""); if (!Page.IsValid) { mpeSaveUndo.Hide(); msgView.SetMessage("Invalid data entered.Please correct.", MessageType.Warning, PositionType.Auto); return; } string userCode = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()); Int32 customerCode = Convert.ToInt32(((Label)gvCustomerDetails.Rows[rowIndex].FindControl("lblCustomerId")).Text); string fixedMobileFlag = ((DropDownList)gvCustomerDetails.Rows[rowIndex].FindControl("ddlFixedMobile")).SelectedValue; string isDisplayOnGlobalStatement; if (((CheckBox)gvCustomerDetails.Rows[rowIndex].FindControl("cbDisplayOnGlobalStmt")).Checked) { isDisplayOnGlobalStatement = "Y"; } else { isDisplayOnGlobalStatement = "N"; } string isDisplayOnAccountStatement; if (((CheckBox)gvCustomerDetails.Rows[rowIndex].FindControl("cbDisplayOnAccountStmt")).Checked) { isDisplayOnAccountStatement = "Y"; } else { isDisplayOnAccountStatement = "N"; } customerMaintenanceBL = new CustomerMaintenanceBL(); DataSet customerData = customerMaintenanceBL.UpdateCustomerData(customerCode, fixedMobileFlag, isDisplayOnGlobalStatement, isDisplayOnAccountStatement, userCode, out errorId); customerMaintenanceBL = null; if (customerData.Tables.Count != 0 && errorId != 2) { Session["CustomerData"] = customerData.Tables[0]; //WUIN-746 clearing sort hidden files hdnSortExpression.Value = string.Empty; hdnSortDirection.Value = string.Empty; PopulateGrid(); hdnChangeNotSaved.Value = "N"; hdnGridRowSelectedPrvious.Value = null; msgView.SetMessage("Customer details updated successfully.", MessageType.Success, PositionType.Auto); } else { msgView.SetMessage("Failed to updated customer details.", MessageType.Warning, PositionType.Auto); } } catch (Exception ex) { ExceptionHandler("Error in saving customer data.", ex.Message); } }
//JIRA-746 CHanges by Ravi on 05/03/2019 -- End protected void gvCustomerDetails_RowCommand(object sender, GridViewCommandEventArgs e) { try { string userCode = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()); if (e.CommandName == "saverow") { if (!string.IsNullOrEmpty(hdnGridRowSelectedPrvious.Value)) { int rowIndex = Convert.ToInt32(hdnGridRowSelectedPrvious.Value); //int rowIndex = ((GridViewRow)((ImageButton)(e.CommandSource)).NamingContainer).RowIndex; Int32 customerCode = Convert.ToInt32(((Label)gvCustomerDetails.Rows[rowIndex].FindControl("lblCustomerId")).Text); string fixedMobileFlag = ((DropDownList)gvCustomerDetails.Rows[rowIndex].FindControl("ddlFixedMobile")).SelectedValue; string isDisplayOnGlobalStatement; if (((CheckBox)gvCustomerDetails.Rows[rowIndex].FindControl("cbDisplayOnGlobalStmt")).Checked) { isDisplayOnGlobalStatement = "Y"; } else { isDisplayOnGlobalStatement = "N"; } string isDisplayOnAccountStatement; if (((CheckBox)gvCustomerDetails.Rows[rowIndex].FindControl("cbDisplayOnAccountStmt")).Checked) { isDisplayOnAccountStatement = "Y"; } else { isDisplayOnAccountStatement = "N"; } customerMaintenanceBL = new CustomerMaintenanceBL(); DataSet customerData = customerMaintenanceBL.UpdateCustomerData(customerCode, fixedMobileFlag, isDisplayOnGlobalStatement, isDisplayOnAccountStatement, userCode, out errorId); customerMaintenanceBL = null; if (customerData.Tables.Count != 0 && errorId != 2) { //WUIN-746 clearing sort hidden files hdnSortExpression.Value = string.Empty; hdnSortDirection.Value = string.Empty; Session["CustomerData"] = customerData.Tables[0]; PopulateGrid(); hdnChangeNotSaved.Value = "N"; hdnGridRowSelectedPrvious.Value = null; msgView.SetMessage("Customer details updated successfully.", MessageType.Success, PositionType.Auto); } else { msgView.SetMessage("Failed to updated customer details.", MessageType.Warning, PositionType.Auto); } } } else if (e.CommandName == "cancelrow") { //WUIN-746 clearing sort hidden files hdnSortExpression.Value = string.Empty; hdnSortDirection.Value = string.Empty; PopulateGrid(); hdnChangeNotSaved.Value = "N"; hdnGridRowSelectedPrvious.Value = null; } } catch (Exception ex) { ExceptionHandler("Error in saving customer data.", ex.Message); } }