Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
            {
                this.TabText = "新增" + this.Text;
                if (base.BaseParam != null)
                {
                    AheadOfOffDuty_aod_Info info = base.BaseParam as AheadOfOffDuty_aod_Info;
                    info.aod_RecordID = Guid.NewGuid();
                    info.aod_TargetID = info.aod_TargetID;
                    this._CurrentAfwInfo = info;
                }

            }
            else if (this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
            {
                this.TabText = "查看" + this.Text;
                if (base.BaseParam != null)
                {
                    AheadOfOffDuty_aod_Info info = base.BaseParam as AheadOfOffDuty_aod_Info;

                    this._CurrentAfwInfo = info;

                }
                else
                {
                    this.ShowWarningMessage("没有可用的记录。");
                }
            }
            InitSysBar();
            InitppgAfwInfos();
        }
Пример #2
0
 public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
 {
     bool isSuccess = false;
     AheadOfOffDuty_aod_Info info = new AheadOfOffDuty_aod_Info();
     info = KeyObject as AheadOfOffDuty_aod_Info;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             //AheadOfOffDuty_aod delTab = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_iRecordID == info.aod_iRecordID && t.aod_lIsDeleted == false);
             AheadOfOffDuty_aod delTab = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_RecordID == info.aod_RecordID && t.aod_lIsAtive == true);
             if (delTab != null)
             {
                 //delTab.aod_lIsDeleted = true;
                 db.AheadOfOffDuty_aod.DeleteOnSubmit(delTab);
                 delTab.aod_lIsAtive = false;
                 db.SubmitChanges();
                 isSuccess = true;
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return isSuccess;
 }
Пример #3
0
        /// <summary>
        /// 綁定ListView,當TargetID為-1時搜索全部記錄
        /// </summary>
        /// <param name="TargetID">區域或啤機的ID</param>
        private void BingGv(Guid TargetID)
        {
            AheadOfOffDuty_aod_Info query = new AheadOfOffDuty_aod_Info();
            query.aod_TargetID = TargetID;
            var info = _IAheadOfOffDutyBL.SearchRecords(query);

            this.lvInfo.BeginUpdate();
            lvInfo.Items.Clear();
            foreach (AheadOfOffDuty_aod_Info item in info)
            {
                ListViewItem Item = new ListViewItem();
                Item.SubItems.Clear();
                for (int i = 0; i < lvInfo.Columns.Count; i++)
                {
                    TextBox t = new TextBox();
                    Item.SubItems.Add("");
                }
                Item.SubItems[0].Text = item.aod_RecordID.ToString();
                Item.SubItems[1].Text = item.aod_cName;
                Item.SubItems[2].Text = item.aod_dOffDutyTime.ToString();
                //Item.SubItems[3].Text = item.aod_iShiftTypeID == 1 ? "日班" : "夜班";

                Item.SubItems[3].Text = _ShiftType.SingleOrDefault(t => t.Key == item.aod_iShiftTypeID).Value;

                Item.SubItems[4].Text = item.aod_lIsAtive == true ? "是" : "否";
                this.lvInfo.Items.Add(Item);//显示
            }
            this.lvInfo.EndUpdate();
        }
Пример #4
0
 public AdvanceOffWorkAppSetting()
 {
     InitializeComponent();
     _AheadOfOffDutyBL = MasterBLLFactory.GetBLL<IAheadOfOffDutyBL>(MasterBLLFactory.AheadOfOffDutyMaster);
     _CurrentAfwInfo = null;
     _isChanged = false;
     //todo: 需初始化用戶信息
     if (base.UserInformation == null)
     {
         base.UserInformation = new Model.SysMaster.Sys_UserMaster_usm_Info();
         base.UserInformation.usm_cUserLoginID = "sys";
     }
 }
Пример #5
0
 public bool InsertRecord(AheadOfOffDuty_aod_Info infoObject)
 {
     bool isSuccess = false;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             AheadOfOffDuty_aod newTab = Common.General.CopyObjectValue<AheadOfOffDuty_aod_Info, AheadOfOffDuty_aod>(infoObject);
             db.AheadOfOffDuty_aod.InsertOnSubmit(newTab);
             db.SubmitChanges();
             isSuccess = true;
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return isSuccess;
 }
Пример #6
0
 public AheadOfOffDuty_aod_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
 {
     AheadOfOffDuty_aod_Info info = new AheadOfOffDuty_aod_Info();
     info = KeyObject as AheadOfOffDuty_aod_Info;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             //AheadOfOffDuty_aod disTab = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_iRecordID == info.aod_iRecordID && t.aod_lIsDeleted == false);
             AheadOfOffDuty_aod disTab = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_RecordID == info.aod_RecordID);
             if (disTab != null)
             {
                 info = Common.General.CopyObjectValue<AheadOfOffDuty_aod, AheadOfOffDuty_aod_Info>(disTab);
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return info;
 }
Пример #7
0
 public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
 {
     Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo();
     AheadOfOffDuty_aod_Info info = new AheadOfOffDuty_aod_Info();
     returnValue.messageText = "";
     info = itemEntity as AheadOfOffDuty_aod_Info;
     try
     {
         switch (EditMode)
         {
             case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                 bool isExist = false;
                 isExist = _AheadOfOffDutyDA.IsExistRecord(info);
                 if (!isExist)
                 {
                     returnValue.boolValue = _AheadOfOffDutyDA.InsertRecord(info);
                 }
                 else
                 {
                     returnValue.boolValue = false;
                     returnValue.messageText = "數據重複!";
                 }
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_Update:
                 returnValue.boolValue = _AheadOfOffDutyDA.UpdateRecord(info);
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                 returnValue.boolValue = _AheadOfOffDutyDA.DeleteRecord(info);
                 break;
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return returnValue;
 }
Пример #8
0
 public bool IsExistRecord(object KeyObject)
 {
     bool isExist = false;
     AheadOfOffDuty_aod_Info info = new AheadOfOffDuty_aod_Info();
     info = KeyObject as AheadOfOffDuty_aod_Info;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             //AheadOfOffDuty_aod query = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_iRecordID == info.aod_iRecordID && t.aod_lIsDeleted == false);
             AheadOfOffDuty_aod query = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_RecordID == info.aod_RecordID && t.aod_lIsAtive == true);
             if (query != null)
             {
                 isExist = true;
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return isExist;
 }
Пример #9
0
 public bool UpdateRecord(AheadOfOffDuty_aod_Info infoObject)
 {
     bool isSuccess = false;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             AheadOfOffDuty_aod query = db.AheadOfOffDuty_aod.SingleOrDefault(t => t.aod_RecordID == infoObject.aod_RecordID);
             if (query != null)
             {
                 query.aod_cName = infoObject.aod_cName;
                 query.aod_dOffDutyTime = infoObject.aod_dOffDutyTime;
                 query.aod_iShiftTypeID = infoObject.aod_iShiftTypeID;
                 query.aod_lIsAtive = infoObject.aod_lIsAtive;
                 query.aod_cLast = infoObject.aod_cLast;
                 query.aod_dLastDate = infoObject.aod_dLastDate;
                 //Common.General.SetDataToLingQEntity<AheadOfOffDuty_aod>(query, infoObject);
                 db.SubmitChanges();
                 isSuccess = true;
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return isSuccess;
 }
Пример #10
0
 public List<AheadOfOffDuty_aod_Info> SearchRecords(Model.IModel.IModelObject searchCondition)
 {
     List<AheadOfOffDuty_aod_Info> list = new List<AheadOfOffDuty_aod_Info>();
     AheadOfOffDuty_aod_Info info = new AheadOfOffDuty_aod_Info();
     info = searchCondition as AheadOfOffDuty_aod_Info;
     string strSQL = "";
     strSQL += " SELECT aod_RecordID,aod_cName,aod_dOffDutyTime,aod_iShiftTypeID,aod_lIsAtive " + Environment.NewLine;
     strSQL += " FROM AheadOfOffDuty_aod " + Environment.NewLine;
     //strSQL += " WHERE aod_lIsDeleted =0 " + Environment.NewLine;
     strSQL += " WHERE 1 =1 " + Environment.NewLine;
     if (info.aod_TargetID != Guid.Empty) //小於零時搜索全部
     {
         strSQL += " AND aod_TargetID = '" + info.aod_TargetID + "' " + Environment.NewLine;
     }
     IEnumerable<AheadOfOffDuty_aod_Info> infos = null;
     try
     {
         using (MainDBDataContext db = new MainDBDataContext())
         {
             infos = db.ExecuteQuery<AheadOfOffDuty_aod_Info>(strSQL, new object[] { });
             if (infos != null)
             {
                 list = infos.ToList<AheadOfOffDuty_aod_Info>();
             }
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
     return list;
 }
Пример #11
0
        private void ShowModifyForm(object sender, EventArgs evArgs)
        {
            MenuItem itemMenu = new MenuItem();
            itemMenu.Tag = "WindowUI.HBManagerTerminal.Management.RunningManagement.AdvanceOffWorkAppSetting";
            if (lvInfo.SelectedItems.Count > 0)
            {
                AheadOfOffDuty_aod_Info aodParam = new AheadOfOffDuty_aod_Info();
                aodParam.aod_RecordID = new Guid(lvInfo.SelectedItems[0].SubItems[0].Text.Trim());
                aodParam.aod_cName = lvInfo.SelectedItems[0].SubItems[1].Text.Trim();
                aodParam.aod_dOffDutyTime = lvInfo.SelectedItems[0].SubItems[2].Text.Trim();
                //aodParam.aod_iShiftTypeID = lvInfo.SelectedItems[0].SubItems[3].Text.Trim() == "日班" ? 1 :2;

                aodParam.aod_iShiftTypeID = _ShiftType.SingleOrDefault(t => t.Value == lvInfo.SelectedItems[0].SubItems[3].Text.Trim()).Key;

                this.ShowSubForm(itemMenu, this.BaseDockPanel, "修改提前下班主檔", DockState.Document, aodParam, DefineConstantValue.EditStateEnum.OE_Update);
            }
            else
            {
                this.ShowInformationMessage("先選擇一條記錄!");
            }
        }
Пример #12
0
 private void ShowAddForm(object sender, EventArgs evArgs)
 {
     MenuItem itemMenu = new MenuItem();
     AheadOfOffDuty_aod_Info aodParam = new AheadOfOffDuty_aod_Info();
     itemMenu.Tag = "WindowUI.HBManagerTerminal.Management.RunningManagement.AdvanceOffWorkAppSetting";
     //this.ShowSubForm(itemMenu, this.BaseDockPanel);
     if (_TargetID != Guid.Empty)
     {
         aodParam.aod_TargetID = _TargetID;
     }
     else
     {
         this.ShowInformationMessage("先選擇一個區域!");
         return;
     }
     this.ShowSubForm(itemMenu, this.BaseDockPanel, "新增提前下班主檔", DockState.Document, aodParam, DefineConstantValue.EditStateEnum.OE_Insert);
 }
Пример #13
0
        private void DeleteAfw(object sender, EventArgs evArgs)
        {
            this.Cursor = Cursors.WaitCursor;
            if (this.lvInfo.SelectedItems.Count > 0)
            {
                if (this.ShowQuestionMessage("是否確定刪除提前下班記錄:" + this.lvInfo.SelectedItems[0].SubItems[1].Text + ",提前下班時間:" + this.lvInfo.SelectedItems[0].SubItems[2].Text))
                {
                    AheadOfOffDuty_aod_Info delTab = new AheadOfOffDuty_aod_Info();
                    ReturnValueInfo rvInfo = null;
                    delTab.aod_RecordID = new Guid(this.lvInfo.SelectedItems[0].SubItems[0].Text.Trim());
                    rvInfo = _IAheadOfOffDutyBL.Save(delTab, DefineConstantValue.EditStateEnum.OE_Delete);
                    if (!rvInfo.isError && rvInfo.boolValue)
                    {
                        this.ShowInformationMessage("刪除成功。");
                        RefreshAllState();
                    }
                    else
                    {
                        this.ShowWarningMessage("刪除失敗,失敗信息:" + rvInfo.messageText);
                    }

                    this.Cursor = Cursors.Default;
                }
                else
                {
                    this.Cursor = Cursors.Default;
                    return;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
                this.ShowInformationMessage("先選擇記錄!");
            }
        }
Пример #14
0
 public bool UpdateRecord(AheadOfOffDuty_aod_Info infoObject)
 {
     throw new NotImplementedException();
 }
Пример #15
0
        /// <summary>
        /// 獲得提前下班設置信息
        /// </summary>
        /// <returns></returns>
        private List<ComboboxDataInfo> GetAheadOfOffDutyInfos()
        {
            List<ComboboxDataInfo> infoList = new List<ComboboxDataInfo>();

            try
            {
                IAheadOfOffDutyDA da = SQLiteDAFacotry.GetDAL<IAheadOfOffDutyDA>(SQLiteDAFacotry.AheadOfOffDutyMaster);

                AheadOfOffDuty_aod_Info aodInfo = new AheadOfOffDuty_aod_Info();
                Dictionary<string, object> dicParam = new Dictionary<string, object>();
                List<AheadOfOffDuty_aod_Info> listSource = da.GetEntities<AheadOfOffDuty_aod_Info>(dicParam).ToList();
                if (listSource != null && listSource.Count > 0)
                {
                    foreach (AheadOfOffDuty_aod_Info item in listSource)
                    {
                        ComboboxDataInfo info = new ComboboxDataInfo();

                        info.DisplayMember = item.aod_cName;

                        info.ValueMember = item.aod_RecordID.ToString();

                        infoList.Add(info);
                    }
                }

            }
            catch (Exception Ex)
            {

                throw Ex;
            }

            return infoList;
        }
Пример #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            AheadOfOffDuty_aod_Info saveInfo = new AheadOfOffDuty_aod_Info();
            AdvanceOffWorkInfo afwInfoPartial = ppgAfwInfos.SelectedObject as AdvanceOffWorkInfo;
            ReturnValueInfo rvInfo = null;

            if (afwInfoPartial  ==null )
            {
                this.ShowWarningMessage("保存失敗,獲取鍵入資料有誤。");
                this.Cursor = Cursors.Default;
                return;
            }

            if (CheckCanSave() == false)
            {
                this.ShowWarningMessage("保存失敗,獲取鍵入資料有誤。");
                this.Cursor = Cursors.Default;
                return;
            }

            if (this.EditState == DefineConstantValue.EditStateEnum.OE_Insert)
            {
                saveInfo.aod_RecordID = afwInfoPartial.aod_iRecordID;
                saveInfo.aod_cName = afwInfoPartial.aod_cName.Trim();
                saveInfo.aod_dOffDutyTime = afwInfoPartial.aod_dOffDutyTime.Trim();
                saveInfo.aod_iShiftTypeID =int.Parse( afwInfoPartial.aod_iShiftTypeID);
                //saveInfo.aod_lIsDeleted = false;
                saveInfo.aod_lIsAtive = afwInfoPartial.aod_lIsAtive;
                saveInfo.aod_TargetID = _CurrentAfwInfo.aod_TargetID;
                saveInfo.aod_cType = "";
                saveInfo.aod_cAdd = base.UserInformation.usm_cUserLoginID;
                saveInfo.aod_dAddDate = DateTime.Now;
                saveInfo.aod_cLast = base.UserInformation.usm_cUserLoginID;
                saveInfo.aod_dLastDate = DateTime.Now;
                rvInfo = _AheadOfOffDutyBL.Save(saveInfo, DefineConstantValue.EditStateEnum.OE_Insert);
            }
            else if(this.EditState == DefineConstantValue.EditStateEnum.OE_Update)
            {
                saveInfo.aod_RecordID = afwInfoPartial.aod_iRecordID;
                saveInfo.aod_cName = afwInfoPartial.aod_cName.Trim();
                saveInfo.aod_dOffDutyTime = afwInfoPartial.aod_dOffDutyTime.Trim();
                saveInfo.aod_iShiftTypeID =int.Parse( afwInfoPartial.aod_iShiftTypeID);
                //saveInfo.aod_lIsDeleted = false;
                saveInfo.aod_lIsAtive = afwInfoPartial.aod_lIsAtive;
                saveInfo.aod_cLast = base.UserInformation.usm_cUserLoginID;
                saveInfo.aod_dLastDate = DateTime.Now;
                rvInfo = _AheadOfOffDutyBL.Save(saveInfo, DefineConstantValue.EditStateEnum.OE_Update);
            }
            if (rvInfo.boolValue && !rvInfo.isError)
            {
                this.ShowInformationMessage("保存成功。");
            }
            else
            {
                this.ShowWarningMessage("保存失敗,異常信息:" + rvInfo.messageText);
            }

            this.Cursor = Cursors.Default;
        }