Пример #1
0
 /// <summary>
 /// 新建服务
 /// </summary>
 public static int InsertService(CustomServices cusser, int createID)
 {
     cusser.CSState      = 1;
     cusser.CSCreateDate = DateTime.Now;
     cusser.CSCreateID   = createID;
     return(BaseDAL.Insert(cusser));
 }
Пример #2
0
        /// <summary>
        /// 修改密码
        /// </summary>
        public static int UpdatePwd(string pwd, int userID)
        {
            Users u = BaseDAL.Find <Users>(userID);

            u.UserLPWD = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(pwd)));
            return(BaseDAL.Update(u));
        }
Пример #3
0
 /// <summary>
 /// 录入服务处理,等待客户回应
 /// </summary>
 public static int SaveCSDeal(string csDeal, int csID)
 {
     SqlParameter[] pars = new SqlParameter[] {
         new SqlParameter("@CSDeal", csDeal),
         new SqlParameter("@CSDealDate", DateTime.Now),
         new SqlParameter("@CSID", csID)
     };
     return(BaseDAL.ExecuteNonQuery("update CustomServices set CSDeal=@CSDeal,CSDealDate=@CSDealDate,CSState=3 where CSID=@CSID", pars));
 }
Пример #4
0
 /// <summary>
 /// 录入处理结果,以及客户满意度,服务归档
 /// </summary>
 public static int SaveCSResult(string csResult, int csSatisfy, int csID)
 {
     SqlParameter[] pars = new SqlParameter[] {
         new SqlParameter("@CSResult", csResult),
         new SqlParameter("@CSSatisfy", csSatisfy),
         new SqlParameter("@CSID", csID)
     };
     return(BaseDAL.ExecuteNonQuery("update CustomServices set CSResult=@CSResult,CSSatisfy=@CSSatisfy,CSState=4 where CSID=@CSID", pars));
 }
Пример #5
0
        /// <summary>
        /// 根据姓名模糊查询
        /// </summary>
        public static List <Users> LoadUsersByName(string nameCode)
        {
            List <Users> users = BaseDAL.Select <Users>("select top 10 * from Users where UserName like @nameCode or UserCode like @nameCode order by UserID desc", new SqlParameter("@nameCode", "%" + nameCode + "%"));

            foreach (var u in users)
            {
                u.UserLPWD = "";
            }
            return(users);
        }
Пример #6
0
        /// <summary>
        /// 分页查询已归档的服务
        /// </summary>
        public static PagingList <v_CustomServices> LoadServiceDetailPaging(int pageSize, int pageIndex, string cusName, string STID)
        {
            string whereSql = "CUSName like @CUSName and STID like @STID and CSState=4";

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@CUSName", "%" + cusName + "%"),
                new SqlParameter("@STID", "%" + STID + "%")
            };
            return(BaseDAL.Paging <v_CustomServices>(pageSize, pageIndex, whereSql, pars));
        }
Пример #7
0
        public static PagingList <v_users> LoadUsersPaging(int pageSize, int pageIndex)
        {
            PagingList <v_users> ulist = BaseDAL.Paging <v_users>(pageSize, pageIndex);

            for (int i = 0; i < ulist.Data.Count; i++)
            {
                ulist.Data[i].UserLPWD = string.Empty;    // 不返回密码
            }
            return(ulist);
        }
Пример #8
0
 /// <summary>
 /// 分页加载销售机会分配信息
 /// </summary>
 public static PagingList <v_chances> PadingSaleAllot(int pageSize, int pageIndex, string chanName, string chanLinkMan, string chanCreateManName, string chanDueManName)
 {
     SqlParameter[] pars = new SqlParameter[] {
         new SqlParameter("@ChanName", "%" + chanName + "%"),
         new SqlParameter("@ChanLinkMan", "%" + chanLinkMan + "%"),
         new SqlParameter("@ChanCreateManName", "%" + chanCreateManName + "%"),
         new SqlParameter("@ChanDueManName", "%" + chanDueManName + "%")
     };
     return(BaseDAL.Paging <v_chances>(pageSize, pageIndex, "ChanState in (1,2) and ChanName like @ChanName and ChanLinkMan like @ChanLinkMan and ChanCreateManName like @ChanCreateManName and ChanDueManName like @ChanDueManName", pars));
 }
Пример #9
0
        /// <summary>
        /// 分页查询
        /// </summary>
        public static PagingList <V_Customers> LoadPaging(int pageSize, int pageIndex, string cusID, string cusName)
        {
            string whereSql = "CusState=1 and CusID like @cusid and CusName like @cusname";

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@cusid", "%" + cusID + "%"),
                new SqlParameter("@cusname", "%" + cusName + "%")
            };
            return(BaseDAL.Paging <V_Customers>(pageSize, pageIndex, whereSql, pars));
        }
Пример #10
0
        /// <summary>
        /// 插入指定客户的暂缓措施细节
        /// </summary>
        public static int Insert(string meDesc, int clID)
        {
            Measures me = new Measures()
            {
                CLID   = clID,
                MeDate = DateTime.Now,
                MeDesc = meDesc
            };

            return(BaseDAL.Insert(me));
        }
Пример #11
0
        private static List <MenuV2> SelectSubPowers(int RoleID = 0, int ParentID = 0)
        {
            List <MenuV2> list = BaseDAL.Select <MenuV2>(string.Format(@"select m.*
,convert(bit, case when p.id is not null then 1 else 0 end) as Checked
,null SubMenus
from Menu m
left join Power p on p.RoleID={0} and m.ID=p.MenuID
where m.ParentID={1}", RoleID, ParentID));

            return(list);
        }
Пример #12
0
        /// <summary>
        /// 修改未分配销售机会信息
        /// </summary>
        public static int UpdateSaleChance(Chances chance)
        {
            Chances old = BaseDAL.Find <Chances>(chance.ChanID);

            old.ChanName    = chance.ChanName;
            old.ChanLinkMan = chance.ChanLinkMan;
            old.ChanLinkTel = chance.ChanLinkTel;
            old.ChanTitle   = chance.ChanTitle;
            old.ChanDesc    = chance.ChanDesc;
            old.ChanRate    = chance.ChanRate;
            return(BaseDAL.Update(old));
        }
Пример #13
0
        /// <summary>
        /// 更新计划的执行结果
        /// </summary>
        public static int UpdatePlan(int planID, string planResult)
        {
            Plans p = BaseDAL.Find <Plans>(planID);

            if (p == null)
            {
                return(0);
            }
            p.PlanResult     = planResult;
            p.PlanResultDate = DateTime.Now;
            return(BaseDAL.Update(p));
        }
Пример #14
0
 public static int UpdateUser(Users u)
 {
     if (string.IsNullOrWhiteSpace(u.UserLPWD))
     {
         u.UserLPWD = BaseDAL.Find <Users>(u.UserID).UserLPWD;
     }
     else
     {
         u.UserLPWD = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(u.UserLPWD)));
     }
     return(BaseDAL.Update(u));
 }
Пример #15
0
        /// <summary>
        /// 确认客户流失
        /// </summary>
        public static int SaveCLReason(string clReason, int clID)
        {
            CustomLosts cl = BaseDAL.Find <CustomLosts>(clID);

            cl.CLReason    = clReason;
            cl.CLEnterDate = DateTime.Now;
            cl.CLState     = 3;
            if (BaseDAL.Update(cl) > 0)
            {
                return(CustomersDAL.CusLost(cl.CusID.Value));
            }
            return(0);
        }
Пример #16
0
        /// <summary>
        /// 添加销售计划
        /// </summary>
        public static int InsertPlanContent(int chanID, string planContent)
        {
            if (string.IsNullOrEmpty(planContent))
            {
                throw new Exception("计划内容为空");
            }
            Plans p = new Plans()
            {
                ChanID      = chanID,
                PlanContent = planContent,
                PlanDate    = DateTime.Now
            };

            return(BaseDAL.Insert(p));
        }
Пример #17
0
        /// <summary>
        /// 更改分配人
        /// </summary>
        public static int UpdateCSDueMan(int?csDueID, int csID)
        {
            CustomServices cs = BaseDAL.Find <CustomServices>(csID);

            if (csDueID == null)
            {
                cs.CSState   = 1;
                cs.CSDueID   = null;
                cs.CSDueDate = null;
            }
            else
            {
                cs.CSState   = 2;
                cs.CSDueID   = csDueID;
                cs.CSDueDate = DateTime.Now;
            }

            return(BaseDAL.Update(cs));
        }
Пример #18
0
        /// <summary>
        /// 分配人
        /// </summary>
        public static int UpdateChanDueMan(int?chanDueMan, int chanID)
        {
            Chances ch = BaseDAL.Find <Chances>(chanID);

            if (chanDueMan == null)
            {
                ch.ChanState   = 1;
                ch.ChanDueDate = null;
                ch.ChanDueMan  = null;
            }
            else
            {
                ch.ChanState   = 2;
                ch.ChanDueDate = DateTime.Now;
                ch.ChanDueMan  = chanDueMan;
            }

            return(BaseDAL.Update(ch));
        }
Пример #19
0
 /// <summary>
 /// 更新权限
 /// </summary>
 public static bool UpdatePowers(int rid, int[] Powers)
 {
     try
     {
         //先删除原有权限
         BaseDAL.ExecuteNonQuery("delete Power where RoleID=" + rid);
         //添加新的权限
         foreach (var item in Powers)
         {
             if (Convert.ToInt32(BaseDAL.ExecuteScalar("select count(*) from Power where RoleID=" + rid + " and MenuID=" + item)) == 0)
             {
                 BaseDAL.ExecuteNonQuery("insert into Power (RoleID, MenuID) values (" + rid + ", " + item + ")");
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #20
0
        /// <summary>
        /// 更新销售机会的状态
        /// </summary>
        public static int UpdateChanState(int chanID, int chanState, string chanError, int userID)
        {
            if (chanState != 3 && chanState != 4)
            {
                throw new Exception("状态只能是3(成功)或4(失败)");
            }
            if (chanState == 4 && string.IsNullOrEmpty(chanError))
            {
                throw new Exception("必须填写失败原因!");
            }
            //找到销售机会
            var Chan = BaseDAL.Find <Chances>(chanID);

            if (Chan == null)
            {
                return(0);
            }

            //更新状态
            Chan.ChanState = chanState;
            Chan.ChanError = chanError;
            int count = BaseDAL.Update(Chan);

            // 如果是成功
            if (chanState == 3 && count > 0)
            {
                //添加新客户
                //UserID = 当前登陆人的ID
                Customers c = new Customers()
                {
                    UserID   = userID,
                    CusName  = Chan.ChanName,
                    CusDate  = DateTime.Now,
                    CusState = 1
                };
                BaseDAL.Insert(c);
            }
            return(count);
        }
Пример #21
0
        /// <summary>
        /// 得到失败原因
        /// </summary>
        public static string GetChanError(int chanID)
        {
            Chances chan = BaseDAL.Find <Chances>(chanID);

            return(chan == null ? string.Empty : chan.ChanError);
        }
Пример #22
0
 /// <summary>
 /// 加载全部的销售计划信息
 /// </summary>
 /// <returns></returns>
 public static List <Plans> LoadByChanID(int chanID)
 {
     return(BaseDAL.Select <Plans>("select * from Plans where ChanID=@ChanID"
                                   , new SqlParameter("@ChanID", chanID)));
 }
Пример #23
0
 /// <summary>
 /// 客户流失
 /// </summary>
 public static int CusLost(int cusID)
 {
     return(BaseDAL.ExecuteNonQuery("update Customers set CusState=2 where CusID=" + cusID));
 }
Пример #24
0
 /// <summary>
 /// 修改未流失客户的资料
 /// </summary>
 public static int Update(Customers cus)
 {
     cus.CusState = 1; //只有未流失的客户才有修改,所以无论怎样改,都是1
     return(BaseDAL.Update(cus));
 }
Пример #25
0
 /// <summary>
 /// 查询指定客户的暂缓措施
 /// </summary>
 public static List <Measures> LoadByCLID(int clID)
 {
     return(BaseDAL.Select <Measures>("select * from Measures where CLID=" + clID));
 }
Пример #26
0
 /// <summary>
 /// 检查密码是否正确
 /// </summary>
 public static int CheckOldPwd(string pwd, int userID)
 {
     return(Convert.ToInt32(BaseDAL.ExecuteScalar("select count(*) from Users where UserID=@UserID and UserLPWD=@UserLPWD"
                                                  , new SqlParameter("@UserID", userID), new SqlParameter("@UserLPWD", BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(pwd)))))));
 }
Пример #27
0
 /// <summary>
 /// 统计角色下共有多少个用户
 /// </summary>
 public static int CountUserByRole(int roleID)
 {
     return(Convert.ToInt32(BaseDAL.ExecuteScalar("select count(*) from Users where roleid=" + roleID)));
 }
Пример #28
0
 public static int AddUser(Users u)
 {
     u.UserLPWD = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(u.UserLPWD)));
     return(BaseDAL.Insert(u));
 }
Пример #29
0
 public static int RemoveUser(int uid)
 {
     return(BaseDAL.Delete <Users>(uid));
 }
Пример #30
0
 /// <summary>
 /// 查询指定客户的信息
 /// </summary>
 public static V_Customers LoadCustomerByID(int cusID)
 {
     return(BaseDAL.Find <V_Customers>(cusID));
 }