Ejemplo n.º 1
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (MoldCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldCode_txt.Focus();

                return(false);
            }

            if (MoldName_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldName_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldName_txt.Focus();

                return(false);
            }

            //if (MoldType_cmb.Text == string.Empty || MoldType_cmb.SelectedIndex < 0)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldType_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    MoldType_cmb.Focus();

            //    return false;
            //}

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// event to clear the controls of search criteria
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Clear_btn_Click(object sender, EventArgs e)
        {
            MoldCode_txt.Text = string.Empty;

            MoldName_txt.Text = string.Empty;

            MoldType_cmb.SelectedIndex = -1;

            Mold_dgv.DataSource = null;

            MoldCode_txt.Select();
            Update_btn.Enabled = Delete_btn.Enabled = false;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads Mold form
        /// Fill item combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MoldForm_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                FormDatatableFromVo();

                ComboBind(MoldType_cmb, moldTypeDatatable, "code", "id");

                MoldCode_txt.Select();

                Update_btn.Enabled = Delete_btn.Enabled = false;
            }
        }
Ejemplo n.º 4
0
        /// <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>
        protected void AddMoldForm_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                this.ProductionDate_dtp.Clear();

                FormDatatableFromVo();

                ComboBind(MoldType_cmb, moldTypeDatatable, "code", "id");

                MoldCode_txt.Select();

                if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    LoadUserData(updateData);

                    MoldCode_txt.Enabled = false;

                    MoldName_txt.Select();
                }
            }
        }
Ejemplo n.º 5
0
        /// <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 AddMoldNewForm_Load(object sender, EventArgs e)
        {
            this.ProductionDate_dtp.Clear();

            FormDatatableFromVo();

            ComboBind(MoldType_cmb, moldTypeDatatable, "code", "id");

            MoldCode_txt.Select();
            int ProcessMoldId = 0;

            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                LoadUserData(updateData);

                ProcessMoldId = updateData.MoldId;

                MoldCode_txt.Enabled = false;

                MoldName_txt.Select();
            }

            BindGrid(ProcessMoldId);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>();

                var sch = StringCheckHelper.GetInstance();

                if (!sch.IsASCII(MoldCode_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    MoldCode_txt.Focus();

                    return;
                }

                MoldVo inVo = new MoldVo();

                inVo.MoldCode   = MoldCode_txt.Text.Trim();
                inVo.MoldName   = MoldName_txt.Text.Trim();
                inVo.MoldTypeId = Convert.ToInt32(MoldType_cmb.SelectedValue);

                if (!string.IsNullOrEmpty(Weight_txt.Text))
                {
                    inVo.Weight = Convert.ToDecimal(Weight_txt.Text);
                }

                if (!string.IsNullOrEmpty(Height_txt.Text))
                {
                    inVo.Height = Convert.ToDecimal(Height_txt.Text);
                }

                if (!string.IsNullOrEmpty(Width_txt.Text))
                {
                    inVo.Width = Convert.ToDecimal(Width_txt.Text);
                }

                if (!string.IsNullOrEmpty(Depth_txt.Text))
                {
                    inVo.Depth = Convert.ToDecimal(Depth_txt.Text);
                }

                if (!string.IsNullOrWhiteSpace(ProductionDate_dtp.Text))
                {
                    inVo.ProductionDate = Convert.ToDateTime(ProductionDate_dtp.Value);
                }

                inVo.Comment = Comment_txt.Text;

                if (!string.IsNullOrEmpty(LifeShotCount_txt.Text))
                {
                    inVo.LifeShotCount = Convert.ToInt32(LifeShotCount_txt.Text);
                }

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    MoldVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, MoldCode_lbl.Text + " : " + MoldCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);

                        return;
                    }
                }

                try
                {
                    this.StartProgress(Properties.Resources.mmci00009);

                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        inVoList.add(inVo);

                        inVoList.add(GetSelectedProcessWork());

                        MoldVo outVo = (MoldVo)base.InvokeCbm(new AddMoldMasterMntNewCbm(), inVoList, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        inVo.MoldId = updateData.MoldId;

                        inVoList.add(inVo);

                        inVoList.add(GetSelectedProcessWork());

                        MoldVo outVo = (MoldVo)base.InvokeCbm(new UpdateMoldMasterMntNewCbm(), inVoList, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    this.CompleteProgress();
                }


                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (MoldCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldCode_txt.Focus();

                return(false);
            }

            //if (string.IsNullOrWhiteSpace(GlobalItemCode_txt.Text))
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, GlobalItemCode_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    MoldCode_txt.Focus();

            //    return false;
            //}

            //if (MoldName_txt.Text == string.Empty)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldName_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    MoldName_txt.Focus();

            //    return false;
            //}


            //if (Width_txt.Text == string.Empty)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Width_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    Width_txt.Focus();

            //    return false;
            //}

            //if (Depth_txt.Text == string.Empty)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Depth_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    Depth_txt.Focus();

            //    return false;
            //}

            //if (Height_txt.Text == string.Empty)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Height_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    Height_txt.Focus();

            //    return false;
            //}

            //if (Weight_txt.Text == string.Empty)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Weight_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    Weight_txt.Focus();

            //    return false;
            //}

            //if (FixedAssetNo_txt.Text == string.Empty)
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, FixedAssetNo_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    FixedAssetNo_txt.Focus();

            //    return false;
            //}

            //if (LifeShotCount_txt.Text == string.Empty || LifeShotCount_txt.Text == "0")
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LifeShotCount_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    LifeShotCount_txt.Focus();

            //    return false;
            //}

            if (!(MoldCategory_cmb.SelectedIndex > -1))
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldCategory_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldCategory_cmb.Focus();

                return(false);
            }

            if (!(Model_cmb.SelectedIndex > -1))
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Model_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                Model_cmb.Focus();

                return(false);
            }

            //if (LifeAlarmShot_txt.Text == string.Empty || LifeAlarmShot_txt.Text == "0")
            //{
            //    messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LifeAlarmShotCount_lbl.Text);
            //    popUpMessage.Warning(messageData, Text);

            //    LifeAlarmShot_txt.Focus();

            //    return false;
            //}
            if (string.IsNullOrWhiteSpace(MoldDrawingNo_txt.Text))
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, MoldDrawingNo_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                MoldDrawingNo_txt.Focus();

                return(false);
            }
            return(true);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void Ok_btn_Click(object sender, EventArgs e)
        {
            MoldDetailVo inVo = new MoldDetailVo();

            if (CheckMandatory())
            {
                var sch = StringCheckHelper.GetInstance();

                if (!sch.IsASCII(MoldCode_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (!sch.IsASCII(MoldCode_txt.Text))
                    {
                        MoldCode_txt.Focus();
                    }
                    //else
                    //{
                    //    MoldName_txt.Focus();
                    //}

                    return;
                }

                inVo.MoldCode = MoldCode_txt.Text.Trim();

                inVo.MoldName = MoldCode_txt.Text.Trim();

                if (!string.IsNullOrEmpty(Width_txt.Text))
                {
                    inVo.Width = Convert.ToDecimal(Width_txt.Text);
                }
                if (!string.IsNullOrEmpty(Depth_txt.Text))
                {
                    inVo.Depth = Convert.ToDecimal(Depth_txt.Text);
                }
                if (!string.IsNullOrEmpty(Weight_txt.Text))
                {
                    inVo.Weight = Convert.ToDecimal(Weight_txt.Text);
                }
                if (!string.IsNullOrEmpty(Height_txt.Text))
                {
                    inVo.Height = Convert.ToDecimal(Height_txt.Text);
                }

                if (!string.IsNullOrEmpty(LifeAlarmShot_txt.Text))
                {
                    inVo.LifeAlarmShotCount = Convert.ToInt32(LifeAlarmShot_txt.Text);
                }
                if (!string.IsNullOrEmpty(PASC1_txt.Text))
                {
                    inVo.PeriodicAlarmShotCount1 = Convert.ToInt32(PASC1_txt.Text);
                }

                if (!string.IsNullOrEmpty(PASC2_txt.Text))
                {
                    inVo.PeriodicAlarmShotCount2 = Convert.ToInt32(PASC2_txt.Text);
                }

                if (!string.IsNullOrEmpty(PASC3_txt.Text))
                {
                    inVo.PeriodicAlarmShotCount3 = Convert.ToInt32(PASC3_txt.Text);
                }
                if (!string.IsNullOrWhiteSpace(ProductionDate_dtp.Text))
                {
                    inVo.ProductionDate = Convert.ToDateTime(ProductionDate_dtp.Value);
                }
                if (!string.IsNullOrWhiteSpace(MoldDrawingNo_txt.Text))
                {
                    inVo.MoldDrawingNo = MoldDrawingNo_txt.Text;
                }
                inVo.Comment = Comment_txt.Text;

                if (!string.IsNullOrWhiteSpace(LifeShotCount_txt.Text))
                {
                    inVo.LifeShotCount = Convert.ToInt32(LifeShotCount_txt.Text);
                }


                if (MoldCategory_cmb.SelectedIndex > -1)
                {
                    inVo.MoldCategoryId = (int)MoldCategory_cmb.SelectedValue;
                }

                if (Model_cmb.SelectedIndex > -1)
                {
                    inVo.ModelId = (int)Model_cmb.SelectedValue;
                }

                if (!string.IsNullOrWhiteSpace(MoldItemCode_txt.Text))
                {
                    inVo.MoldItemCode = MoldItemCode_txt.Text;
                    inVo.MoldItemId   = updateData.MoldItemId;
                }

                //if (!string.IsNullOrWhiteSpace(GlobalItemCode_txt.Text))
                //{
                //    inVo.MoldItemCode = GlobalItemCode_txt.Text;
                //}

                MoldDetailVo checkVo = DuplicateCheck(inVo);

                //GlobalItemVo globalItemInVo = new GlobalItemVo();
                //globalItemInVo.GlobalItemCode = inVo.MoldItemCode;

                //GlobalItemVo checkGlobalItemVo = DuplicateCheckGlobalItem(globalItemInVo);

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    //if (checkGlobalItemVo != null && checkGlobalItemVo.AffectedCount > 0)
                    //{
                    //    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, GlobalItemCode_lbl.Text + " : " + globalItemInVo.GlobalItemCode);
                    //    logger.Info(messageData);
                    //    popUpMessage.ApplicationError(messageData, Text);
                    //    return;
                    //}

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, MoldCode_lbl.Text + " : " + MoldCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);
                        return;
                    }
                }
                else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    if (checkVo != null && checkVo.AffectedCount > 1)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, MoldCode_lbl.Text + " : " + MoldCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);
                        return;
                    }
                }

                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        MoldDetailVo outVo = (MoldDetailVo)base.InvokeCbm(new AddMoldAndMoldDetailMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        inVo.MoldId = updateData.MoldId;

                        MoldDetailVo outVo = (MoldDetailVo)base.InvokeCbm(new UpdateMoldDetailMasterMntCbm(), inVo, false);

                        if (outVo != null && outVo.AffectedCount > 0)
                        {
                            IntSuccess = outVo.AffectedCount;
                        }
                        else
                        {
                            IntSuccess = 0;
                        }
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }

                this.Close();

                //if ((IntSuccess > 0) || (IntSuccess == 0))
                //{
                //    this.Close();
                //}
            }
        }