/// <summary> /// Loads CustomerMasterMaintenanceForm /// Fill Country combobox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CustomerMasterForm_Load(object sender, EventArgs e) { FormDatatableFromVo(); CustomerCode_txt.Select(); Update_btn.Enabled = Delete_btn.Enabled = false; }
/// <summary> /// Handles Load event for user data Insert/Update operations /// Loading user data for update user data and binding controls with selected user record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddCustomerMasterForm_Load(object sender, EventArgs e) { FormDatatableFromVo(); CustomerCode_txt.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadUserData(updateData); CustomerCode_txt.Enabled = false; CustomerName_txt.Select(); } }
/// <summary> /// event to clear the controls of search criteria /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Clear_btn_Click(object sender, EventArgs e) { CustomerCode_txt.Text = string.Empty; CustomerName_txt.Text = string.Empty; Address1_txt.Text = string.Empty; Address2_txt.Text = string.Empty; PhoneNo_txt.Text = string.Empty; EmailId_txt.Text = string.Empty; Customerdetails_dgv.DataSource = null; CustomerCode_txt.Select(); Update_btn.Enabled = Delete_btn.Enabled = false; }
/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (CustomerCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, CustomerCode_lbl.Text); popUpMessage.Warning(messageData, Text); CustomerCode_txt.Focus(); return(false); } if (CustomerName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, CustomerName_lbl.Text); popUpMessage.Warning(messageData, Text); CustomerName_txt.Focus(); return(false); } return(true); }
/// <summary> /// update data to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { var sch = StringCheckHelper.GetInstance(); if (CheckMandatory()) { if (!sch.IsASCII(CustomerCode_txt.Text) || !sch.IsASCII(CustomerName_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (!sch.IsASCII(CustomerCode_txt.Text)) { CustomerCode_txt.Focus(); } else { CustomerName_txt.Focus(); } return; } CustomerVo inVo = new CustomerVo { CustomerCode = CustomerCode_txt.Text.Trim(), CustomerName = CustomerName_txt.Text.Trim(), Address1 = Address1_txt.Text.Trim(), Address2 = Address2_txt.Text.Trim(), EmailId = EmailId_txt.Text.Trim(), Remarks = Remarks_txt.Text.Trim(), PhoneNo = PhoneNo_txt.Text.Trim(), }; if (string.Equals(mode, CommonConstants.MODE_ADD)) { CustomerVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, CustomerCode_lbl.Text + " : " + CustomerCode_txt.Text); popUpMessage.ConfirmationOkCancel(messageData, Text); return; } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { CustomerVo outVo = (CustomerVo)base.InvokeCbm(new AddCustomerMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { inVo.CustomerId = updateData.CustomerId; CustomerVo outVo = (CustomerVo)base.InvokeCbm(new UpdateCustomerMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }