コード例 #1
0
        public VMPlanMain()
            : base()
        {
            CollectionPlan = new ObservableCollection<Plan>();//带班计划
            CollectionLeaderInfo = new ObservableCollection<EmpBase>();//新增带班计划人员列表
            SelectedPlans = new ObservableCollection<Plan>();//标记的带班计划
            CollectionDayPlanThis = new ObservableCollection<DayPlan>();//本月计划
            CollectionDayPlanNext = new ObservableCollection<DayPlan>();//下月计划
            CollentionClassType = new ObservableCollection<ClassType>();//班制集合
            CollectionEmpMonth = new ObservableCollection<EmpBase>();//月计划弹窗人员列表
            CurrentLeaderSelected = new EmpBase();//当前标记人员
            addCollectionPlan = AddCollectionPlan;//新增计划委托
            addCollectionLeaderInfo = AddCollectionLeaderInfo;//新增带班计划人员列表委托
            addCollectionDayPlanThis = AddMonthDataThis;//查询本月计划委托
            addCollectionDayPlanNext = AddMonthDataNext;//查询下月计划委托

            //班制集合加载
            using (dataTableTemp)
            {
                dataTableTemp = Bll.GetClassType();

                foreach (DataRow item in dataTableTemp.Rows)
                {
                    CollentionClassType.Add(new ClassType()
                    {
                        ClassID = item[0].ToString(),
                        ClassName = item[1].ToString(),
                        ClassStartTime = item[2].ToString(),
                        ClassEndTime = item[3].ToString()
                    });
                }
            }

            IsMarkCheckBoxVisible = true;
            IsMarkQuery = false;

            GetData();

            if (MonthThis == "12") IsNextMonthEnable = false;
            else IsNextMonthEnable = true;

            LastEmpSave = new EmpBase();
        }
コード例 #2
0
        /// <summary>
        /// 获取未指定人员
        /// </summary>
        private void GetNoAppointEmp()
        {
            using (dtEmpTemp)
            {
                Application.Current.Dispatcher.Invoke(new Action(() => { CollectionEmpInfo.Clear(); }));
                dtEmpTemp = Bll.GetEmpList(GetWhereSql());

                foreach (DataRow item in dtEmpTemp.Rows)
                {
                    EmpBase emp = new EmpBase()
                    {
                        BlockID = item[0].ToString(),
                        Name = item[1].ToString(),
                        Dept = item[2].ToString(),
                        Duty = item[3].ToString(),
                        WorkType = item[4].ToString(),
                        InTime = item[5].ToString(),
                        EmpID = item[6].ToString()
                    };
                    Application.Current.Dispatcher.Invoke(new Action(() => { CollectionEmpInfo.Add(emp); }));
                }
            }
        }
コード例 #3
0
        public string InsertPlan(EmpBase leader, string planDate)
        {
            SqlParameter[] para = { new SqlParameter("@PlanDate",SqlDbType.DateTime),
                                    new SqlParameter("@PlanStartTime",SqlDbType.DateTime),
                                    new SqlParameter("@PlanEndTime",SqlDbType.DateTime),
            };
            para[0].Value = Convert.ToDateTime(planDate);
            para[1].Value = Convert.ToDateTime(leader.MClassType.ClassStartTime);
            para[2].Value = Convert.ToDateTime(leader.MClassType.ClassEndTime);
            string sql = string.Format(
                      "insert into DownPlan "
                    + "(Emp_ID,EmpName,JHBanID,PlanDate,PlanStartTime,PlanEndTime,IsVaild) values "
                    + "({0},'{1}','{2}',{3},{4},{5},{6})"
                    , leader.EmpID, leader.Name, leader.MClassType.ClassName, "@PlanDate", "@PlanStartTime", "@PlanEndTime", 1
                );
            try
            {
                db.ExecuteSql(sql, para);

                string sqlReturn = string.Format(
                    "select Recordid from DownPlan where Emp_ID = '{0}' and PlanDate = '{1}'"
                    , leader.EmpID, planDate
                    );

                string RID = db.Query(sqlReturn).Tables[0].Rows[0][0].ToString();
                return RID;
            }
            catch
            {
                return "";
            }
        }
コード例 #4
0
        private void GetEmpInfo()
        {
            Application.Current.Dispatcher.Invoke(new Action(() => { CollectionLeaderInfo.Clear(); }));

            using (dataTableTemp)
            {
                dataTableTemp = Bll.GetLeaderList(WhereSql);

                foreach (DataRow item in dataTableTemp.Rows)
                {
                    EmpBase emp = new EmpBase()
                    {
                        BlockID = item[0].ToString(),
                        Name = item[1].ToString(),
                        Dept = item[2].ToString() == "" ? "-" : item[2].ToString(),
                        Duty = item[3].ToString() == "" ? "-" : item[3].ToString(),
                        WorkType = item[4].ToString() == "" ? "-" : item[4].ToString(),
                        InTime = item[5].ToString(),
                        EmpID = item[6].ToString()
                    };

                    Application.Current.Dispatcher.Invoke(addCollectionLeaderInfo, emp);
                }
            }
        }
コード例 #5
0
        private void GetAllLeaderData()
        {
            CollectionEmpMonth.Clear();

            using (dataTableTemp)
            {
                dataTableTemp = Bll.GetLeaderList("");
                string month = "";
                if (ucSelected == PlanMainUCSelected.UCMonthPLanThis)
                {
                    month = MonthThis;
                }
                else
                {
                    month = MonthNext;
                }

                foreach (DataRow item in dataTableTemp.Rows)
                {
                    EmpBase leader = new EmpBase()
                    {
                        BlockID = item[0].ToString(),
                        Name = item[1].ToString(),
                        Dept = item[2].ToString(),
                        Duty = item[3].ToString(),
                        WorkType = item[4].ToString(),
                        InTime = item[5].ToString(),
                        EmpID = item[6].ToString()
                    };

                    if (Bll.IsExistsDownPlan(Year, month, leader.EmpID))
                    {
                        leader.IsPlaned = true;
                    }
                    else
                    {
                        leader.IsPlaned = false;
                    }
                    CollectionEmpMonth.Add(leader);
                }
            }
        }
コード例 #6
0
 private void AddCollectionLeaderInfo(EmpBase dr)
 {
     CollectionLeaderInfo.Add(dr);
 }
コード例 #7
0
 public string InsertPlan(EmpBase leader, string planDate)
 {
     return DAL.InsertPlan(leader, planDate);
 }