public ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            MoldDetailVo inVo = (MoldDetailVo)vo;

            MoldVo moldInVo = new MoldVo();

            moldInVo.MoldId   = inVo.MoldId;
            moldInVo.MoldCode = inVo.MoldCode;
            moldInVo.MoldName = inVo.MoldName;
            moldInVo.Weight   = inVo.Weight;
            moldInVo.Height   = inVo.Height;
            moldInVo.Depth    = inVo.Depth;
            moldInVo.Width    = inVo.Width;

            moldInVo.Comment        = inVo.Comment;
            moldInVo.LifeShotCount  = inVo.LifeShotCount;
            moldInVo.ProductionDate = inVo.ProductionDate;

            CbmController targetCbm = new UpdateMoldMasterMntCbm();

            MoldVo moldOutVo = (MoldVo)targetCbm.Execute(trxContext, moldInVo);

            if (moldOutVo.AffectedCount > 0)
            {
                //MoldModelVo modetOutVo = (MoldModelVo)updateMoldModelCbm.Execute(trxContext, inVo);

                updateLocalItemDao.Execute(trxContext, vo);

                return(updateMolDetDao.Execute(trxContext, vo));
            }

            return(null);
        }
示例#2
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Update m_mold_detail");
            sqlQuery.Append(" Set ");
            sqlQuery.Append(" mold_category_id = :moldcategoryid, ");
            sqlQuery.Append(" life_alarm_shot_count = :lfacount ,");
            sqlQuery.Append(" periodic_mnt_alarm_shot_count1 = :pascount1 ,");
            sqlQuery.Append(" periodic_mnt_alarm_shot_count2 = :pascount2 , ");
            sqlQuery.Append(" periodic_mnt_alarm_shot_count3 = :pascount3 ");
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" mold_id = :moldid;");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("moldid", inVo.MoldId);
            sqlParameter.AddParameterInteger("moldcategoryid", inVo.MoldCategoryId);
            sqlParameter.AddParameter("lfacount", inVo.LifeAlarmShotCount);
            sqlParameter.AddParameter("pascount1", inVo.PeriodicAlarmShotCount1);
            sqlParameter.AddParameter("pascount2", inVo.PeriodicAlarmShotCount2);
            sqlParameter.AddParameter("pascount3", inVo.PeriodicAlarmShotCount3);

            MoldDetailVo outVo = new MoldDetailVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
        public ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            MoldDetailVo inVo = (MoldDetailVo)vo;

            MoldVo moldVo = new MoldVo();

            moldVo.MoldCode       = inVo.MoldCode;
            moldVo.MoldName       = inVo.MoldName;
            moldVo.Weight         = inVo.Weight;
            moldVo.Height         = inVo.Height;
            moldVo.Depth          = inVo.Depth;
            moldVo.Width          = inVo.Width;
            moldVo.Comment        = inVo.Comment;
            moldVo.LifeShotCount  = inVo.LifeShotCount;
            moldVo.ProductionDate = inVo.ProductionDate;

            MoldVo moldOutVo = (MoldVo)addMoldMasterMntCbm.Execute(trxContext, moldVo);

            MoldDetailVo moldDetailOutVo = null;

            if (moldOutVo.MoldId > 0)
            {
                inVo.MoldId            = moldOutVo.MoldId;
                moldDetailOutVo        = (MoldDetailVo)addMoldDetailMasterMntCbm.Execute(trxContext, inVo);
                moldDetailOutVo.MoldId = moldOutVo.MoldId;
            }

            return(moldDetailOutVo);
        }
        private void AddMold(TransactionContext trxContext, ValueObjectList <MoldDetailVo> moldInVo)
        {
            MoldDetailVo moldOutVo = null;

            foreach (MoldDetailVo moldDetailVo in moldInVo.GetList())
            {
                ValueObjectList <MoldDetailVo> moldGetVo = (ValueObjectList <MoldDetailVo>)getMoldIdForExcelUploadCbm.Execute(trxContext, moldDetailVo);

                if (moldGetVo != null && moldGetVo.GetList().Count > 0)
                {
                    foreach (MoldDetailVo curVo in moldGetVo.GetList())
                    {
                        if (!moldList.ContainsKey(curVo.MoldCode))
                        {
                            moldList.Add(curVo.MoldCode, curVo.MoldId);
                        }
                    }
                }
                else
                {
                    if (categoryList.ContainsKey(moldDetailVo.MoldCategoryCode))
                    {
                        moldDetailVo.MoldCategoryId = (int)categoryList[moldDetailVo.MoldCategoryCode];
                    }

                    moldOutVo = (MoldDetailVo)addMoldAndMoldDetailMasterMntCbm.Execute(trxContext, moldDetailVo);

                    moldList.Add(moldDetailVo.MoldCode, moldOutVo.MoldId);
                }
            }
        }
示例#5
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            MoldDetailVo inVo = (MoldDetailVo)vo;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append(" Update m_local_item ");
            sqlQuery.Append(" SET ");
            sqlQuery.Append(" item_cd = :item_code ,");
            sqlQuery.Append(" item_name = :item_name ,");
            sqlQuery.Append(" registration_user_cd = :registration_user_code ,");
            sqlQuery.Append(" registration_date_time = now() ");
            sqlQuery.Append(" Where ");
            sqlQuery.Append(" item_id = :id; ");

            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameter("id", inVo.MoldItemId);
            sqlParameter.AddParameterString("item_code", inVo.MoldItemCode);
            sqlParameter.AddParameterString("item_name", inVo.MoldItemCode);
            sqlParameter.AddParameterString("registration_user_code", UserData.GetUserData().UserCode);

            MoldDetailVo outVo = new MoldDetailVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
示例#6
0
        /// <summary>
        /// For setting selected user record into respective controls(textbox and combobox) for update operation
        /// passing selected user data as parameter
        /// </summary>
        /// <param name="dgvMoldType"></param>
        private void LoadUserData(MoldDetailVo dgvMoldType)
        {
            if (dgvMoldType != null)
            {
                this.MoldCode_txt.Text = dgvMoldType.MoldCode;

                this.MoldName_txt.Text = dgvMoldType.MoldName;


                //Shelf_cmb.SelectedValue = outVo.MoldDetailListVo[0].FixedShelfId;

                Weight_txt.Text = dgvMoldType.Weight.ToString();

                Width_txt.Text = dgvMoldType.Width.ToString();

                Height_txt.Text = dgvMoldType.Height.ToString();

                Depth_txt.Text = dgvMoldType.Depth.ToString();

                PASC1_txt.Text = dgvMoldType.PeriodicAlarmShotCount1.ToString();

                PASC2_txt.Text = dgvMoldType.PeriodicAlarmShotCount2.ToString();

                PASC3_txt.Text = dgvMoldType.PeriodicAlarmShotCount3.ToString();

                LifeAlarmShot_txt.Text = dgvMoldType.LifeAlarmShotCount.ToString();

                LifeShotCount_txt.Text = dgvMoldType.LifeShotCount.ToString();

                Comment_txt.Text = dgvMoldType.Comment;

                MoldDrawingNo_txt.Text = dgvMoldType.MoldDrawingNo;

                if (dgvMoldType.ProductionDate != DateTime.MinValue)
                {
                    ProductionDate_dtp.Text = dgvMoldType.ProductionDate.ToString();
                }

                if (dgvMoldType.MoldCategoryId > 0)
                {
                    MoldCategory_cmb.SelectedValue = dgvMoldType.MoldCategoryId;
                }

                if (dgvMoldType.ModelId > 0)
                {
                    Model_cmb.SelectedValue = dgvMoldType.ModelId;
                }

                if (!string.IsNullOrEmpty(dgvMoldType.MoldItemCode))
                {
                    GlobalItemCode_txt.Text = dgvMoldType.SapItemCode;
                }

                if (!string.IsNullOrEmpty(dgvMoldType.SapItemCode))
                {
                    MoldItemCode_txt.Text = dgvMoldType.MoldItemCode;
                }
            }
        }
示例#7
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            //create SQL
            sqlQuery.Append("Select ");
            sqlQuery.Append("   mo.mold_id, ");
            sqlQuery.Append("   mo.mold_cd ");
            sqlQuery.Append(" from m_mold_detail md ");
            sqlQuery.Append(" inner join m_mold mo on md.mold_id = mo.mold_id");
            sqlQuery.Append(" where mo.factory_cd = :factorycd ");

            if (inVo.MoldCode != null)
            {
                sqlQuery.Append(" and UPPER(mo.mold_cd) = UPPER(:moldcd) ");
            }

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("factorycd", trxContext.UserData.FactoryCode);


            if (inVo.MoldCode != null)
            {
                sqlParameter.AddParameterString("moldcd", inVo.MoldCode);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ValueObjectList <MoldDetailVo> outVo = null;

            while (dataReader.Read())
            {
                //if (outVo == null || !outVo.GetList().Exists(t => t.MoldId == ConvertDBNull<Int32>(dataReader, "mold_id")))
                //{
                MoldDetailVo currOutVo = new MoldDetailVo();
                currOutVo.MoldId   = ConvertDBNull <int>(dataReader, "mold_id");
                currOutVo.MoldCode = ConvertDBNull <string>(dataReader, "mold_cd");

                if (outVo == null)
                {
                    outVo = new ValueObjectList <MoldDetailVo>();
                }
                outVo.add(currOutVo);
                // }
            }
            dataReader.Close();

            return(outVo);
        }
示例#8
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Insert into m_mold_detail");
            sqlQuery.Append(" ( ");
            sqlQuery.Append("   mold_id, ");
            sqlQuery.Append("   mold_category_id, ");
            sqlQuery.Append("   life_alarm_shot_count, ");
            sqlQuery.Append("   periodic_mnt_alarm_shot_count1, ");
            sqlQuery.Append("   periodic_mnt_alarm_shot_count2, ");
            sqlQuery.Append("   periodic_mnt_alarm_shot_count3, ");
            sqlQuery.Append("   registration_user_cd, ");
            sqlQuery.Append("   registration_date_time, ");
            sqlQuery.Append("   factory_cd ) ");
            sqlQuery.Append(" values (");
            sqlQuery.Append("   :moldid , ");
            sqlQuery.Append("   :moldcategoryid , ");
            sqlQuery.Append("   :lfacount , ");
            sqlQuery.Append("   :pascount1 , ");
            sqlQuery.Append("   :pascount2 , ");
            sqlQuery.Append("   :pascount3 , ");
            sqlQuery.Append("   :registrationusercode , ");
            sqlQuery.Append("   :registrationdatetime , ");
            sqlQuery.Append("   :factorycode );  ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("moldid", inVo.MoldId);
            sqlParameter.AddParameter("moldcategoryid", inVo.MoldCategoryId);
            sqlParameter.AddParameter("lfacount", inVo.LifeAlarmShotCount);
            sqlParameter.AddParameter("pascount1", inVo.PeriodicAlarmShotCount1);
            sqlParameter.AddParameter("pascount2", inVo.PeriodicAlarmShotCount2);
            sqlParameter.AddParameter("pascount3", inVo.PeriodicAlarmShotCount3);

            UserData userdata = trxContext.UserData;

            sqlParameter.AddParameterString("registrationusercode", userdata.UserCode);
            sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime);
            sqlParameter.AddParameterString("factorycode", userdata.FactoryCode);

            MoldDetailVo outVo = new MoldDetailVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
示例#9
0
        /// <summary>
        /// Constructor for the  form
        /// </summary>
        /// <param name="pmode"></param>
        /// <param name="userItem"></param>
        public AddMoldDetailForm(string pmode, MoldDetailVo dataItem = null)
        {
            InitializeComponent();

            mode = pmode;

            updateData = dataItem;

            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                this.Text = UpdateText_lbl.Text;
            }
        }
示例#10
0
        public ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            MoldDetailVo outVo = (MoldDetailVo)deleteMoldDetailMasterMntCbm.Execute(trxContext, vo);


            if (outVo.AffectedCount > 0)
            {
                MoldDetailVo inVo = (MoldDetailVo)vo;

                MoldVo moldInVo = new MoldVo();
                moldInVo.MoldId = inVo.MoldId;

                deleteMoldMasterMntCbm.Execute(trxContext, moldInVo);
            }

            return(outVo);
        }
示例#11
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("select mc.mold_id,cv.cavity_id,gmi.mold_item_id from m_mold_detail md");
            sqlQuery.Append(" inner join m_mold mc on mc.mold_id = md.mold_id");
            sqlQuery.Append(" left outer join m_cavity cv on cv.mold_id = mc.mold_id");
            sqlQuery.Append(" left outer join m_mold_item gmi on gmi.mold_id = mc.mold_id");

            sqlQuery.Append(" where mc.factory_cd =:faccd ");

            if (inVo.MoldCode != null)
            {
                sqlQuery.Append(" and UPPER(mc.mold_cd) = UPPER(:moldcd) ");
            }

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", trxContext.UserData.FactoryCode);

            if (inVo.MoldCode != null)
            {
                sqlParameter.AddParameterString("moldcd", inVo.MoldCode);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            MoldDetailVo outVo = new MoldDetailVo();

            while (dataReader.Read())
            {
                outVo.CavityId   = ConvertDBNull <int?>(dataReader, "cavity_id");
                outVo.MoldItemId = ConvertDBNull <int?>(dataReader, "mold_item_id");
            }

            dataReader.Close();

            return(outVo);
        }
        public ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            MoldDetailVo inVo = (MoldDetailVo)vo;

            MoldItemVo moldItemInVo = new MoldItemVo();

            moldItemInVo.MoldId = inVo.MoldId;

            deleteMoldItemCbm.Execute(trxContext, moldItemInVo);

            CavityVo cavityInVo = new CavityVo();

            cavityInVo.MoldId = inVo.MoldId;

            deleteCavityByMoldIdCbm.Execute(trxContext, cavityInVo);

            return(deleteMoldDetailMasterMntCbm.Execute(trxContext, inVo));
        }
示例#13
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Select Count(*) as MoldCount from m_mold ");
            sqlQuery.Append(" where 1 = 1 ");

            if (inVo.MoldCode != null)
            {
                sqlQuery.Append(" and UPPER(mold_cd) = UPPER(:moldcd) ");
            }


            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            if (inVo.MoldCode != null)
            {
                sqlParameter.AddParameterString("moldcd", inVo.MoldCode);
            }


            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            MoldDetailVo outVo = new MoldDetailVo {
                AffectedCount = 0
            };

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["MoldCount"]);
            }

            dataReader.Close();

            return(outVo);
        }
示例#14
0
        ///// <summary>
        ///// checks duplicate Item Code
        ///// </summary>
        ///// <param name="gItemVo"></param>
        ///// <returns></returns>
        //private GlobalItemVo DuplicateCheckGlobalItem(GlobalItemVo gItemVo)
        //{
        //    GlobalItemVo outVo = new GlobalItemVo();

        //    try
        //    {
        //        outVo = (GlobalItemVo)base.InvokeCbm(new CheckGlobalItemMasterMntCbm(), gItemVo, false);
        //    }
        //    catch (Framework.ApplicationException exception)
        //    {
        //        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
        //        logger.Error(exception.GetMessageData());
        //    }

        //    return outVo;
        //}

        /// <summary>
        /// checks duplicate mold Code
        /// </summary>
        /// <returns></returns>
        private MoldDetailVo DuplicateCheck(MoldDetailVo moldDetailVo)
        {
            MoldDetailVo outVo = new MoldDetailVo();

            try
            {
                this.Cursor = Cursors.WaitCursor;
                outVo       = (MoldDetailVo)base.InvokeCbm(new CheckMoldDetailMasterMntCbm(), moldDetailVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
            return(outVo);
        }
示例#15
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Delete From m_mold_detail");
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" mold_id = :moldid;");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("moldid", inVo.MoldId);

            MoldDetailVo outVo = new MoldDetailVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
示例#16
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldDetailVo inVo = (MoldDetailVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            //create SQL
            sqlQuery.Append("Select ");
            sqlQuery.Append("   mo.mold_id, ");
            sqlQuery.Append("   mo.mold_cd, ");
            sqlQuery.Append("   mo.mold_name, ");
            sqlQuery.Append("   CONCAT(mo.mold_cd, '-',mo.mold_name) as moldcodename,");
            sqlQuery.Append("   mo.width,  ");
            sqlQuery.Append("   mo.depth, ");
            sqlQuery.Append("   mo.height, ");
            sqlQuery.Append("   mo.weight, ");
            sqlQuery.Append("   mo.production_date_time, ");
            sqlQuery.Append("   mo.life_shot_count,");
            sqlQuery.Append("   mo.comment,");
            sqlQuery.Append("   md.life_alarm_shot_count,");
            sqlQuery.Append("   md.periodic_mnt_alarm_shot_count1,");
            sqlQuery.Append("   md.periodic_mnt_alarm_shot_count2,");
            sqlQuery.Append("   md.periodic_mnt_alarm_shot_count3,");
            sqlQuery.Append("   mc.mold_category_id,");
            sqlQuery.Append("   mc.mold_category_cd,");
            sqlQuery.Append("   mc.mold_category_name, ");
            sqlQuery.Append("   mm.model_id, ");
            sqlQuery.Append("   mm.model_cd, ");
            sqlQuery.Append("   mm.model_name, ");
            sqlQuery.Append("   gi.global_item_cd, ");
            sqlQuery.Append("   mli.item_id, ");
            sqlQuery.Append("   mli.item_cd, ");
            sqlQuery.Append("   mi.drawing_no ");
            sqlQuery.Append(" from m_mold_detail md ");
            sqlQuery.Append(" inner join m_mold mo on md.mold_id = mo.mold_id");
            sqlQuery.Append(" left join m_mold_category mc on mc.mold_category_id=md.mold_category_id ");
            sqlQuery.Append(" left join m_mold_item mi on mi.mold_id = mo.mold_id ");
            sqlQuery.Append(" left join m_global_local_item gli on gli.global_item_id = mi.global_item_id");
            sqlQuery.Append(" left join m_local_item mli on mli.item_id = gli.local_item_id");
            sqlQuery.Append(" left join m_global_item gi on gi.global_item_id = gli.global_item_id ");
            sqlQuery.Append(" left join m_model mm on mm.model_id=mi.model_id ");


            sqlQuery.Append(" where mo.factory_cd = :factorycd ");

            if (inVo.MoldCode != null)
            {
                sqlQuery.Append(" and mo.mold_cd like :moldcd ");
            }
            sqlQuery.Append(" order by mo.mold_cd");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("factorycd", trxContext.UserData.FactoryCode);


            if (inVo.MoldCode != null)
            {
                sqlParameter.AddParameterString("moldcd", "%" + inVo.MoldCode + "%");
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ValueObjectList <MoldDetailVo> outVo = null;

            while (dataReader.Read())
            {
                //if (outVo == null || !outVo.GetList().Exists(t => t.MoldId == ConvertDBNull<Int32>(dataReader, "mold_id")))
                //{
                MoldDetailVo currOutVo = new MoldDetailVo();
                currOutVo.MoldId                  = ConvertDBNull <int>(dataReader, "mold_id");
                currOutVo.MoldCode                = ConvertDBNull <string>(dataReader, "mold_cd");
                currOutVo.MoldName                = ConvertDBNull <string>(dataReader, "mold_name");
                currOutVo.MoldCodeName            = ConvertDBNull <string>(dataReader, "moldcodename");
                currOutVo.Width                   = ConvertDBNull <decimal?>(dataReader, "width");
                currOutVo.Depth                   = ConvertDBNull <decimal?>(dataReader, "depth");
                currOutVo.Height                  = ConvertDBNull <decimal?>(dataReader, "height");
                currOutVo.Weight                  = ConvertDBNull <decimal?>(dataReader, "weight");
                currOutVo.LifeShotCount           = ConvertDBNull <int>(dataReader, "life_shot_count");
                currOutVo.MoldCategoryId          = ConvertDBNull <int>(dataReader, "mold_category_id");
                currOutVo.MoldCategoryName        = ConvertDBNull <string>(dataReader, "mold_category_name");
                currOutVo.MoldCategoryCode        = ConvertDBNull <string>(dataReader, "mold_category_cd");
                currOutVo.LifeAlarmShotCount      = ConvertDBNull <int>(dataReader, "life_alarm_shot_count");
                currOutVo.PeriodicAlarmShotCount1 = ConvertDBNull <int?>(dataReader, "periodic_mnt_alarm_shot_count1");
                currOutVo.PeriodicAlarmShotCount2 = ConvertDBNull <int?>(dataReader, "periodic_mnt_alarm_shot_count2");
                currOutVo.PeriodicAlarmShotCount3 = ConvertDBNull <int?>(dataReader, "periodic_mnt_alarm_shot_count3");
                currOutVo.ProductionDate          = ConvertDBNull <DateTime>(dataReader, "production_date_time");
                currOutVo.Comment                 = ConvertDBNull <string>(dataReader, "comment");

                currOutVo.ModelId       = ConvertDBNull <int>(dataReader, "model_id");
                currOutVo.ModelName     = ConvertDBNull <string>(dataReader, "model_cd");
                currOutVo.ModelCode     = ConvertDBNull <string>(dataReader, "model_name");
                currOutVo.MoldItemId    = ConvertDBNull <int>(dataReader, "item_id");
                currOutVo.MoldItemCode  = ConvertDBNull <string>(dataReader, "item_cd");
                currOutVo.SapItemCode   = ConvertDBNull <string>(dataReader, "global_item_cd");
                currOutVo.MoldDrawingNo = ConvertDBNull <string>(dataReader, "drawing_no");


                if (outVo == null)
                {
                    outVo = new ValueObjectList <MoldDetailVo>();
                }
                outVo.add(currOutVo);
                // }
            }
            dataReader.Close();

            return(outVo);
        }
示例#17
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();
                //}
            }
        }