/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (PaletteCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, PaletteCode_lbl.Text); popUpMessage.Warning(messageData, Text); PaletteCode_txt.Focus(); return(false); } if (PaletteName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, PaletteName_lbl.Text); popUpMessage.Warning(messageData, Text); PaletteName_txt.Focus(); return(false); } if (Area_cmb.Text == string.Empty || Area_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Area_lbl.Text); popUpMessage.Warning(messageData, Text); Area_cmb.Focus(); return(false); } return(true); }
/// <summary> /// Loads area form /// Fill item combobox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PaletteForm_Load(object sender, EventArgs e) { FormDatatableFromVo(); ComboBind(Area_cmb, areaDatatable, "name", "id"); PaletteCode_txt.Select(); Update_btn.Enabled = Delete_btn.Enabled = false; }
/// <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) { PaletteCode_txt.Text = string.Empty; PaletteName_txt.Text = string.Empty; Area_cmb.SelectedIndex = -1; Palette_dgv.DataSource = null; PaletteCode_txt.Select(); Update_btn.Enabled = Delete_btn.Enabled = false; }
/// <summary> /// Handles Load event for mold data Insert/Update operations /// Loading mold data for update mold data and binding controls with selected mold record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddPaletteForm_Load(object sender, EventArgs e) { FormDatatableFromVo(); ComboBind(Area_cmb, areaDatatable, "name", "id"); PaletteCode_txt.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadUserData(updateData); PaletteCode_txt.Enabled = false; PaletteName_txt.Select(); } }
/// <summary> /// update the record to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { PaletteVo inVo = new PaletteVo(); if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(PaletteCode_txt.Text) || !sch.IsASCII(PaletteName_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (!sch.IsASCII(PaletteCode_txt.Text)) { PaletteCode_txt.Focus(); } else { PaletteName_txt.Focus(); } return; } //if(PaletteCode_txt.Text.Trim().Length < 4) //{ // MessageData messageData = new MessageData("mmci00008", Properties.Resources.mmci00008, PaletteCode_lbl.Text); // popUpMessage.Warning(messageData, Text); // PaletteCode_txt.Focus(); // return; //} inVo.PaletteCode = PaletteCode_txt.Text.Trim(); inVo.PaletteName = PaletteName_txt.Text.Trim(); inVo.AreaId = Convert.ToInt32(Area_cmb.SelectedValue); if (string.Equals(mode, CommonConstants.MODE_ADD)) { PaletteVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, PaletteCode_lbl.Text + " : " + PaletteCode_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); PaletteCode_txt.Focus(); return; } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { PaletteVo outVo = (PaletteVo)base.InvokeCbm(new AddPaletteMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.PaletteId = updateData.PaletteId; PaletteVo outVo = (PaletteVo)base.InvokeCbm(new UpdatePaletteMasterMntCbm(), 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(); } } }