예제 #1
0
        /// <summary>
        /// 工作人员列表修改
        /// </summary>
        /// <param name="WorkPer"></param>
        /// <returns></returns>
        public ActionResult UpdataWorkPersonnel(B_WorkPersonnel WorkPer)
        {
            string strMsg           = "fali";
            var    pdAWorkPersonnel = (from tbWorkPer in myModels.B_WorkPersonnel
                                       where
                                       tbWorkPer.WorkPersonnelID == WorkPer.WorkPersonnelID
                                       select tbWorkPer).Single();

            if (pdAWorkPersonnel != null)
            {
                pdAWorkPersonnel.Workname              = WorkPer.Workname;
                pdAWorkPersonnel.WorkLoginName         = WorkPer.WorkLoginName;
                pdAWorkPersonnel.Password              = WorkPer.Password;
                pdAWorkPersonnel.SexID                 = WorkPer.SexID;
                pdAWorkPersonnel.MaillSite             = WorkPer.MaillSite;
                pdAWorkPersonnel.PhoneCode             = WorkPer.PhoneCode;
                pdAWorkPersonnel.RegisterTime          = WorkPer.RegisterTime;
                pdAWorkPersonnel.FinallyEnterTime      = WorkPer.FinallyEnterTime;
                pdAWorkPersonnel.UserStateID           = WorkPer.UserStateID;
                myModels.Entry(pdAWorkPersonnel).State = System.Data.Entity.EntityState.Modified;
                if (myModels.SaveChanges() > 0)
                {
                    strMsg = "success";
                }
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        /// <summary>
        ///重置密码
        /// </summary>
        /// <param name="UnitRegisterID"></param>
        /// <returns></returns>
        public ActionResult UpdataWork(int WorkPersonnelID)
        {
            B_WorkPersonnel WorkPersonnel = (from tbWorkPer in myModels.B_WorkPersonnel
                                             where
                                             tbWorkPer.WorkPersonnelID == WorkPersonnelID
                                             select tbWorkPer).Single();

            WorkPersonnel.Password = "******";
            myModels.Entry(WorkPersonnel).State = System.Data.Entity.EntityState.Modified;
            if (myModels.SaveChanges() > 0)
            {
                return(Json("success", JsonRequestBehavior.AllowGet));
            }
            return(Json("fail", JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        /// <summary>
        /// 工作人员列表删除
        /// </summary>
        /// <param name="WorkPersonnelID"></param>
        /// <returns></returns>
        public ActionResult DeleteWorkPersonnel(int WorkPersonnelID)
        {
            string strMsg = "fail";

            try
            {
                B_WorkPersonnel dbWorkPer = (from tbWorkPer in myModels.B_WorkPersonnel
                                             where tbWorkPer.WorkPersonnelID == WorkPersonnelID
                                             select tbWorkPer).Single();
                myModels.B_WorkPersonnel.Remove(dbWorkPer);
                myModels.SaveChanges();
                strMsg = "success";
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        /// <summary>
        /// 工作人员列表新增
        /// </summary>
        /// <param name="SexID"></param>
        /// <param name="UserStateID"></param>
        /// <param name="Workname"></param>
        /// <param name="WorkLoginName"></param>
        /// <param name="Password"></param>
        /// <param name="MaillSite"></param>
        /// <param name="PhoneCode"></param>
        /// <param name="RegisterTime"></param>
        /// <param name="FinallyEnterTime"></param>
        /// <returns></returns>
        public ActionResult InsertWorkPersonnel(int SexID, int UserStateID, string Workname, string WorkLoginName, string Password, string MaillSite, string PhoneCode, DateTime RegisterTime, DateTime FinallyEnterTime)
        {
            string strMsg = "fail";

            try
            {
                int oldWorkPersonnel = (from tbWorkPersonnel in myModels.B_WorkPersonnel
                                        where
                                        tbWorkPersonnel.SexID == SexID &&
                                        tbWorkPersonnel.UserStateID == UserStateID &&
                                        tbWorkPersonnel.Workname == Workname &&
                                        tbWorkPersonnel.WorkLoginName == WorkLoginName &&
                                        tbWorkPersonnel.Password == Password &&
                                        tbWorkPersonnel.MaillSite == MaillSite &&
                                        tbWorkPersonnel.PhoneCode == PhoneCode &&
                                        tbWorkPersonnel.RegisterTime == RegisterTime &&
                                        tbWorkPersonnel.FinallyEnterTime == FinallyEnterTime
                                        select tbWorkPersonnel).Count();
                if (oldWorkPersonnel == 0)
                {
                    B_WorkPersonnel myWorkPersonnel = new B_WorkPersonnel();
                    myWorkPersonnel.SexID            = SexID;
                    myWorkPersonnel.UserStateID      = UserStateID;
                    myWorkPersonnel.Workname         = Workname;
                    myWorkPersonnel.WorkLoginName    = WorkLoginName;
                    myWorkPersonnel.Password         = Password;
                    myWorkPersonnel.MaillSite        = MaillSite;
                    myWorkPersonnel.PhoneCode        = PhoneCode;
                    myWorkPersonnel.RegisterTime     = RegisterTime;
                    myWorkPersonnel.FinallyEnterTime = FinallyEnterTime;
                    myModels.B_WorkPersonnel.Add(myWorkPersonnel);
                    if (myModels.SaveChanges() > 0)
                    {
                        strMsg = "success";
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(strMsg, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        /// <summary>
        ///全部重置密码
        /// </summary>
        /// <param name="WorkPersonnelID"></param>
        /// <returns></returns>
        public ActionResult UpdataWorkPer()
        {
            int WorkPersonnelID;
            var WorkPersonnel = (from tbWorkPer in myModels.B_WorkPersonnel
                                 select new
            {
                WorkPersonnelID = tbWorkPer.WorkPersonnelID
            }).ToList();

            foreach (var item in WorkPersonnel)
            {
                WorkPersonnelID = Convert.ToInt32(item.WorkPersonnelID);
                B_WorkPersonnel WorkPersonnels = (from tbWorkPer in myModels.B_WorkPersonnel
                                                  where
                                                  tbWorkPer.WorkPersonnelID == WorkPersonnelID
                                                  select tbWorkPer).Single();
                WorkPersonnels.Password = "******";
                myModels.Entry(WorkPersonnels).State = System.Data.Entity.EntityState.Modified;
                myModels.SaveChanges();
            }

            return(Json("success", JsonRequestBehavior.AllowGet));
        }