protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (string.IsNullOrEmpty(SubKeyName))
            {
                this.ShowErrorMessage("费用类型不能为空。");
                return;
            }

            CodeMaster_cmt_Info searchCode = new CodeMaster_cmt_Info();
            searchCode.cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_ConstantExpenses.ToString();
            searchCode.cmt_cKey2 = this.SubKeyName;

            CodeMaster_cmt_Info codeInfo = this._ICodeMasterBL.SearchRecords(searchCode).FirstOrDefault() as CodeMaster_cmt_Info;
            if (codeInfo == null)
            {
                this.ShowErrorMessage("未能找到可以设置的费用类型。");
                return;
            }

            this._CurrentCodeIndex = codeInfo.cmt_iRecordID;
            gbxName.Text = codeInfo.cmt_cRemark;
            labOldCost.Text = codeInfo.cmt_fNumber.ToString();
            ntbxNewCost.Enabled = true;
        }
예제 #2
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 dbo.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 (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    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;
        }
예제 #3
0
 public frmRecordCollectSet(CodeMaster_cmt_Info infoObj)
 {
     InitializeComponent();
     _icmBL = BLL.Factory.SysMaster.MasterBLLFactory.GetBLL<ICodeMasterBL>(BLL.Factory.SysMaster.MasterBLLFactory.CodeMaster_cmt);
     _editState = Common.DefineConstantValue.EditStateEnum.OE_Update;
     this._cmtInfo = infoObj;
     BindMealTypeCombo();
     SetControlValue();
     this.lblTitle.Text = "修改消费数据收集时间";
 }
예제 #4
0
 public CodeMaster_cmt_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
 {
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     try
     {
         using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
         {
             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;
 }
예제 #5
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.FindRecord(info);
         //if (returnList != null)
         //{
         //    foreach (CodeMaster_cmt_Info t in returnList)
         //    {
         //        list.Add(t);
         //    }
         //}
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return returnList;
 }
예제 #6
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 (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
         {
             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;
 }
예제 #7
0
 private void UpdateSub(CodeMaster_cmt_Info info)
 {
     try
     {
         Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
         returnValue = _ICodeMasterBL.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);
     }
 }
예제 #8
0
        private void ToolBar_BtnSaveClick(object sender, EventArgs e)
        {
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            info.cmt_cKey1 = cboKey1.Text;
            info.cmt_cKey2 = cboKey2.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 = _CmtInfo.cmt_iRecordID;
                    UpdateSub(info);
                    break;
                default:
                    break;
            }
        }
예제 #9
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);
            cboKey1.Text = string.Empty;
        }
예제 #10
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 = _CmtInfo.cmt_iRecordID;
     returnValue = _ICodeMasterBL.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
         {
             _CmtInfo = _ICodeMasterBL.GetRecord_Next(com);
         }
         catch (Exception Ex)
         {
             ShowErrorMessage(Ex);
         }
         if (_CmtInfo == null)
         {
             com.CommandType = Model.Base.DataBaseCommandType.Previous;
             try
             {
                 _CmtInfo = _ICodeMasterBL.GetRecord_Previous(com);
             }
             catch (Exception Ex)
             {
                 ShowErrorMessage(Ex);
             }
             ShowData(_CmtInfo);
             this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;
             SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);
             SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Last);
             if (_CmtInfo == null)
             {
                 cboKey1.Text = string.Empty;
                 SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Null);
             }
         }
     }
 }
예제 #11
0
        /// <summary>
        /// 數據顯示
        /// </summary>
        /// <param name="cmtInfo">需要顯示的記錄</param>
        private void ShowData(CodeMaster_cmt_Info cmtInfo)
        {
            if (cmtInfo != null)
            {
                cboKey1.Text = cmtInfo.cmt_cKey1;
                cboKey2.Text = cmtInfo.cmt_cKey2;
                txtcValue.Text = cmtInfo.cmt_cValue;
                txtfNum.Text = cmtInfo.cmt_fNumber.ToString();
                txtcRemark.Text = cmtInfo.cmt_cRemark;
                txtcRemark2.Text = cmtInfo.cmt_cRemark2;
                txtcLast.Text = cmtInfo.cmt_cLast;

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

                    txtdLastDate.Text = ((cmtInfo.cmt_dLastDate != null) ? Convert.ToDateTime(cmtInfo.cmt_dLastDate).ToString(DefineConstantValue.gc_DateFormat) : string.Empty);
                }
                catch (Exception Ex)
                { ShowErrorMessage(Ex); }
            }
            else
            {
                cboKey1.Text = string.Empty;
                cboKey2.Text = string.Empty;
                txtcValue.Text = string.Empty;
                txtfNum.Text = string.Empty;
                txtcRemark.Text = string.Empty;
                txtcRemark2.Text = string.Empty;

                txtcAdd.Text = string.Empty;
                txtdAddDate.Text = string.Empty;
                txtcLast.Text = string.Empty;
                txtdLastDate.Text = string.Empty;
            }
        }
예제 #12
0
        private void SaveSub(CodeMaster_cmt_Info info)
        {
            try
            {
                Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
                returnValue = _ICodeMasterBL.Save(info, DefineConstantValue.EditStateEnum.OE_Insert);
                if (returnValue.boolValue)
                {
                    BindCombox(DefineConstantValue.MasterType.CodeMaster_Key1, null);
                    _CmtInfo = _ICodeMasterBL.GetRecord_Last();
                    SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);
                    this.EditState = DefineConstantValue.EditStateEnum.OE_ReaOnly;

                    ShowData(_CmtInfo);
                }
            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
예제 #13
0
 public void ShowForm(CodeMaster_cmt_Info info)
 {
     _info = info;
     this.ShowDialog();
 }
예제 #14
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            List<CodeMaster_cmt_Info> list = new List<CodeMaster_cmt_Info>();
            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<CodeMaster_cmt_Info>(list);
                lbliCount.Text = lvwMstr.Items.Count.ToString();
            }
        }
예제 #15
0
        private void CodeMasterForm_Load(object sender, EventArgs e)
        {
            SetPurview(this.ToolBar);

            SetControlStatus(DefineConstantValue.EditStateEnum.OE_ReaOnly);

            try
            {
                this._CmtInfo = this._ICodeMasterBL.GetRecord_Last();
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }

            SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Last);

            ShowData(_CmtInfo);

            if (_CmtInfo == null || _CmtInfo.cmt_iRecordID == 0)
            {
                SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Null);
            }
        }
예제 #16
0
        public bool UpdateRecord(CodeMaster_cmt_Info infoObject)
        {
            bool isSuccess = false;
            try
            {
                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {

                    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_cLast = infoObject.cmt_cLast;
                        query.cmt_dLastDate = infoObject.cmt_dLastDate;
                        db.SubmitChanges();
                        isSuccess = true;
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return isSuccess;
        }
예제 #17
0
 public bool IsExistRecord(object KeyObject)
 {
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     info = KeyObject as CodeMaster_cmt_Info;
     try
     {
         using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
         {
             CodeMaster_cmt query = db.CodeMaster_cmt.SingleOrDefault(t => t.cmt_cKey1 == info.cmt_cKey1 && t.cmt_cKey2 == info.cmt_cKey2);
             if (query != null)
             {
                 return true;
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return false;
 }
예제 #18
0
 public bool InsertRecord(CodeMaster_cmt_Info infoObject)
 {
     bool isSuccess = false;
     CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
     info = infoObject;
     try
     {
         using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
         {
             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;
 }
예제 #19
0
        /// <summary>
        /// 获取当前的就餐时段信息(不在时段中时则返回null值)
        /// </summary>
        /// <returns></returns>
        public CodeMaster_cmt_Info GetCurrentMealSpanInfo()
        {
            CodeMaster_cmt_Info mealSpan = null;
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.AppendLine("declare @NowDate varchar(20)");
                strSql.AppendLine("set @NowDate=CONVERT(char(4),DATEPART(year,getdate()))");
                strSql.AppendLine("+'-'+CONVERT(char(4),DATEPART(month,getdate()))");
                strSql.AppendLine("+'-'+CONVERT(char(4),DATEPART(day,getdate()))");
                strSql.AppendLine("select A.MealType,MealCost,BeginSpan,EndSpan from(");
                strSql.AppendLine("select MealType=cmt_cValue,BeginSpan=CONVERT(datetime,@NowDate+' '+cmt_cRemark),");
                strSql.AppendLine("EndSpan=DATEADD(hour,1,CONVERT(datetime,@NowDate+' '+cmt_cRemark))");
                strSql.AppendLine("from CodeMaster_cmt with(nolock)where cmt_cKey1='BWLISTUPLOADINTERVAL')A");
                strSql.AppendLine("join(select MealType=substring(cmt_cKey2,4,LEN(cmt_cKey2)-3),MealCost=cmt_fNumber ");
                strSql.AppendLine("from CodeMaster_cmt with(nolock)where cmt_cKey1='CONSTANTEXPENSES')B");
                strSql.AppendLine("on A.Mealtype=B.Mealtype");
                strSql.AppendLine("where BeginSpan<=GETDATE() and EndSpan>=GETDATE()");

                using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strSql.ToString()))
                {
                    if (reader.Read())
                    {
                        mealSpan = new CodeMaster_cmt_Info();

                        if (reader["MealType"] != null && reader["MealType"].ToString() != string.Empty)
                        {
                            mealSpan.cmt_cKey1 = reader["MealType"].ToString();
                        }
                        if (reader["MealCost"] != null && reader["MealCost"].ToString() != string.Empty)
                        {
                            mealSpan.cmt_fNumber = decimal.Parse(reader["MealCost"].ToString());
                        }
                        if (reader["BeginSpan"] != null && reader["BeginSpan"].ToString() != string.Empty)
                        {
                            mealSpan.cmt_cRemark = reader["BeginSpan"].ToString();
                        }
                        if (reader["EndSpan"] != null && reader["EndSpan"].ToString() != string.Empty)
                        {
                            mealSpan.cmt_cRemark2 = reader["EndSpan"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            return mealSpan;
        }
        /// <summary>
        /// 显示收数时段
        /// </summary>
        private void ShowCollectDateList()
        {
            try
            {
                List<CollectInfo> collectList = new List<CollectInfo>();

                CodeMaster_cmt_Info cmt = new CodeMaster_cmt_Info();
                cmt.cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_RecordCollectInterval.ToString();

                List<CodeMaster_cmt_Info> cmtList = _icmBL.FindRecord(cmt);

                cmtList = cmtList.OrderBy(p => p.cmt_cRemark).ToList();

                if (cmtList != null)
                {
                    foreach (CodeMaster_cmt_Info item in cmtList)
                    {
                        if (item != null)
                        {
                            CollectInfo info = new CollectInfo();
                            info.StartTime = DateTime.Parse(item.cmt_cRemark).ToString("HH:mm");
                            info.Name = item.cmt_cRemark2;
                            info.Enable = item.cmt_fNumber == 1 ? "启用" : "停用";
                            info.TimeType = Common.DefineConstantValue.GetMealTypeDesc(item.cmt_cValue);
                            collectList.Add(info);
                        }
                    }

                    _codeMasterList = cmtList;

                    //DataTable dt = new DataTable();
                    //dt.Columns.Add(new DataColumn("StartTime", typeof(DateTime)));//执行时间
                    //dt.Columns.Add(new DataColumn("TimeType", typeof(string)));//时段类型

                    //for (int index = 0; index < cmtList.Count; index++)
                    //{
                    //    CollectInfo cinfo = new CollectInfo();
                    //    cinfo.Name = cmtList[index].cmt_cRemark2;

                    //    try
                    //    {
                    //        DateTime startTime = FormatDate(cmtList[index].cmt_cRemark);

                    //        DataRow dr = dt.NewRow();
                    //        dr["StartTime"] = startTime;
                    //        dr["TimeType"] = cmtList[index].cmt_cValue;
                    //        dt.Rows.Add(dr);//記錄所有時間段

                    //        cinfo.StartTime = startTime.ToString("HH:mm");
                    //        cinfo.EndTime = endTime.ToString("HH:mm");
                    //    }
                    //    catch
                    //    {

                    //    }

                    //    if (cmtList[index].cmt_fNumber > 0)
                    //    {
                    //        cinfo.Enable = "启用";
                    //    }
                    //    else
                    //    {
                    //        cinfo.Enable = "停用";
                    //    }
                    //    collectList.Add(cinfo);
                    //}
                    //SetCurrentTime(dt);
                }

                this.lvwCollectList.SetDataSource(collectList);
            }
            catch
            {

            }
        }
예제 #21
0
        public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            returnValue.messageText = string.Empty;
            info = itemEntity as CodeMaster_cmt_Info;
            try
            {
                switch (EditMode)
                {
                    case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                        bool isExist = false;

                        isExist = _codeMasterDA.IsExistRecord(info);
                        if (!isExist)
                        {
                            returnValue.boolValue = _codeMasterDA.InsertRecord(info);
                        }
                        else
                        {
                            returnValue.boolValue = false;
                            returnValue.messageText = "记录重复。";
                        }
                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Update:
                        returnValue.boolValue = _codeMasterDA.UpdateRecord(info);
                        break;
                    case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                        returnValue.boolValue = _codeMasterDA.DeleteRecord(info);
                        break;
                    default:
                        break;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return returnValue;
        }
예제 #22
0
        private void HandelResult_FirstOrLast(DefineConstantValue.GetReocrdEnum recordState)
        {
            try
            {
                switch (recordState)
                {
                    case DefineConstantValue.GetReocrdEnum.GR_First: _CmtInfo = _ICodeMasterBL.GetRecord_First();
                        break;
                    case DefineConstantValue.GetReocrdEnum.GR_Last: _CmtInfo = _ICodeMasterBL.GetRecord_Last();
                        break;
                    default: break;
                }

                SetToolBarViewState(recordState);

                ShowData(this._CmtInfo);
            }
            catch (Exception Ex)
            { ShowErrorMessage(Ex); }
        }
예제 #23
0
        /// <summary>
        /// 初始换卡费用
        /// </summary>
        private void initCost()
        {
            CodeMaster_cmt_Info searchCode = new CodeMaster_cmt_Info();
            searchCode.cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_ConstantExpenses.ToString();
            searchCode.cmt_cKey2 = Common.DefineConstantValue.CodeMasterDefine.KEY2_ExchangeCardCost;

            CodeMaster_cmt_Info codeInfo = this._ICodeMasterBL.SearchRecords(searchCode).FirstOrDefault() as CodeMaster_cmt_Info;

            if (codeInfo != null)
            {
                _ReplaceCost = codeInfo.cmt_fNumber;
                this.lblCost.Text = codeInfo.cmt_fNumber.ToString();
            }
        }
예제 #24
0
        private void HandelResult_PreviousOrNext(DefineConstantValue.GetReocrdEnum recordState)
        {
            CodeMaster_cmt_Info info = new CodeMaster_cmt_Info();
            try
            {
                Model.Base.DataBaseCommandInfo com = new Model.Base.DataBaseCommandInfo();
                switch (recordState)
                {
                    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 = _CmtInfo;
                comKey.KeyValue = _CmtInfo.cmt_iRecordID.ToString();
                com.KeyInfoList.Add(comKey);

                switch (recordState)
                {
                    case DefineConstantValue.GetReocrdEnum.GR_Next:
                        _CmtInfo = _ICodeMasterBL.GetRecord_Next(com);
                        if (_CmtInfo != null)
                        {
                            SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Middle);
                        }
                        else
                        {
                            SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Last);
                            _CmtInfo = info;
                        }
                        break;
                    case DefineConstantValue.GetReocrdEnum.GR_Previous:
                        _CmtInfo = _ICodeMasterBL.GetRecord_Previous(com);
                        if (_CmtInfo != null)
                        {
                            SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_Middle);
                        }
                        else
                        {
                            SetToolBarViewState(DefineConstantValue.GetReocrdEnum.GR_First);
                            _CmtInfo = info;
                        }
                        break;
                    default:
                        break;
                }

                //顯視數據處理
                ShowData(_CmtInfo);

            }
            catch (Exception Ex)
            {
                ShowErrorMessage(Ex);
            }
        }
예제 #25
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }
            else
            {
                if (cbbMealType.SelectedIndex < 0)
                {
                    this.ShowWarningMessage("请选择时间类型。");
                    cbbMealType.Focus();
                    return;
                }

                if (_cmtInfo == null)
                {
                    _cmtInfo = new CodeMaster_cmt_Info();
                    _cmtInfo.cmt_cAdd = this.UserInformation.usm_cUserLoginID;
                    _cmtInfo.cmt_dAddDate = System.DateTime.Now;
                    _cmtInfo.cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_RecordCollectInterval.ToString();
                    _cmtInfo.cmt_cKey2 = Guid.NewGuid().ToString().Substring(0, 30);
                }

                _cmtInfo.cmt_cLast = this.UserInformation.usm_cUserLoginID;
                _cmtInfo.cmt_dLastDate = System.DateTime.Now;

                if (String.IsNullOrEmpty(this.txtName.Text.Trim()))
                {
                    base.ShowErrorMessage("请输入时段名称。");
                    return;
                }
                _cmtInfo.cmt_cRemark2 = this.txtName.Text.Trim();

                //if (this.dtpStartTime.Value > this.dtpEndTime.Value)
                //{
                //    base.ShowErrorMessage("开始时间要少于结束时间。");
                //    return;
                //}

                _cmtInfo.cmt_cRemark = this.dtpStartTime.Value.ToString("HH:mm");
                _cmtInfo.cmt_cValue = cbbMealType.SelectedValue.ToString();

                if (this.ckbEnable.Checked)
                {
                    _cmtInfo.cmt_fNumber = 1;
                }
                else
                {
                    _cmtInfo.cmt_fNumber = 0;
                }

                ReturnValueInfo returnInfo = _icmBL.Save(_cmtInfo, _editState);

                if (returnInfo.isError)
                {
                    base.ShowErrorMessage("保存失败!");
                }
                else
                {
                    MessageBox.Show("保存成功。", "提示");
                    this.Close();
                }
            }
        }
예제 #26
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;
        }