示例#1
0
        /// <summary>
        /// 点击排班的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void panban_Click(object sender, EventArgs e)
        {
            ArrangeDuty ad = new ArrangeDuty();

            ad.ShowDialog();
            if (ad.DialogResult == DialogResult.OK)
            {
                if (TfM != null)
                {
                    OnDutyTable ot;
                    DateTime    dt  = new DateTime(((DateTime)((((LinkLabel)sender).Parent).Tag)).Ticks);
                    string      sql = "select u from OnDutyTable u where u.Time = " + dt.Ticks +
                                      " and u.State = " + (int)IEntity.stateEnum.Normal;
                    IList i = baseService.loadEntityList(sql);
                    if (i != null && i.Count > 0)
                    {
                        ot = (OnDutyTable)i[0];
                    }
                    else
                    {
                        ot = new OnDutyTable();
                    }
                    ot.TFMId     = TfM;
                    ot.Time      = dt.Ticks;
                    ot.DaiBanID  = ad.Duser;
                    ot.BaiBanID  = ad.Buser;
                    ot.YeBanID   = ad.Yuser;
                    ot.State     = (int)IEntity.stateEnum.Normal;
                    ot.TimeStamp = DateTime.Now.Ticks;
                    TfM.IsDone   = 1;

                    TfM.ExamineState     = 0;
                    this.CheckState.Text = "审核状态:未审核";

                    baseService.SaveOrUpdateEntity(TfM);

                    #region 向服务器发送消息

                    try
                    {
                        KjqbService.Service1Client ser = new KjqbService.Service1Client();
                        string ssql1 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and (u.Kdid.KdName like '%" + affairsDept + "%') ";
                        string ssql2 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and (u.Kdid.KdName like '%" + netDept + "%') ";
                        if (TfM.DutyType == 0)
                        {
                            IList users = baseService.loadEntityList(ssql1);
                            KjqbService.TimeArrangeForManagerInService tfminservice = new KjqbService.TimeArrangeForManagerInService();
                            tfminservice.ExamineOrExamineresult = 0;
                            tfminservice.UserId     = ((WkTUser)users[0]).Id;
                            tfminservice.SendUserId = this.user.Id;
                            tfminservice.TimeArrangeForManagerId = TfM.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfminservice);
                        }
                        else if (TfM.DutyType == 1)
                        {
                            IList users = baseService.loadEntityList(ssql2);
                            KjqbService.TimeArrangeForManagerInService tfminservice = new KjqbService.TimeArrangeForManagerInService();
                            tfminservice.ExamineOrExamineresult = 0;
                            tfminservice.UserId     = ((WkTUser)users[0]).Id;
                            tfminservice.SendUserId = this.user.Id;
                            tfminservice.TimeArrangeForManagerId = TfM.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfminservice);
                        }
                    }
                    catch { }
                    #endregion


                    #region 行政班
                    if (TfM.DutyType == 0) //行政班
                    {
                        PrintDutyPersonName((Panel)((LinkLabel)sender).Parent, ad.Duser, ad.Buser, ad.Yuser, 0);
                        ot.Type = 0;
                    }
                    #endregion

                    #region 网络班
                    else
                    {
                        PrintDutyPersonName((Panel)((LinkLabel)sender).Parent, ad.Duser, ad.Buser, ad.Yuser, 1);
                        ot.Type = 1;
                    }

                    baseService.SaveOrUpdateEntity(ot);

                    #endregion
                }
            }
        }
示例#2
0
        /// <summary>
        /// 点击排班的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void panban_Click(object sender, EventArgs e)
        {
            ArrangeDuty ad = new ArrangeDuty();
            ad.ShowDialog();
            if (ad.DialogResult == DialogResult.OK)
            {
                if (TfM != null)
                {
                    OnDutyTable ot;
                    DateTime dt = new DateTime(((DateTime)((((LinkLabel)sender).Parent).Tag)).Ticks);
                    string sql = "select u from OnDutyTable u where u.Time = " + dt.Ticks +
                        " and u.State = " + (int)IEntity.stateEnum.Normal;
                    IList i = baseService.loadEntityList(sql);
                    if (i != null && i.Count > 0)
                    {
                        ot = (OnDutyTable)i[0];
                    }
                    else
                    {
                        ot = new OnDutyTable();

                    }
                    ot.TFMId = TfM;
                    ot.Time = dt.Ticks;
                    ot.DaiBanID = ad.Duser;
                    ot.BaiBanID = ad.Buser;
                    ot.YeBanID = ad.Yuser;
                    ot.State = (int)IEntity.stateEnum.Normal;
                    ot.TimeStamp = DateTime.Now.Ticks;
                    TfM.IsDone = 1;

                    TfM.ExamineState = 0;
                    this.CheckState.Text = "审核状态:未审核";

                    baseService.SaveOrUpdateEntity(TfM);

                    #region 向服务器发送消息

                    try
                    {

                        KjqbService.Service1Client ser = new KjqbService.Service1Client();
                        string ssql1 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and (u.Kdid.KdName like '%"+affairsDept+"%') ";
                        string ssql2 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and (u.Kdid.KdName like '%"+netDept+"%') ";
                        if (TfM.DutyType == 0)
                        {
                            IList users = baseService.loadEntityList(ssql1);
                            KjqbService.TimeArrangeForManagerInService tfminservice = new KjqbService.TimeArrangeForManagerInService();
                            tfminservice.ExamineOrExamineresult = 0;
                            tfminservice.UserId = ((WkTUser)users[0]).Id;
                            tfminservice.SendUserId = this.user.Id;
                            tfminservice.TimeArrangeForManagerId = TfM.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfminservice);
                        }
                        else if (TfM.DutyType == 1)
                        {
                            IList users = baseService.loadEntityList(ssql2);
                            KjqbService.TimeArrangeForManagerInService tfminservice = new KjqbService.TimeArrangeForManagerInService();
                            tfminservice.ExamineOrExamineresult = 0;
                            tfminservice.UserId = ((WkTUser)users[0]).Id;
                            tfminservice.SendUserId = this.user.Id;
                            tfminservice.TimeArrangeForManagerId = TfM.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfminservice);
                        }
                    }
                    catch { }
                    #endregion

                    #region 行政班
                    if (TfM.DutyType == 0) //行政班
                    {
                        PrintDutyPersonName((Panel)((LinkLabel)sender).Parent, ad.Duser, ad.Buser, ad.Yuser, 0);
                        ot.Type = 0;
                    }
                    #endregion

                    #region 网络班
                    else
                    {

                        PrintDutyPersonName((Panel)((LinkLabel)sender).Parent, ad.Duser, ad.Buser, ad.Yuser, 1);
                        ot.Type = 1;
                    }

                    baseService.SaveOrUpdateEntity(ot);

                    #endregion

                }

            }
        }