Пример #1
0
        public List<CodeMaster_cmt_Info> FindRecord(CodeMaster_cmt_Info info)
        {
            //throw new NotImplementedException();
            List<CodeMaster_cmt_Info> list = new List<CodeMaster_cmt_Info>();
            //CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            //info = searchCondition as CodeMaster_cmt_Info;

            string sqlString = string.Empty;
            string whereString = string.Empty;
            sqlString = "SELECT TOP " + Common.DefineConstantValue.ListRecordMaxCount.ToString() + Environment.NewLine;
            sqlString += "*" + Environment.NewLine;
            sqlString += "FROM CodeMaster_cmt" + Environment.NewLine;
            whereString = "WHERE 1=1" + Environment.NewLine;

            if (info.cmt_cKey1 != "")
            {
                whereString += "AND cmt_cKey1='" + info.cmt_cKey1 + "' " + Environment.NewLine;
            }
            if (info.cmt_cKey2 != "")
            {
                whereString += "AND cmt_cKey2='" + info.cmt_cKey2 + "' " + Environment.NewLine;
            }
            if (info.cmt_cValue != "")
            {
                if (info.cmt_cValue.ToString().Contains("*") || info.cmt_cValue.ToString().Contains("?"))
                {
                    whereString += "AND cmt_cValue LIKE N'" + info.cmt_cValue.ToString().Replace("*", "%").Replace("?", "_") + "' " + Environment.NewLine;
                }
                else
                {
                    whereString += "AND cmt_cValue LIKE N'%" + info.cmt_cValue + "%' " + Environment.NewLine;
                }
            }
            if (info.cmt_fNumber != 0)
            {
                whereString += "AND cmt_fNumber=Convert(decimal," + info.cmt_fNumber.ToString() + ")" + Environment.NewLine;
            }
            IEnumerable<CodeMaster_cmt_Info> infos = null;
            try
            {
                using (MainDBDataContext db = new MainDBDataContext())
                {
                    infos = db.ExecuteQuery<CodeMaster_cmt_Info>(sqlString + whereString, new object[] { });

                    if (infos != null)
                    {
                        list = infos.ToList<CodeMaster_cmt_Info>();
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return list;
        }
Пример #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.ppgDataDictionary.Font = ControlSetting.ListFont;
            if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Insert)
            {
                this.TabText = "新增 - " + this.Text;
                this._tmpobjInfo = new CodeMaster_cmt_Info();
                this.sysToolBar.BtnSave_IsUsed = true;
                this.sysToolBar.BtnSave_IsEnabled = true;

            }
            else if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Update)
            {
                this.TabText = "编辑 - " + this.Text;
                if (base.BaseParam != null)
                {
                    CodeMaster_cmt_Info objInfo = this.BaseParam as CodeMaster_cmt_Info;
                    this._tmpobjInfo = objInfo;
                }
                else
                {
                    this.ShowWarningMessage("没有可用的记录。");
                }
                this.sysToolBar.BtnSave_IsUsed = true;
                this.sysToolBar.BtnSave_IsEnabled = true;
            }
            else if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_ReaOnly)
            {
                this.TabText = "查看 - " + this.Text;
                if (base.BaseParam != null)
                {
                    CodeMaster_cmt_Info objInfo = this.BaseParam as CodeMaster_cmt_Info;
                    this._tmpobjInfo = objInfo;
                }
                else
                {
                    this.ShowWarningMessage("没有可用的记录。");
                }
                this.sysToolBar.BtnSave_IsUsed = false;
            }

            this.sysToolBar.BtnExit_IsEnabled = true;
            this.sysToolBar.BtnExit_IsUsed = true;
            BindPropertyGrid();
        }
Пример #3
0
 public CodeMaster_cmt_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
 {
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             CodeMaster_cmt disTab = db.CodeMaster_cmt.SingleOrDefault(t => t.cmt_iRecordID == ((KeyObject) as CodeMaster_cmt_Info).cmt_iRecordID);
             if (disTab != null)
             {
                 info = Common.General.CopyObjectValue<CodeMaster_cmt, CodeMaster_cmt_Info>(disTab);
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return info;
 }
Пример #4
0
 public List<CodeMaster_cmt_Info> FindRecord(CodeMaster_cmt_Info info)
 {
     //throw new NotImplementedException();
     //List<Model.IModel.IModelObject> list = new List<Model.IModel.IModelObject>();
     List<CodeMaster_cmt_Info> returnList = new List<CodeMaster_cmt_Info>();
     try
     {
         returnList = _codeMasterDA.SearchRecords(info);
         //if (returnList != null)
         //{
         //    foreach (CodeMaster_cmt_Info t in returnList)
         //    {
         //        list.Add(t);
         //    }
         //}
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return returnList;
 }
Пример #5
0
 public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
 {
     bool isSuccess = false;
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     info = KeyObject as CodeMaster_cmt_Info;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             CodeMaster_cmt delTab = db.CodeMaster_cmt.SingleOrDefault(t => t.cmt_iRecordID == info.cmt_iRecordID);
             if (delTab != null)
             {
                 db.CodeMaster_cmt.DeleteOnSubmit(delTab);
                 db.SubmitChanges();
                 isSuccess = true;
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return isSuccess;
 }
Пример #6
0
        private void CodeMasterForm_Load(object sender, EventArgs e)
        {
            SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);
            try
            {
                _info = _codeMasterBL.GetRecord_Last();
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
            setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Last);
            showData(_info);

            if (_info == null || _info.cmt_iRecordID == 0)
            {
                setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Null);
            }
        }
Пример #7
0
        void Search()
        {
            this.Cursor = Cursors.WaitCursor;

            this.lvDataDicDetail.BeginUpdate();
            CodeMaster_cmt_Info objInfo = new CodeMaster_cmt_Info();
            if (!string.IsNullOrEmpty(txtKey1.Text))
            {
                objInfo.cmt_cKey1 = "*" + txtKey1.Text + "*";
            }
            if (!string.IsNullOrEmpty(txtKey2.Text))
            {
                objInfo.cmt_cKey2 = "*" + txtKey2.Text + "*";
            }
            var objCodeMaster = _codeMasterBL.FindRecord(objInfo);
            tmpList = objCodeMaster as List<CodeMaster_cmt_Info>;

            lvDataDicDetail.SetDataSource<CodeMaster_cmt_Info>(tmpList);

            this.lvDataDicDetail.EndUpdate();

            this.Cursor = Cursors.Default;
        }
Пример #8
0
        /// <summary>
        /// 綁定下拉框控件
        /// </summary>
        void BindComboBox()
        {
            CodeMaster_cmt_Info cmtInfo = new CodeMaster_cmt_Info();
            cmtInfo.cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE;
            cmtInfo.cmt_cKey2 = Common.DefineConstantValue.CodeMasterDefine.KEY2_MACHINEMODEL;
            var listRvKeys = this._codeMasterBL.SearchRecords(cmtInfo);
            this._lisPrinterType.Clear();
            cbxPrinterType.Items.Clear();

            _lisPrinterType.Add(new CodeMaster_cmt_Info() { cmt_cValue = "", cmt_cRemark = "" });

            for (int i = 0; i < listRvKeys.Count; i++)
            {
                CodeMaster_cmt_Info cmtItem = listRvKeys[i] as CodeMaster_cmt_Info;
                this._lisPrinterType.Add(cmtItem);
            }

            //cbxPrinterType.ValueMember = "cmt_cValue";
            //cbxPrinterType.DisplayMember = "cmt_cRemark";
            //cbxPrinterType.DataSource = _lisPrinterType;

            #region Edit by SIMON
            List<IModelObject> returnList = this._generalBL.GetMasterDataInformations(DefineConstantValue.MasterType.MachineType);

            cbxPrinterType.SetDataSource(returnList);
            #endregion
        }
Пример #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="project">生產工程</param>
        /// <param name="shiftProject">班次內工程</param>
        /// <param name="reason">原因</param>
        /// <param name="CorrectQTY">糾正數量</param>
        /// <returns></returns>
        public ReturnValueInfo CorrectProjectQTY(PrintProject_ppj_Info project, ShiftProjList_spl_Info shiftProject, CodeMaster_cmt_Info reason, int CorrectQTY)
        {
            ReturnValueInfo result = new ReturnValueInfo();
            try
            {
                using (DBContext uow = DBContext.Begin())
                {
                    try
                    {
                        //保存糾正數量記錄
                        CorrectRecord_ctr_Info ctr = new CorrectRecord_ctr_Info();
                        ctr.ctr_RecordID = Guid.NewGuid();
                        ctr.ctr_cType = CustEnum.KEY2.CORRECTQTY.ToString();
                        ctr.ctr_cReasonID = reason.cmt_cValue;
                        ctr.ctr_cReason = reason.cmt_cRemark;
                        ctr.ctr_dLastDate = ctr.ctr_dAddDate = DateTime.Now;
                        ctr.ctr_iAdjustProdQTY = shiftProject.spl_iQTY + CorrectQTY;
                        ctr.ctr_iProdQTY = shiftProject.spl_iQTY;
                        ctr.ctr_lSync = false;
                        ctr.ctr_PPJID = shiftProject.spl_PPJID;
                        ctr.ctr_SPLID = shiftProject.spl_RecordID;
                        uow.CurrentSession.Save(ctr);

                        //更新班次內工程生產數量
                        shiftProject.spl_iQTY += CorrectQTY;
                        shiftProject.spl_dLastDate = DateTime.Now;
                        uow.CurrentSession.Update(shiftProject);

                        //更新工程生產數量
                        project.ppj_iActualProdNum += CorrectQTY;
                        uow.CurrentSession.Update(project);
                    }
                    catch (Exception)
                    {
                        uow.CanCommit = false;
                        throw;
                    }

                }

                result.boolValue = true;
            }
            catch (Exception ex)
            {
                result.boolValue = false;
                result.messageText = Resource.B0025 + ":" + ex.Message;
            }
            return result;
        }
Пример #10
0
        public bool UpdateRecord(CodeMaster_cmt_Info infoObject)
        {
            bool isSuccess = false;
            try
            {
                using (MainDBDataContext db = new MainDBDataContext())
                {

                    CodeMaster_cmt query = db.CodeMaster_cmt.SingleOrDefault(t => t.cmt_iRecordID == infoObject.cmt_iRecordID);
                    if (query != null)
                    {
                        query.cmt_cKey1 = infoObject.cmt_cKey1;
                        query.cmt_cKey2 = infoObject.cmt_cKey2;
                        query.cmt_cValue = infoObject.cmt_cValue;
                        query.cmt_fNumber = infoObject.cmt_fNumber;
                        query.cmt_cRemark = infoObject.cmt_cRemark;
                        query.cmt_cRemark2 = infoObject.cmt_cRemark2;
                        query.cmt_lIsActive = infoObject.cmt_lIsActive;
                        query.cmt_cLast = infoObject.cmt_cLast;
                        query.cmt_dLastDate = infoObject.cmt_dLastDate;
                        db.SubmitChanges();
                        isSuccess = true;
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return isSuccess;
        }
Пример #11
0
 public void ShowForm(CodeMaster_cmt_Info info)
 {
     _info = info;
     this.ShowDialog();
 }
Пример #12
0
        private void SaveSub(CodeMaster_cmt_Info info)
        {
            try
            {
                Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
                returnValue = _codeMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Insert);
                if (returnValue.boolValue)
                {
                    BindCombox(DefineConstantValue.MasterType.CodeMaster_Key1, null);
                    _info = _codeMasterBL.GetRecord_Last();
                    SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                    this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;

                    showData(_info);
                }
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
Пример #13
0
        private void showData(CodeMaster_cmt_Info info)
        {
            if (info != null)
            {
                cbocKey1.Text = info.cmt_cKey1;
                cbocKey2.Text = info.cmt_cKey2;
                txtcValue.Text = info.cmt_cValue;
                txtfNum.Text = info.cmt_fNumber.ToString();
                txtcRemark.Text = info.cmt_cRemark;
                txtcRemark2.Text = info.cmt_cRemark2;
                txtcLast.Text = info.cmt_cLast;

                txtcAdd.Text = info.cmt_cAdd;
                try
                {
                    txtdAddDate.Text = ((info.cmt_dAddDate != null) ? Convert.ToDateTime(info.cmt_dAddDate).ToString(DefineConstantValue.gc_DateFormat) : "");

                    txtdLastDate.Text = ((info.cmt_dLastDate != null) ? Convert.ToDateTime(info.cmt_dLastDate).ToString(DefineConstantValue.gc_DateFormat) : "");
                }
                catch (Exception Ex)
                {

                    ShowErrorMessage(Ex);
                }
            }
            else
            {
                cbocKey1.Text = "";
                cbocKey2.Text = "";
                txtcValue.Text = "";
                txtfNum.Text = "";
                txtcRemark.Text = "";
                txtcRemark2.Text = "";

                txtcAdd.Text = "";
                txtdAddDate.Text = "";
                txtcLast.Text = "";
                txtdLastDate.Text = "";
            }
        }
Пример #14
0
        private void HandelResult_FirstOrLast(DefineConstantValue.GetReocrdEnum statc)
        {
            try
            {
                switch (statc)
                {
                    case DefineConstantValue.GetReocrdEnum.GR_First: _info = _codeMasterBL.GetRecord_First();
                        break;
                    case DefineConstantValue.GetReocrdEnum.GR_Last: _info = _codeMasterBL.GetRecord_Last();
                        break;
                    default: break;
                }

                //設置ToolBar狀態

                setToolBarViewStatc(statc);

                //數據顯示
                showData(_info);
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
Пример #15
0
        private void HandelResult_PreviousOrNext(DefineConstantValue.GetReocrdEnum statc)
        {
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            try
            {
                Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo();
                switch (statc)
                {
                    case DefineConstantValue.GetReocrdEnum.GR_Next: com.CommandType = Model.Base.DataBaseCommandType.Next;
                        break;
                    case DefineConstantValue.GetReocrdEnum.GR_Previous: com.CommandType = Model.Base.DataBaseCommandType.Previous;
                        break;
                    default:
                        break;
                }

                Model.Base.DataBaseCommandKeyInfo comKey = new Model.Base.DataBaseCommandKeyInfo();
                info = _info;
                comKey.KeyValue = _info.cmt_iRecordID.ToString();
                com.KeyInfoList.Add(comKey);

                switch (statc)
                {
                    case DefineConstantValue.GetReocrdEnum.GR_Next:
                        _info = _codeMasterBL.GetRecord_Next(com);
                        if (_info != null)
                        {
                            setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Middle);
                        }
                        else
                        {
                            setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Last);
                            _info = info;
                        }
                        break;
                    case DefineConstantValue.GetReocrdEnum.GR_Previous:
                        _info = _codeMasterBL.GetRecord_Previous(com);
                        if (_info != null)
                        {
                            setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Middle);
                        }
                        else
                        {
                            setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_First);
                            _info = info;
                        }
                        break;
                    default:
                        break;
                }

                //顯視數據處理
                showData(_info);

            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
Пример #16
0
        /// <summary>
        /// 获取时间设置信息
        /// </summary>
        /// <param name="courseType">时间设置类型,若空则为查询全部</param>
        /// <returns></returns>
        public SendMessageInfo GetSendMessageProperty()
        {
            SendMessageInfo info = new SendMessageInfo();
            CodeMaster_cmt_Info codeMasterInfo = new CodeMaster_cmt_Info();
            using (MainDBDataContext db = new MainDBDataContext())
            {
                try
                {
                    IQueryable<CodeMaster_cmt> tab = from t in db.CodeMaster_cmt
                                                     where t.cmt_cKey1 == "SENDEMAILSETTING" || t.cmt_cKey1 == "SENDSMSSETTING"
                                                     select t;

                    if (tab.Count() > 0)
                    {
                        foreach (CodeMaster_cmt t in tab)
                        {
                            if (t.cmt_cKey1 == "SENDEMAILSETTING")
                            {
                                switch (t.cmt_cKey2)
                                {
                                    case "SERVICENAME":
                                        info.smi_emailService = t.cmt_cValue;
                                        break;
                                    case "USERID":
                                        info.smi_emailUserID = t.cmt_cValue;
                                        break;
                                    case "PASSWORD":
                                        info.smi_emailUserPassWord = t.cmt_cValue;
                                        break;
                                    default:
                                        break;
                                }
                            }
                            if (t.cmt_cKey1 == "SENDSMSSETTING")
                            {
                                switch (t.cmt_cKey2)
                                {
                                    case "USERID":
                                        info.smi_userID = t.cmt_cValue;
                                        break;
                                    case "PASSWORD":
                                        info.smi_passWord = t.cmt_cValue;
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }

            return info;
        }
Пример #17
0
        /// <summary>
        /// 獲取指定鍵值組合的字碼主檔記錄
        /// </summary>
        /// <param name="strSql">SAL查詢語句</param>
        /// <param name="strConn">數據庫連接字符串</param>
        /// <returns></returns>
        private List<CodeMaster_cmt_Info> GetSpecialCodeMasterBySQL(string strSql, string strConn)
        {
            List<CodeMaster_cmt_Info> listCodeMasters = new List<CodeMaster_cmt_Info>();

            string strDBType = GetDBType(strConn);

            try
            {
                using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strConn, strSql))
                {
                    while (reader.Read())
                    {
                        CodeMaster_cmt_Info masterInfo = new CodeMaster_cmt_Info();
                        masterInfo.DBType = strDBType;

                        if (reader["cmt_iRecordID"] != null && reader["cmt_iRecordID"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_iRecordID = int.Parse(reader["cmt_iRecordID"].ToString());
                        }
                        if (reader["cmt_cKey1"] != null && reader["cmt_cKey1"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cKey1 = reader["cmt_cKey1"].ToString();
                        }
                        if (reader["cmt_cKey2"] != null && reader["cmt_cKey2"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cKey2 = reader["cmt_cKey2"].ToString();
                        }
                        if (reader["cmt_cValue"] != null && reader["cmt_cValue"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cValue = reader["cmt_cValue"].ToString();
                        }
                        if (reader["cmt_fNumber"] != null && reader["cmt_fNumber"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_fNumber = decimal.Parse(reader["cmt_fNumber"].ToString());
                        }
                        if (reader["cmt_cRemark"] != null && reader["cmt_cRemark"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cRemark = reader["cmt_cRemark"].ToString();
                        }
                        if (reader["cmt_cRemark2"] != null && reader["cmt_cRemark2"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cRemark2 = reader["cmt_cRemark2"].ToString();
                        }
                        if (reader["cmt_cAdd"] != null && reader["cmt_cAdd"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cAdd = reader["cmt_cAdd"].ToString();
                        }
                        if (reader["cmt_dAddDate"] != null && reader["cmt_dAddDate"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_dAddDate = DateTime.Parse(reader["cmt_dAddDate"].ToString());
                        }
                        if (reader["cmt_cLast"] != null && reader["cmt_cLast"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_cLast = reader["cmt_cLast"].ToString();
                        }
                        if (reader["cmt_dLastDate"] != null && reader["cmt_dLastDate"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_dLastDate = DateTime.Parse(reader["cmt_dLastDate"].ToString());
                        }
                        if (reader["cmt_lIsActive"] != null && reader["cmt_lIsActive"].ToString() != string.Empty)
                        {
                            masterInfo.cmt_lIsActive = bool.Parse(reader["cmt_lIsActive"].ToString());
                        }

                        listCodeMasters.Add(masterInfo);
                    }
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

            return listCodeMasters;
        }
Пример #18
0
 /// <summary>
 /// 是否重複的字碼主檔數據
 /// </summary>
 /// <param name="listAll">字碼主檔數據列表</param>
 /// <param name="recCheck">檢查數據</param>
 /// <returns></returns>
 private bool IsRepetitiveCodeMasterRecord(List<CodeMaster_cmt_Info> listAll, CodeMaster_cmt_Info recCheck)
 {
     if (listAll != null && recCheck != null)
     {
         bool res = listAll.Exists(x => x.cmt_cRemark == recCheck.cmt_cRemark);
         return res;
     }
     return true;
 }
Пример #19
0
 public bool InsertRecord(CodeMaster_cmt_Info infoObject)
 {
     bool isSuccess = false;
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     info = infoObject;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             CodeMaster_cmt newTab = Common.General.CopyObjectValue<CodeMaster_cmt_Info, CodeMaster_cmt>(info);
             db.CodeMaster_cmt.InsertOnSubmit(newTab);
             db.SubmitChanges();
             isSuccess = true;
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return isSuccess;
 }
Пример #20
0
 private void ToolBar_BtnDeleteClick(object sender, EventArgs e)
 {
     Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo();
     info.cmt_iRecordID = _info.cmt_iRecordID;
     returnValue = _codeMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Delete);
     if (returnValue.boolValue)
     {
         com.CommandType = Model.Base.DataBaseCommandType.Next;
         Model.Base.DataBaseCommandKeyInfo comKey = new Model.Base.DataBaseCommandKeyInfo();
         comKey.KeyValue = info.cmt_iRecordID.ToString();
         com.KeyInfoList.Add(comKey);
         try
         {
             _info = _codeMasterBL.GetRecord_Next(com);
         }
         catch (Exception Ex)
         {
             ShowErrorMessage(Ex);
         }
         if (_info == null)
         {
             com.CommandType = Model.Base.DataBaseCommandType.Previous;
             try
             {
                 _info = _codeMasterBL.GetRecord_Previous(com);
             }
             catch (Exception Ex)
             {
                 ShowErrorMessage(Ex);
             }
             showData(_info);
             this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
             SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);
             setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Last);
             if (_info == null)
             {
                 cbocKey1.Text = "";
                 setToolBarViewStatc(DefineConstantValue.GetReocrdEnum.GR_Null);
             }
         }
     }
 }
Пример #21
0
 public bool IsExistRecord(object KeyObject)
 {
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     info = KeyObject as CodeMaster_cmt_Info;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             CodeMaster_cmt query = db.CodeMaster_cmt.SingleOrDefault(t => t.cmt_cKey1 == info.cmt_cKey1 && t.cmt_cKey2 == info.cmt_cKey2 && t.cmt_cValue == info.cmt_cValue);
             if (query != null)
             {
                 return true;
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return false;
 }
Пример #22
0
        private void BindcboMOState()
        {
            IList<CodeMaster_cmt_Info> MoTypes = MasterBLLFactory.GetBLL<ICodeMasterBL>(MasterBLLFactory.CodeMaster_cmt).GetCodeMasters(CustEnum.System.HBManager, CustEnum.KEY1.STATUS, CustEnum.KEY2.PROJECT);

            CodeMaster_cmt_Info tttt = new CodeMaster_cmt_Info();

            cboMOState.DisplayMember = "cmt_cRemark";
            cboMOState.ValueMember = "cmt_cValue";
            cboMOState.DataSource = MoTypes;

            cboMOState.SelectedIndex = -1;
        }
Пример #23
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            List<Model.IModel.IModelObject> list = new List<IModelObject>();
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            info.cmt_cKey1 = cbocKey1.Text;
            info.cmt_cKey2 = cbocKey2.Text;
            info.cmt_cValue = txtcValue.Text;
            if (txtfNum.Text != "")
            {
                info.cmt_fNumber = Convert.ToDecimal(txtfNum.Text);
            }
            try
            {
                list = _codeMasterBL.SearchRecords(info);
            }
            catch (Exception Ex)
            {

                ShowErrorMessage(Ex);
            }
            if (list != null)
            {
                lvwMstr.SetDataSource<Model.IModel.IModelObject>(list);
                lbliCount.Text = lvwMstr.Items.Count.ToString();
            }
        }
Пример #24
0
        private void HanDel()
        {
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            info.cmt_iRecordID = Convert.ToInt32(lvwMstr.SelectedItems[0].SubItems[0].Text);
            try
            {
                info = _codeMasterBL.DisplayRecord(info) as CodeMaster_cmt_Info;
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
            _info.cmt_iRecordID = info.cmt_iRecordID;
            _info.cmt_cKey1 = info.cmt_cKey1;
            _info.cmt_cKey2 = info.cmt_cKey2;
            _info.cmt_cValue = info.cmt_cValue;
            _info.cmt_fNumber = info.cmt_fNumber;
            _info.cmt_cRemark = info.cmt_cRemark;
            _info.cmt_cRemark2 = info.cmt_cRemark2;
            _info.cmt_cAdd = info.cmt_cAdd;
            _info.cmt_dAddDate = info.cmt_dAddDate;
            _info.cmt_cLast = info.cmt_cLast;
            _info.cmt_dLastDate = info.cmt_dLastDate;

            this.DialogResult = DialogResult.OK;
        }
Пример #25
0
 public bool InsertRecord(CodeMaster_cmt_Info infoObject)
 {
     throw new NotImplementedException();
 }
Пример #26
0
 private void UpdateSub(CodeMaster_cmt_Info info)
 {
     try
     {
         Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
         returnValue = _codeMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Update);
         if (returnValue.boolValue)
         {
             SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);
             this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
         }
     }
     catch (Exception Ex)
     {
         ShowErrorMessage(Ex);
     }
 }
Пример #27
0
        private void ToolBar_BtnNewClick(object sender, EventArgs e)
        {
            SetControlStatus(DefineConstantValue.EditStateEnum.OE_Insert);
            this.EditState = DefineConstantValue.EditStateEnum.OE_Insert;
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();

            //重置表格
            showData(info);
            cbocKey1.Text = "";
        }
Пример #28
0
        public ReturnValueInfo ClearProjectQTY(PrintProject_ppj_Info data, CodeMaster_cmt_Info reason)
        {
            ReturnValueInfo result = new ReturnValueInfo();
            try
            {
                using (DBContext uow = DBContext.Begin())
                {

                    try
                    {
                        //清空工程生產數量相關數據
                        data.ppj_fProdSpeed = 0;
                        data.ppj_iActualProdNum = 0;
                        data.ppj_iSpeed = 0;
                        data.ppj_iCountWastNum = 0;
                        data.ppj_iCountProdNum = 0;
                        uow.CurrentSession.Update(data);

                        IList<ShiftProjList_spl_Info> shiftProjects = null;
                        var query = uow.CurrentSession.QueryOver<ShiftProjList_spl_Info>();
                        query.And(d => d.spl_PPJID == data.ppj_RecordID);
                        shiftProjects = query.List<ShiftProjList_spl_Info>();

                        //清空班次內工程生產數量相關數據
                        foreach (var sp in shiftProjects)
                        {
                            //保存消數記錄
                            CorrectRecord_ctr_Info ctr = new CorrectRecord_ctr_Info();
                            ctr.ctr_RecordID = Guid.NewGuid();
                            ctr.ctr_cType = CustEnum.KEY2.CLEARQTY.ToString();
                            ctr.ctr_cReasonID = reason.cmt_cValue;
                            ctr.ctr_cReason = reason.cmt_cRemark;
                            ctr.ctr_dAddDate = DateTime.Now;
                            ctr.ctr_iAdjustProdQTY = 0;
                            ctr.ctr_iProdQTY = sp.spl_iQTY;
                            ctr.ctr_lSync = false;
                            ctr.ctr_PPJID = data.ppj_RecordID;
                            ctr.ctr_SPLID = sp.spl_RecordID;
                            uow.CurrentSession.Save(ctr);

                            sp.spl_iBeginQTY = 0;
                            sp.spl_iEndQTY = 0;
                            sp.spl_iCalQTY = 0;
                            sp.spl_iQTY = 0;
                            sp.spl_iWastQTY = 0;

                            uow.CurrentSession.Update(sp);
                        }

                        data.ShiftProjects = shiftProjects;
                    }
                    catch (Exception)
                    {
                        uow.CanCommit = false;
                        throw;
                    }
                }

                result.boolValue = true;
            }
            catch (Exception ex)
            {
                result.boolValue = false;
                result.messageText = Resource.B0024 + ":" + ex.Message;
            }
            return result;
        }
Пример #29
0
        /// <summary>
        /// 轉換成主檔對象
        /// </summary>
        /// <param name="p_strMachineNum"></param>
        /// <param name="p_objEquipment"></param>
        /// <returns></returns>
        private CodeMaster_cmt_Info ConvertToCodeMasterItem(string p_strMachineNum, Equipment p_objEquipment)
        {
            CodeMaster_cmt_Info l_objItem = new CodeMaster_cmt_Info()
            {
                cmt_cAdd = "SYSTEM",
                cmt_cKey1 = "MaximoMachine",
                cmt_cKey2 = p_strMachineNum,
                cmt_cLast = "SYSTEM",
                cmt_cRemark = p_objEquipment.EquipDesc,
                cmt_cRemark2 = p_objEquipment.ParentEquipNum,
                cmt_cValue = p_objEquipment.EquipNum,
                cmt_dAddDate = DateTime.Now,
                cmt_dLastDate = DateTime.Now,
                cmt_iRecordID = 0,
                RecordID = 0,
                cmt_fNumber = 0,
                cmt_lIsActive = true,
            };

            return l_objItem;
        }
Пример #30
0
        private void ToolBar_BtnSaveClick(object sender, EventArgs e)
        {
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            info.cmt_cKey1 = cbocKey1.Text;
            info.cmt_cKey2 = cbocKey2.Text;
            info.cmt_cValue = txtcValue.Text;
            info.cmt_fNumber = Convert.ToDecimal(txtfNum.Text);
            info.cmt_cRemark = txtcRemark.Text;
            info.cmt_cRemark2 = txtcRemark2.Text;

            info.cmt_cAdd = UserInformation.usm_cUserLoginID;
            info.cmt_dAddDate = DateTime.Now;
            info.cmt_cLast = UserInformation.usm_cUserLoginID;
            info.cmt_dLastDate = DateTime.Now;
            switch (this.EditState)
            {
                case DefineConstantValue.EditStateEnum.OE_Insert:
                    SaveSub(info);
                    break;
                case DefineConstantValue.EditStateEnum.OE_Update:
                    info.cmt_iRecordID = _info.cmt_iRecordID;
                    UpdateSub(info);
                    break;
                default:
                    break;
            }
        }