Esempio n. 1
0
        public void InitTodayScheduling()
        {
            Scheduling_BLL bll   = new Scheduling_BLL();
            DateTime       today = DateTime.Parse(DateTime.Now.ToShortDateString());



            string xingqi = GetWeekNumberZh(today.DayOfWeek.ToString());

            Label_Today_Date.Text = today.ToString("yyyy年MM月dd日");
            Label_Today_Week.Text = xingqi;
            Label_Today_day.Text  = today.Day.ToString();

            List <PF.Models.SQL.Scheduling> list = bll.GetList(a => a.Date == today).ToList();


            PF.Models.SQL.Scheduling shouxi = list.Where(a => a.Work == "首席").FirstOrDefault();
            if (shouxi != null)
            {
                Label_ShouXi_Today.Text = shouxi.YBUserName;
            }
            else
            {
                Label_ShouXi_Today.Text = string.Empty;
            }
            PF.Models.SQL.Scheduling lingban = list.Where(a => a.Work == "领班").FirstOrDefault();
            if (lingban != null)
            {
                Label_LingBan_Today.Text = lingban.YBUserName;
            }
            else
            {
                Label_LingBan_Today.Text = string.Empty;
            }
            PF.Models.SQL.Scheduling zhiban = list.Where(a => a.Work == "值班").FirstOrDefault();
            if (zhiban != null)
            {
                Label_ZhiBan_Today.Text = zhiban.YBUserName;
            }
            else
            {
                Label_ZhiBan_Today.Text = string.Empty;
            }

            PF.Models.SQL.Scheduling lianxian = list.Where(a => a.Work == "连线").FirstOrDefault();
            if (lianxian != null)
            {
                Label_LianXian_Today.Text = lianxian.YBUserName;
            }
            else
            {
                Label_LianXian_Today.Text = string.Empty;
            }
        }
Esempio n. 2
0
        protected void DropDownList_ShouXi_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList drd       = sender as DropDownList;
            Repeater     rps       = drd.Parent.Parent as Repeater;
            int          n         = ((RepeaterItem)drd.Parent).ItemIndex;
            HiddenField  hid       = (HiddenField)(rps.Items[n].FindControl("HiddenField_DayTime"));
            string       daystring = hid.Value;
            DateTime     dt        = DateTime.Parse(daystring);

            //已经拿到了id,可以进行操作
            DropDownList ddl = (DropDownList)(rps.Items[n].FindControl("DropDownList_ShouXi"));



            PF.BLL.SQL.Scheduling_BLL scbll = new Scheduling_BLL();


            if (ddl.SelectedItem.Value == "未选择")
            {
                scbll.Delete(a => a.Date == dt && a.Work == "首席");
            }
            else
            {
                PF.Models.SQL.Scheduling sc = scbll.Get(a => a.Date == dt && a.Work == "首席");
                if (sc == null)
                {
                    sc = new Models.SQL.Scheduling()
                    {
                        SchedulingID = Guid.NewGuid(),
                        CreateTime   = DateTime.Now,
                        Date         = dt,
                        Work         = "首席",
                        YBUserID     = Guid.Parse(ddl.SelectedItem.Value),
                        YBUserName   = ddl.SelectedItem.Text,
                        Order        = 1
                    };
                    scbll.Add(sc);
                }
                else
                {
                    sc.YBUserID   = Guid.Parse(ddl.SelectedItem.Value);
                    sc.YBUserName = ddl.SelectedItem.Text;
                    sc.CreateTime = DateTime.Now;
                    scbll.Update(sc);
                }
            }
        }
Esempio n. 3
0
        protected void RepeaterScheduling_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            YbUsers_BLL ubll = new YbUsers_BLL();
            List <PF.Models.SQL.YbUsers> users = ubll.GetList().ToList();

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //找到分类Repeater关联的数据项
                Day_Scheduling_ViewModel dsv = (Day_Scheduling_ViewModel)e.Item.DataItem;


                Label Label_ShouXi   = (Label)e.Item.FindControl("Label_ShouXi");
                Label Label_LingBan  = (Label)e.Item.FindControl("Label_LingBan");
                Label Label_ZhiBan   = (Label)e.Item.FindControl("Label_ZhiBan");
                Label Label_LianXian = (Label)e.Item.FindControl("Label_LianXian");



                HiddenField hid = (HiddenField)e.Item.FindControl("HiddenField_DayTime");
                DateTime    dt  = DateTime.Parse(hid.Value);



                PF.Models.SQL.Scheduling shouxi = sclist.Where(a => a.Date == dt && a.Work == "首席").FirstOrDefault();

                if (shouxi != null)
                {
                    Label_ShouXi.Text = shouxi.YBUserName;
                }
                else
                {
                    Label_ShouXi.Text = string.Empty;
                }



                PF.Models.SQL.Scheduling lingban = sclist.Where(a => a.Date == dt && a.Work == "领班").FirstOrDefault();
                if (lingban != null)
                {
                    Label_LingBan.Text = lingban.YBUserName;
                }
                else
                {
                    Label_LingBan.Text = string.Empty;
                }



                PF.Models.SQL.Scheduling zhiban = sclist.Where(a => a.Date == dt && a.Work == "值班").FirstOrDefault();

                if (zhiban != null)
                {
                    Label_ZhiBan.Text = zhiban.YBUserName;
                }
                else
                {
                    Label_LingBan.Text = string.Empty;
                }
                PF.Models.SQL.Scheduling lianxian = sclist.Where(a => a.Date == dt && a.Work == "连线").FirstOrDefault();

                if (lianxian != null)
                {
                    Label_LianXian.Text = lianxian.YBUserName;
                }
                else
                {
                    Label_LianXian.Text = string.Empty;
                }
            }
        }
Esempio n. 4
0
        protected void RepeaterScheduling_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            YbUsers_BLL ubll = new YbUsers_BLL();
            List <PF.Models.SQL.YbUsers> users          = ubll.GetList(a => a.Work == "预报" && a.Position != "挂职" && a.YBUserName != "集体").OrderBy(a => a.Order).ToList();
            List <PF.Models.SQL.YbUsers> users_LianXian = ubll.GetList(a => a.Work == "连线").OrderBy(a => a.Order).ToList();

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //找到分类Repeater关联的数据项
                Day_Scheduling_ViewModel dsv = (Day_Scheduling_ViewModel)e.Item.DataItem;

                DropDownList DropDownList_ShouXi   = (DropDownList)e.Item.FindControl("DropDownList_ShouXi");
                DropDownList DropDownList_LingBan  = (DropDownList)e.Item.FindControl("DropDownList_LingBan");
                DropDownList DropDownList_ZhiBan   = (DropDownList)e.Item.FindControl("DropDownList_ZhiBan");
                DropDownList DropDownList_LianXian = (DropDownList)e.Item.FindControl("DropDownList_LianXian");


                ListItem lino1 = new ListItem()
                {
                    Text = "   ", Value = "未选择"
                };
                ListItem lino2 = new ListItem()
                {
                    Text = "   ", Value = "未选择"
                };
                ListItem lino3 = new ListItem()
                {
                    Text = "   ", Value = "未选择"
                };
                ListItem lino4 = new ListItem()
                {
                    Text = "   ", Value = "未选择"
                };
                DropDownList_ShouXi.Items.Add(lino1);
                DropDownList_LingBan.Items.Add(lino2);
                DropDownList_ZhiBan.Items.Add(lino3);
                DropDownList_LianXian.Items.Add(lino4);


                foreach (var ybUser in users)
                {
                    ListItem li1 = new ListItem()
                    {
                        Text = ybUser.YBUserName, Value = ybUser.YBUserID.ToString()
                    };
                    ListItem li2 = new ListItem()
                    {
                        Text = ybUser.YBUserName, Value = ybUser.YBUserID.ToString()
                    };
                    ListItem li3 = new ListItem()
                    {
                        Text = ybUser.YBUserName, Value = ybUser.YBUserID.ToString()
                    };
                    DropDownList_ShouXi.Items.Add(li1);
                    DropDownList_LingBan.Items.Add(li2);
                    DropDownList_ZhiBan.Items.Add(li3);
                }
                foreach (var ybUser in users_LianXian)
                {
                    ListItem li4 = new ListItem()
                    {
                        Text = ybUser.YBUserName, Value = ybUser.YBUserID.ToString()
                    };

                    DropDownList_LianXian.Items.Add(li4);
                }



                HiddenField hid = (HiddenField)e.Item.FindControl("HiddenField_DayTime");
                DateTime    dt  = DateTime.Parse(hid.Value);



                PF.Models.SQL.Scheduling shouxi = sclist.Where(a => a.Date == dt && a.Work == "首席").FirstOrDefault();

                foreach (ListItem lis in DropDownList_ShouXi.Items)
                {
                    if (shouxi != null)
                    {
                        if (lis.Text == shouxi.YBUserName)
                        {
                            lis.Selected = true;
                        }
                        else
                        {
                            lis.Selected = false;
                        }
                    }
                    else
                    {
                        if (lis.Value == "未选择")
                        {
                            lis.Selected = true;
                        }
                        else
                        {
                            lis.Selected = false;
                        }
                    }
                }
                PF.Models.SQL.Scheduling lingban = sclist.Where(a => a.Date == dt && a.Work == "领班").FirstOrDefault();

                foreach (ListItem li in DropDownList_LingBan.Items)
                {
                    if (lingban != null)
                    {
                        if (li.Text == lingban.YBUserName)
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                    }
                    else
                    {
                        if (li.Value == "未选择")
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                    }
                }
                PF.Models.SQL.Scheduling zhiban = sclist.Where(a => a.Date == dt && a.Work == "值班").FirstOrDefault();

                foreach (ListItem li in DropDownList_ZhiBan.Items)
                {
                    if (zhiban != null)
                    {
                        if (li.Text == zhiban.YBUserName)
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                    }
                    else
                    {
                        if (li.Value == "未选择")
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                    }
                }


                PF.Models.SQL.Scheduling lianxian = sclist.Where(a => a.Date == dt && a.Work == "连线").FirstOrDefault();

                foreach (ListItem li in DropDownList_LianXian.Items)
                {
                    if (lianxian != null)
                    {
                        if (li.Text == lianxian.YBUserName)
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                    }
                    else
                    {
                        if (li.Value == "未选择")
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                    }
                }
            }
        }