예제 #1
0
        /// <summary>
        /// 用户登录
        /// </summary>
        public static bool Entry(string username, string password, out string message, out int userId)
        {
            userId = 0;
            var msg = "";
            B2b_company_manageuser user = B2bCompanyManagerUserData.VerifyUser(username, password, out msg);

            if (user == null)
            {
                message = msg;
                return(false);
            }


            userId = user.Id;
            B2b_company company = B2bCompanyData.GetCompany(user.Com_id);//根据公司id得到公司信息

            if (company == null)
            {
                message = "商家null";
                return(false);
            }
            else
            {
                if (company.Com_state == (int)CompanyStatus.InBusiness)
                {
                    message = "";
                    return(true);
                }
                else
                {
                    message = "商家状态不正确";
                    return(false);
                }
            }
        }
예제 #2
0
        private void GetUser()
        {
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            comid = company.ID;
        }
예제 #3
0
        //private static EntryLogCaching caching = new EntryLogCaching();

        #region 获取当前登录用户信息 By:Xiaoxiong
        /// <summary>
        /// 获取当前登录用户的ID By:Xiaoxiong
        /// </summary>
        /// <returns>当前登录用户的ID</returns>
        public static B2b_company_manageuser CurrentUser(int userId = 0)
        {
            var identity = HttpContext.Current.User.Identity;

            if (!identity.IsAuthenticated)
            {
                HttpContext.Current.Response.Redirect(FormsAuthentication.LoginUrl);
            }
            if (userId == 0 && !string.IsNullOrEmpty(identity.Name))
            {
                userId = int.Parse(identity.Name);
            }

            if (userId == 0)
            {
                if (!HttpContext.Current.Response.IsRequestBeingRedirected)
                {
                    HttpContext.Current.Response.Redirect(FormsAuthentication.LoginUrl);
                }
                return(null);
            }

            B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userId);

            if (user == null || user.Id != userId || !VerifyToken(userId))
            {
                if (!HttpContext.Current.Response.IsRequestBeingRedirected)
                {
                    HttpContext.Current.Response.Redirect(FormsAuthentication.LoginUrl);
                }
            }
            return(user);
        }
예제 #4
0
        public string channelcompanyid  = "0";  //渠道公司id
        protected void Page_Load(object sender, EventArgs e)
        {
            channelid = Request["channelid"].ConvertTo <string>("0");
            if (channelid == "0")
            {
                Response.Redirect("/ui/MemberUI/Channelstatistics.aspx");
            }


            channeltype = Request["channeltype"].ConvertTo <string>("out");
            if (channeltype == "inner")
            {
                channeltype = "0";
            }
            else
            {
                channeltype = "1";
            }
            int userid = UserHelper.CurrentUserId();

            IsParentCompanyUser = new B2bCompanyManagerUserData().IsParentCompanyUser(userid);
            if (IsParentCompanyUser == false)//如果是门市账户
            {
                B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userid);
                channelcompanyid = user.Channelcompanyid.ToString();
            }
        }
예제 #5
0
        public int EditB2bCompanyInfo(B2b_company model, B2b_company_info model1, B2b_company_manageuser model2)
        {
            string procsql = "usp_EditComapnyInfo";

            var cmd = sqlHelper.PrepareStoredSqlCommand(procsql);

            //注册公司基本信息
            cmd.AddParam("@CompanyId", model.ID);
            cmd.AddParam("@Com_name", model.Com_name);
            cmd.AddParam("@Scenic_name", model.Scenic_name);
            cmd.AddParam("@Com_type", model.Com_type);
            cmd.AddParam("@Com_state", model.Com_state);
            cmd.AddParam("@Imprest", model.Imprest);
            cmd.AddParam("@Agentid", model.Agentid);
            //注册公司附加信息
            cmd.AddParam("@CompanyInfoId", model1.Id);
            cmd.AddParam("@CompanyInfoCom_id", model1.Com_id);
            cmd.AddParam("@Com_city", model1.Com_city);
            cmd.AddParam("@Com_add", model1.Com_add);
            cmd.AddParam("@Com_class", model1.Com_class);
            cmd.AddParam("@Com_code", model1.Com_code);
            cmd.AddParam("@Com_sitecode", model1.Com_sitecode);
            cmd.AddParam("@Com_license", model1.Com_license);
            cmd.AddParam("@Sale_Agreement", model1.Sale_Agreement);
            cmd.AddParam("@Agent_Agreement", model1.Agent_Agreement);
            cmd.AddParam("@Scenic_address", model1.Scenic_address);
            cmd.AddParam("@Scenic_intro", model1.Scenic_intro);
            cmd.AddParam("@Scenic_Takebus", model1.Scenic_Takebus);
            cmd.AddParam("@Scenic_Drivingcar", model1.Scenic_Drivingcar);
            cmd.AddParam("@Contact", model1.Contact);
            cmd.AddParam("@CompanyInfoTel", model1.Tel);
            cmd.AddParam("@Phone", model1.Phone);
            cmd.AddParam("@Qq", model1.Qq);
            cmd.AddParam("@Email", model1.Email);
            cmd.AddParam("@Defaultprint", model1.Defaultprint);
            cmd.AddParam("@Province", model1.Province);

            cmd.AddParam("@Serviceinfo", model1.Serviceinfo);
            cmd.AddParam("@Coordinate", model1.Coordinate);
            cmd.AddParam("@Coordinatesize", model1.Coordinatesize);
            cmd.AddParam("@Domainname", model1.Domainname);
            //注册公司员工信息
            cmd.AddParam("@CompanyUserId", model2.Id);
            cmd.AddParam("@CompanyUserCom_id", model2.Com_id);
            cmd.AddParam("@Accounts", model2.Accounts);
            cmd.AddParam("@Passwords", model2.Passwords);
            cmd.AddParam("@Atype", model2.Atype);
            cmd.AddParam("@Employeename", model2.Employeename);
            cmd.AddParam("@Job", model2.Job);
            cmd.AddParam("@CompanyUserTel", model2.Tel);
            cmd.AddParam("@Employeestate", model2.Employeestate);
            cmd.AddParam("@Createuserid", model2.Createuserid);
            cmd.AddParam("@channelcompanyid", model2.Channelcompanyid);
            cmd.AddParam("@channelsource", model2.Channelsource);

            var parm = cmd.AddReturnValueParameter("ReturnValue");

            cmd.ExecuteNonQuery();
            return((int)parm.Value);
        }
예제 #6
0
        public static string Changestaffpwd(int staffid, string password, B2b_company_manageuser manageruser = null)
        {
            try
            {
                int result = 0;

                if (manageruser != null)
                {
                    result = B2bCompanyManagerUserData.InsertOrUpdate(manageruser);
                }
                else
                {
                    result = ExcelSqlHelper.ExecuteNonQuery("update b2b_company_manageuser set passwords ='" + password + "' where id=" + staffid);
                }



                return(JsonConvert.SerializeObject(new { type = 100, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
예제 #7
0
        /// <summary>
        /// 编辑注册信息 by:xiaoliu
        /// </summary>
        /// <param name="b2b_company"></param>
        /// <param name="B2b_Company_Info"></param>
        /// <param name="manageuser"></param>
        /// <returns></returns>
        public static string InsertOrUpdateRegister(B2b_company b2b_company, B2b_company_info B2b_Company_Info, B2b_company_manageuser manageuser)
        {
            using (var sql = new SqlHelper())
            {
                try
                {
                    //判断登录账户是否存在
                    B2b_company_manageuser model2 = B2bCompanyManagerUserData.GetManageUserByAccount(manageuser.Accounts);
                    if (model2 != null)
                    {
                        return(JsonConvert.SerializeObject(new { type = 1, msg = "账户已经被注册" }));
                    }

                    //判断商家注册公司名称是否存在
                    B2b_company model1 = B2bCompanyManagerUserData.GetB2bCompanyByCompanyName(b2b_company.Com_name);
                    if (model1 != null)
                    {
                        return(JsonConvert.SerializeObject(new { type = 1, msg = "商家公司已经被注册" }));
                    }

                    int result = new InternalB2bCompany(sql).EditB2bCompanyInfo(b2b_company, B2b_Company_Info, manageuser);//编辑注册公司全部信息
                    if (result > 0)
                    {
                        //当注册成功 后,对绑定分销判断,如果有绑定分销直接进行绑定
                        if (b2b_company.Bindingagent != 0)
                        {
                            var bangdinginfo = AgentCompanyData.BindingAgent(result, b2b_company.Bindingagent);//商户和分销绑定

                            var prodata = new B2bCompanyInfoData();
                            var kaitong = prodata.UpComstate(result, "已暂停");//对暂停的 自动开通

                            //分配权限
                            int      createmasterid   = 0;
                            string   createmastername = "分销开商户自动分配微信负责人(1024)";
                            DateTime createdate       = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                            //获取
                            string masterid = B2bCompanyManagerUserData.GetFirstIDUser(result).ToString();


                            string data = PermissionJsonData.EditMasterGroup(masterid, manageuser.Accounts, "1024", createmasterid, createmastername, createdate);
                        }

                        return(JsonConvert.SerializeObject(new { type = 100, msg = "商家注册成功", result = result }));
                    }
                    else
                    {
                        return(JsonConvert.SerializeObject(new { type = 100, msg = "商家注册出现错误" }));
                    }
                }
                catch
                {
                    //sql.Rollback();
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "商家注册出现意外错误" }));

                    throw;
                }
            }
        }
예제 #8
0
        public static string LoadingList(string comid, int pageindex, int pagesize, int userid)
        {
            var totalcount = 0;

            try
            {
                var list = new List <Member_Activity_Log>();
                B2b_company_manageuser userr = B2bCompanyManagerUserData.GetUser(userid);
                if (userr != null)
                {
                    if (userr.Channelcompanyid == 0)//总公司账户
                    {
                        list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, out totalcount);
                    }
                    else //总公司下面渠道
                    {
                        list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, int.Parse(userr.Channelcompanyid.ToString()), out totalcount);
                    }


                    IEnumerable result     = "";
                    var         memcompany = new MemberChannelcompanyData();
                    if (list != null)
                    {
                        result = from pro in list
                                 select new
                        {
                            ID     = pro.ID,
                            CardID = MemberCardData.GetCardId(pro.CardID).Cardcode.ToString(),
                            //CardID =pro.CardID,
                            ACTID               = MemberActivityData.GetActById(pro.ACTID).Title.ToString(),
                            OrderId             = pro.OrderId,
                            ServerName          = pro.ServerName,
                            Sales_admin         = pro.Sales_admin,
                            Num_people          = pro.Num_people,
                            Usesubdate          = pro.Usesubdate,
                            Per_capita_money    = pro.Per_capita_money * pro.Num_people,
                            Member_return_money = pro.Member_return_money,
                            username            = B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode) == null ? "--" : B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode).Name.ToString(),
                            channel             = memcompany.UpCompanyById(MemberCardData.GetCardId(pro.CardID).Cardcode.ToString())
                        }
                    }
                    ;

                    return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
예제 #9
0
        public static string FindPass(string account, string phone, string findway)
        {
            string message;
            string content = "您账户密码重置成功,新密码:$pass$,请登陆后更改密码!";
            int    userid  = 0;

            if (findway == "")
            {
                findway = "sms";
            }

            //判断登录账户是否存在
            B2b_company_manageuser model2 = B2bCompanyManagerUserData.GetManageUserByAccount(account);

            if (model2 == null)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "账户与手机匹配错误!" }));
            }
            if (phone.Trim() == "")
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "手机信息错误!" }));
            }
            if (phone.Trim() != model2.Tel.Trim())
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "账户与手机匹配错误!" }));
            }

            if (findway == "sms")
            {
                //短信重置密码
                Random ra      = new Random();
                string newPass = ra.Next(26844521, 98946546).ToString();

                var uppass = B2bCompanyManagerUserData.ChangePwd(model2.Id, model2.Passwords, newPass, out message);

                if (uppass == 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "重置密码错误!" }));
                }

                content = content.Replace("$pass$", newPass);
                var backContent = SendSmsHelper.SendSms(phone, content, model2.Com_id, out message);
                if (backContent < 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "重置短信发送失败,请重新重置密码!" }));
                }
            }

            if (findway == "email")
            {
                //邮件重置密码连接
                //尚未做
            }



            return(JsonConvert.SerializeObject(new { type = 100, msg = "密码重置成功" }));
        }
예제 #10
0
        public int md_subscribenum = 0;         //门店关注总数
        protected void Page_Load(object sender, EventArgs e)
        {
            //图片上传 绑定控件
            headPortrait.uploadFileInfo.ObjType = (int)FileObjType.Photo;
            headPortrait.displayImgId           = "headPortraitImg";


            channelcompanytype = Request["channelcompanytype"].ConvertTo <string>("inner");

            int userid = UserHelper.CurrentUserId();

            IsParentCompanyUser = new B2bCompanyManagerUserData().IsParentCompanyUser(userid);
            if (IsParentCompanyUser == false)//如果是门市账户
            {
                B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userid);
                if (user != null)
                {
                    channelcompanyid = user.Channelcompanyid.ToString();
                }

                Member_Channel_company ccompay = new MemberChannelcompanyData().GetChannelCompany(channelcompanyid);
                if (ccompay != null)
                {
                    if (ccompay.Issuetype == 0)
                    {
                        channelcompanytype = "inner";
                    }
                    if (ccompay.Issuetype == 1)
                    {
                        channelcompanytype = "out";
                    }
                }
            }

            //根据登录公司显示门店关注总数
            md_subscribenum = new WxSubscribeDetailData().GetMd_Subscribenum(UserHelper.CurrentCompany.ID);

            isrun = Request["isrun"].ConvertTo <string>("1,0");
            if (!IsPostBack)
            {
                hid_key.Value = "";

                if (channelcompanytype == "inner") //如果是 所属门店/合作单位,则需要把总公司信息加上
                {
                    DataSet ds1 = GetHeadOffice(); //得到总公司信息
                    DataSet ds2 = GetAllTerms(channelcompanytype, channelcompanyid);
                    ds1.Merge(ds2, false, MissingSchemaAction.Ignore);
                    GridView2.DataSource = ds1;//获得 渠道单位 列表
                    GridView2.DataBind();
                }
                else
                {
                    GridView2.DataSource = GetAllTerms(channelcompanytype, channelcompanyid);//获得 渠道单位 列表
                    GridView2.DataBind();
                }
            }
        }
예제 #11
0
        public static string WhetherEditByIdJson(int actid, int operuserid)
        {
            Member_Activity model = new MemberActivityData().GetMemberActivityById(actid);

            if (model == null)
            {
                return(JsonConvert.SerializeObject(new { type = 100, msg = "获取优惠活动失败", data = "0" }));
            }
            else
            {
                //获得操作人信息
                B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(operuserid);
                if (user != null)
                {
                    if (model.Com_id == user.Com_id)
                    {
                        if (model.CreateUserId == 0)        //由于以前活动表中没有createuserid,所以createuserid=0认定为公司创建
                        {
                            if (user.Channelcompanyid == 0) //操作人属于公司,可以编辑活动
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "1" }));
                            }
                            else
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "0" }));
                            }
                        }
                        else
                        {
                            //判断创建人和现在的操作人是否属于同一单位(同一门市或者同一公司下)
                            bool whethersameunit = new MemberActivityData().WhetherSameunit(model.CreateUserId, user.Channelcompanyid);
                            if (whethersameunit)
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "1" }));
                            }
                            else
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "0" }));
                            }
                        }
                    }
                    else
                    {
                        return(JsonConvert.SerializeObject(new { type = 100, msg = "活动非本公司活动", data = "0" }));
                    }
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 100, msg = "获取操作人信息失败", data = "0" }));
                }
            }
        }
예제 #12
0
        public static string WhetherEditByIdStr(int actid, int operuserid)
        {
            Member_Activity model = new MemberActivityData().GetMemberActivityById(actid);

            if (model == null)
            {
                return("0");
            }
            else
            {
                //获得操作人信息
                B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(operuserid);
                if (user != null)
                {
                    if (model.Com_id == user.Com_id)
                    {
                        if (model.CreateUserId == 0)        //由于以前活动表中没有createuserid,所以createuserid=0认定为公司创建
                        {
                            if (user.Channelcompanyid == 0) //操作人属于公司,可以编辑活动
                            {
                                return("1");
                            }
                            else
                            {
                                return("0");
                            }
                        }
                        else
                        {
                            //判断创建人和现在的操作人是否属于同一单位(同一门市或者同一公司下)
                            bool whethersameunit = new MemberActivityData().WhetherSameunit(model.CreateUserId, user.Channelcompanyid);
                            if (whethersameunit)
                            {
                                return("1");
                            }
                            else
                            {
                                return("0");
                            }
                        }
                    }
                    else
                    {
                        return("0");
                    }
                }
                else
                {
                    return("0");
                }
            }
        }
예제 #13
0
        public int comid   = 0;//当前登录商家id
        protected void Page_Load(object sender, EventArgs e)
        {
            agentid = Request["agentid"].ConvertTo <int>(0);
            if (agentid == 0)
            {
                //Response.Redirect("AgentList.aspx");
            }

            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            comid = company.ID;
        }
예제 #14
0
        internal static string GetCompanyIdByUserId(string userid)
        {
            string companyid = "0";

            //判断用户是否是管理员,如是管理员,不对用户渠道公司限制
            Sys_Group sysgroup = new Sys_GroupData().GetGroupByUserId(int.Parse(userid));

            if (sysgroup.Groupid != 1)//不是管理员
            {
                //根据userid得到用户信息,如果用户没有渠道公司的分配,则显示全部门市
                B2b_company_manageuser muser = B2bCompanyManagerUserData.GetUser(int.Parse(userid));

                companyid = muser.Channelcompanyid.ToString();
            }
            return(companyid);
        }
예제 #15
0
 /// <summary>
 /// 添加或者编辑 By:Xiaoliu
 /// </summary>
 /// <param name="model">商家员工 实体</param>
 /// <returns>标识列</returns>
 public static int InsertOrUpdate(B2b_company_manageuser model)
 {
     using (var sql = new SqlHelper())
     {
         try
         {
             var internalData = new InternalB2bCompanyManageUser(sql);
             int result       = internalData.InsertOrUpdate(model);
             return(result);
         }
         catch
         {
             throw;
         }
     }
 }
예제 #16
0
        public string username         = "";//当前登录用户名
        protected void Page_Load(object sender, EventArgs e)
        {
            pno = Request["pno"].ConvertTo <string>("");
            validateticketlogid = Request["validateticketlogid"].ConvertTo <int>(0);

            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            comname = company.Scenic_name;

            B2bCompanyData datecom      = new B2bCompanyData();
            B2b_company    modledatecom = B2bCompanyData.GetAllComMsg(company.ID);

            printname = modledatecom.B2bcompanyinfo.Defaultprint;

            username = user.Accounts;
        }
예제 #17
0
        public int ishaslvyoubusproorder = 0;            //是否含有 旅游大巴产品订单
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserHelper.ValidateLogin())
            {
                int userid = UserHelper.CurrentUserId();
                IsParentCompanyUser = new B2bCompanyManagerUserData().IsParentCompanyUser(userid);
                if (IsParentCompanyUser == false)//如果是门市账户
                {
                    B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userid);
                    channelcompanyid = user.Channelcompanyid.ToString();
                }

                //ishaslvyoubusproorder = new B2bComProData().IsHasLvyoubusPro(UserHelper.CurrentCompany.ID, (int)ProductServer_Type.LvyouBus);

                ishaslvyoubusproorder = new B2bOrderData().IsHasLvyoubusProOrder(UserHelper.CurrentCompany.ID, (int)ProductServer_Type.LvyouBus);
            }
        }
예제 #18
0
 public string channelsource     = "0";  //渠道类型(0:内部门店;1:合作公司)
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         statistics = Request.QueryString["statistics"].ConvertTo <string>("");
         if (statistics == "")
         {
             Response.Write("<script>alert('渠道单位不存在');location.href='Channelstatistics.aspx'</script>");
         }
         int userid = UserHelper.CurrentUserId();
         IsParentCompanyUser = new B2bCompanyManagerUserData().IsParentCompanyUser(userid);
         if (IsParentCompanyUser == false)//如果是门市账户
         {
             B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(userid);
             channelsource = user.Channelsource.ToString();
         }
     }
 }
예제 #19
0
        public static string GetManageUserByAccount(string account)
        {
            try
            {
                B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetManageUserByAccount(account);
                if (manageruser == null)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "null" }));
                }
                else
                {
                    var list = new List <B2b_company_manageuser>();
                    list.Add(manageruser);

                    IEnumerable result = "";
                    if (list != null)
                    {
                        result = from model in list
                                 select new
                        {
                            Accounts           = model.Accounts,
                            PassWord           = model.Passwords,
                            MasterId           = model.Id,
                            MasterName         = model.Employeename,
                            CompanyName        = B2bCompanyData.GetCompanyByUid(model.Id).Com_name,
                            Tel                = model.Tel,
                            GroupNames         = new Sys_MasterGroupData().GetGroupNameStrByMasterId(model.Id),
                            GroupIds           = new Sys_MasterGroupData().GetGroupIdStrByMasterId(model.Id),
                            ChannelCompanyId   = model.Channelcompanyid,
                            ChannelCompanyName = model.Channelcompanyid == 0 ? "全部渠道" : new MemberChannelcompanyData().GetCompanyById(model.Channelcompanyid.ToString().ConvertTo <int>(0)).Companyname,
                            Channelsource      = model.Channelsource
                        }
                    }
                    ;


                    return(JsonConvert.SerializeObject(new { type = 100, msg = result }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
            }
        }
예제 #20
0
 public static string GetManageUserInfo(int userid)
 {
     try
     {
         B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(userid);
         if (manageruser == null)
         {
             return(JsonConvert.SerializeObject(new { type = 1, msg = "null" }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new { type = 100, msg = manageruser }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
     }
 }
예제 #21
0
        //设定员工所在分组
        public static bool SetMasterGroup(string masterid, string groupname, out string msg)
        {
            B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(int.Parse(masterid));

            if (user == null)
            {
                msg = "账户信息获取为空";
                return(false);
            }
            else
            {
                string mastername = user.Employeename;

                Sys_Group group = new Sys_GroupData().GetGroupByName(groupname.Trim());
                if (group == null)
                {
                    msg = "管理组获取为空";
                    return(false);
                }
                else
                {
                    string   grouparr         = group.Groupid.ToString();
                    int      createmasterid   = 0;
                    string   createmastername = "开户后系统自动创建";
                    DateTime createdate       = DateTime.Now;

                    int count = new Sys_MasterGroupData().EditMasterGroup(masterid, mastername, grouparr, createmasterid, createmastername, createdate);

                    if (count > 0)
                    {
                        msg = "";
                        return(true);
                    }
                    else
                    {
                        msg = "设定账户权限失败";
                        return(false);
                    }
                }
            }
        }
예제 #22
0
        public static bool ValidateLogin(int userid = 0)
        {
            var identity = HttpContext.Current.User.Identity;

            if (!identity.IsAuthenticated)
            {
                return(false);
            }

            if (userid == 0)
            {
                userid = int.Parse(identity.Name);
            }
            B2b_company_manageuser userinfo = B2bCompanyManagerUserData.GetUser(userid);

            if (userinfo == null || userinfo.Id != userid || !VerifyToken(userid))
            {
                return(false);
            }
            return(true);
        }
예제 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            projectid = Request["projectid"].ConvertTo <int>(0);
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            comid = company.ID;

            if (projectid == 0)
            {
            }
            else
            {
                var projectdata = new B2b_com_projectData();
                var projectinfo = projectdata.GetProject(projectid, comid);
                if (projectinfo != null)
                {
                    projectname = projectinfo.Projectname;
                }
            }
        }
예제 #24
0
        public static string GetCrmStatistics(int comid, int userid)
        {
            try
            {
                B2b_company_manageuser userr = B2bCompanyManagerUserData.GetUser(userid);
                if (userr != null)
                {
                    DataTable dt = new B2bCrmData().GetCrmStatistics(comid, int.Parse(userr.Channelcompanyid.ToString()));
                    return(JsonConvert.SerializeObject(new { type = 100, msg = dt }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
예제 #25
0
        public static string EditStaff(B2b_company_manageuser manageruser)
        {
            try
            {
                //if (manageruser.Id!=0)
                //{
                //    B2b_company_manageuser manageruser2 = B2bCompanyManagerUserData.GetUser(manageruser.Id);
                //    if (manageruser.Passwords != manageruser2.Passwords)
                //    {
                //        return JsonConvert.SerializeObject(new { type = 1, msg = "原密码与新密码不符,请刷新页面后重新编辑" });
                //    }
                //}

                var id = B2bCompanyManagerUserData.InsertOrUpdate(manageruser);

                return(JsonConvert.SerializeObject(new { type = 100, msg = id }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
예제 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            comid  = company.ID;//获取登陆账户公司id
            userid = user.Id.ToString();
            if (comid == 0)
            {
                Response.Redirect("/");//如果没有COMID 返回 首页
            }


            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company modlecom = B2bCompanyData.GetAllComMsg(comid);
                if (modlecom != null)
                {
                    Com_name       = modlecom.Com_name;
                    txtServiceInfo = modlecom.B2bcompanyinfo.Serviceinfo;
                    Scenic_name    = modlecom.Scenic_name;
                    scenic_address = modlecom.B2bcompanyinfo.Scenic_address;
                    coordinate     = modlecom.B2bcompanyinfo.Coordinate;
                    coordinatesize = modlecom.B2bcompanyinfo.Coordinatesize;
                    weixinimg      = modlecom.B2bcompanyinfo.Weixinimg;
                    weixinname     = modlecom.B2bcompanyinfo.Weixinname;
                    Qq             = modlecom.B2bcompanyinfo.Qq;
                }

                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                    Copyright = pro.Copyright;
                    Tel       = pro.Service_Phone;
                }



                //读取首页栏目,只读取前10个栏目,太多影响打开
                //var shopmenudata = new B2bCompanyMenuData();
                //menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1);
                //if (menulist != null)
                //{
                //    for (int i = 0; i < menutotalcount; i++)
                //    {
                //        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                //    }
                //}

                //如果没有栏目读取项目
                if (menutotalcount == 0)
                {
                    var prodata = new B2b_com_projectData();
                    projectlist = prodata.Projectpagelist(comid.ToString(), 1, 20, "1", out porjectcount, "", 1);
                }
            }
        }
예제 #27
0
        private void GetUser()
        {
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "004");

            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            atypee  = user.Atype;
            userid  = user.Id;
            comid   = company.ID;
            comname = company.Com_name;



            //根据comid得到公司logo信息
            B2b_company_saleset logoset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (logoset != null)
            {
                int logo_temp = 0;

                if (logoset.Logo != "")
                {
                    logo_temp = int.Parse(logoset.Logo);
                }

                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(logo_temp);
                if (identityFileUpload != null)
                {
                    comlogo = fileUrl + identityFileUpload.Relativepath;
                }
            }
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "005");

            username = user.Accounts;
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid);

            if (companyinfo.B2bcompanyinfo.Domainname != "")
            {
                companydo = "http://" + companyinfo.B2bcompanyinfo.Domainname;
            }
            else
            {
                companydo = "http://shop" + company.ID + ".etown.cn";
            }

            //根据userid得到用户信息,如果用户没有渠道公司的分配,则显示全部门市
            B2b_company_manageuser muser = B2bCompanyManagerUserData.GetUser(UserHelper.CurrentUserId());

            if (muser != null)
            {
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "006");
                Sys_Group gg = new Sys_GroupData().GetGroupByUserId(muser.Id);
                if (gg == null)
                {
                    //Response.Write("<script>alert('用户尚未分配角色,请联系管理员!');location.href='/Manage/index1.html'</script>");
                }
                else
                {
                    iscanverify = gg.Iscanverify;
                    groupname   = gg.Groupname;
                    groupid     = gg.Groupid;
                }
            }
        }
예제 #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserHelper.ValidateLogin())
            {
                comid = UserHelper.CurrentCompany.ID;
            }

            projectid = Request["projectid"].ConvertTo <int>(0);

            nowdate   = DateTime.Now.ToString("yyyy-MM-dd");
            monthdate = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd");

            proid = Request["proid"].ConvertTo <int>(0);

            servertype = Request["servertype"].ConvertTo <int>(1);

            if (proid > 0)
            {
                int bindingid = new B2bComProData().GetbindingidbyProid(proid);
                if (bindingid > 0)
                {
                    new B2bComProData().Getsalenum(bindingid, out limitbuytotalnum, out buynum);
                }
                else
                {
                    new B2bComProData().Getsalenum(proid, out limitbuytotalnum, out buynum);
                }
            }

            //产品主图片
            BindHeadPortrait(proid);
            ShowImgBind(proid);

            //产品子级图片(多图片)上传
            BindChildImg(proid);


            //获取所属行业
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;
            var comdata = B2bCompanyData.GetCompany(company.ID);

            if (comdata != null)
            {
                industryid = comdata.Com_type;
            }

            //判断公司是否含有项目,不含有的话,添加默认项目
            int count = new B2b_com_projectData().GetProjectCountByComId(company.ID);

            if (count == 0)
            {
                B2b_company_info    companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID);
                B2b_company_saleset saleset     = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString());

                B2b_com_project model = new B2b_com_project()
                {
                    Id               = 0,
                    Projectname      = company.Com_name,
                    Projectimg       = saleset.Logo.ConvertTo <int>(0),
                    Province         = companyinfo.Province.ConvertTo <string>(""),
                    City             = companyinfo.City,
                    Industryid       = company.Com_type,
                    Briefintroduce   = companyinfo.Scenic_intro,
                    Address          = companyinfo.Scenic_address,
                    Mobile           = companyinfo.Tel,
                    Coordinate       = "",
                    Serviceintroduce = companyinfo.Serviceinfo,
                    Onlinestate      = "1",
                    Comid            = company.ID,
                    Createtime       = DateTime.Now,
                    Createuserid     = 0
                };
                int result = new B2b_com_projectData().EditProject(model);

                //设置公司下产品的项目id都改为默认项目id
                int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result);
            }
        }
예제 #29
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid      = Request["uid"].ConvertTo <int>(0);
            MasterId = Request["MasterId"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            id       = Request["id"].ConvertTo <int>(0);
            nowdate  = DateTime.Now.ToString("yyyy-MM-dd");
            nowtoday = DateTime.Now;

            buyuid  = Request["buyuid"].ConvertTo <int>(0);
            tocomid = Request["tocomid"].ConvertTo <int>(0);



            //获取随机用户ID


            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }


            if (id != 0)
            {
                B2b_com_pro pro = new B2bComProData().GetProById(id.ToString());
                if (pro != null)
                {
                    channelcoachid = new MemberChannelData().GetChannelidbymanageuserid(MasterId, pro.Com_id);
                    if (pro.Server_type == 13)
                    {
                        //如果 产品为教练产品
                        if (channelcoachid == 0)
                        {
                            //当未选择教练 则 跳转到教练页面
                            Response.Redirect("/h5/coachList.aspx?come=" + id);
                        }
                    }

                    Ispanicbuy       = pro.Ispanicbuy;       //是否抢购或限购
                    Limitbuytotalnum = pro.Limitbuytotalnum; //限购数量
                    bindname         = pro.bookpro_bindname;
                    bindphone        = pro.bookpro_bindphone;
                    manyspeci        = pro.Manyspeci;
                    Wrentserver      = pro.Wrentserver;
                    //如果多规格读取规格
                    if (manyspeci == 1)
                    {
                        gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id);
                    }


                    //对默认只显示预约电话进行
                    if (pro.Server_type == 12 || pro.Server_type == 13)
                    {
                        //当时预约产品就先设定显示预约电话
                        view_phone = 1;

                        //先判断渠道来路,如果没有渠道则安默认,如果有来路渠道,则显示来路渠道
                        if (MasterId != 0)
                        {
                            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);
                            if (manageruser != null)
                            {
                                bindname  = manageruser.Employeename;
                                bindphone = manageruser.Tel;
                            }
                        }


                        //判断 绑定渠道电话 与 访问来的渠道电话相同 则 显示电话,并显示预订
                        if (bindphone == pro.bookpro_bindphone)
                        {
                            view_phone = 2;
                        }

                        //如果为教练产品,显示订购和 和图像 不显示电话
                        if (pro.Server_type == 13)
                        {
                            view_phone = 3;
                        }
                    }


                    //通过 显示渠道的电话 来查找头像


                    B2b_company_manageuser manageruser_temp = new B2bCompanyManagerUserData().GetCompanyUserByPhone(bindphone, pro.Com_id);
                    if (manageruser_temp != null)
                    {
                        channleimg = FileSerivce.GetImgUrl(manageruser_temp.Headimg);
                        if (channleimg == "/Images/defaultThumb.png")
                        {
                            channleimg = "";
                        }
                    }



                    //查询相关项目名称
                    var proprojectdata = new B2b_com_projectData();

                    var proprejectinfo = proprojectdata.GetProject(pro.Projectid, pro.Com_id);
                    if (proprejectinfo != null)
                    {
                        projectname = proprejectinfo.Projectname;
                        Coordinate  = proprejectinfo.Coordinate;
                        Address     = proprejectinfo.Address;
                    }

                    projectname = proprojectdata.GetProjectNameByid(pro.Projectid);



                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Com_id);
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            //appId = model.Wx_appid;
                            //appsecret = model.Wx_appkey;
                            //appkey = model.Wx_paysignkey;
                            //mchid = model.Wx_partnerid;
                            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                            issetfinancepaytype = true;
                        }
                    }



                    //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作
                    if (pro_servertype == 1)
                    {
                        if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2)
                        {
                            int rs = new B2bComProData().CancelOvertimeOrder(pro);
                        }
                    }

                    iscanbook      = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                    pro_servertype = pro.Server_type;
                    pickuppoint    = pro.pickuppoint;
                    dropoffpoint   = pro.dropoffpoint;


                    childreduce = pro.Childreduce;

                    if (pro.Ispanicbuy == 1)
                    {
                        panic_begintime  = pro.Panic_begintime;
                        panicbuy_endtime = pro.Panicbuy_endtime;


                        TimeSpan tss = pro.Panic_begintime - nowtoday;
                        var      day = tss.Days * 24 * 3600;; //这是相差的天数
                        var      h   = tss.Hours * 3600;      //这是相差的小时数,
                        var      m   = tss.Minutes * 60;
                        var      s   = tss.Seconds;
                        shijiacha = day + h + m + s;
                    }
                    projectid        = pro.Projectid;
                    comid            = pro.Com_id;
                    pro_name         = pro.Pro_name;
                    price            = pro.Advise_price;
                    face_price       = pro.Face_price;
                    limitbuytotalnum = pro.Limitbuytotalnum;
                    imgurl           = FileSerivce.GetImgUrl(pro.Imgurl);

                    //如果含有规格读取规格价格中最低价
                    if (manyspeci == 1)
                    {
                        if (gglist != null)
                        {
                            price      = 0;
                            face_price = 0;
                            for (int i = 0; i < gglist.Count(); i++)
                            {
                                if (gglist[i].speci_advise_price != 0)
                                {
                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                            }
                        }
                    }



                    if (price == 0)
                    {
                        price = 0;
                    }
                    else
                    {
                        CommonFunc.OperTwoDecimal(price.ToString());
                        //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                    }

                    if (face_price != 0)
                    {
                        CommonFunc.OperTwoDecimal(face_price.ToString());
                    }


                    nowdate = DateTime.Now.ToString("yyyy-MM-dd");


                    if (pro.Service_Contain != "")
                    {
                        sumaryend = pro.Service_Contain;
                    }

                    if (pro.Service_NotContain != "")
                    {
                        sumaryend = sumaryend + "</br> " + pro.Service_NotContain;
                    }

                    if (pro.Precautions != "")
                    {
                        sumaryend = sumaryend + "</br> " + pro.Precautions;
                    }

                    Server_type = pro.Server_type;

                    bookpro_ispay = pro.bookpro_ispay;

                    //如果服务类型是 票务;  则备注信息中 显示 电子码使用限制
                    if (pro.Server_type == 1)
                    {
                        if (pro.Iscanuseonsameday == 0)//电子码当天不可用
                        {
                            youxianshiduan = "此产品当天预订不可用";
                        }
                        if (pro.Iscanuseonsameday == 1)//电子码当天可用
                        {
                            youxianshiduan = "此产品当天预订可用";
                        }
                        if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用
                        {
                            youxianshiduan = "此产品出票2小时内不可用";
                        }
                    }

                    remark  = pro.Pro_Remark;
                    pro_num = pro.Pro_number;
                    if (pro_num == 0)
                    {
                        pro_max = 100;
                        pro_min = 1;
                    }
                    else
                    {
                        pro_min = 1;
                        pro_max = pro_num;
                    }
                    pro_explain = pro.Pro_explain;



                    #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到)
                    provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期
                    appointdate       = pro.Appointdata;       //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年
                    iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用

                    pro_end     = pro.Pro_end;
                    pro_end_str = pro.Pro_end.AddMonths(-1).ToString("yyyy,MM,dd");
                    //返回有效期
                    pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday);

                    #endregion


                    //如果是 教练产品 根据教练信息 获取教练 上班时间

                    if (pro.Server_type == 13 || pro.Server_type == 12)
                    {                      //必须是教练产品
                        if (MasterId != 0) //必须有教练参数
                        {
                            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);
                            if (manageruser != null)
                            {
                                if (manageruser.Workdays != "")
                                {
                                    if (manageruser.worktimestar != 0)
                                    {
                                        if (manageruser.worktimestar < manageruser.worktimeend)
                                        {
                                            for (var i = manageruser.worktimestar; i < manageruser.worktimeend; i++)
                                            {
                                                workh += "<option value=\"" + i + "\">" + i + "点</option>";
                                            }
                                        }
                                        else
                                        {
                                            var day1 = 24 - manageruser.worktimestar;
                                            var day2 = manageruser.worktimeend;
                                            var day3 = day1 + day2;

                                            for (var i = 0; i > day3; i++)
                                            {
                                                if (i > day1)
                                                {
                                                    workh += "<option value=\"" + (manageruser.worktimestar + i) + "\">" + (manageruser.worktimestar + i) + "点</option>";
                                                }
                                                else
                                                {
                                                    workh += "<option value=\"" + (manageruser.worktimestar - i) + "\">" + (manageruser.worktimestar - i) + "点</option>";
                                                }
                                            }
                                        }
                                    }



                                    if (!manageruser.Workdays.Contains("2"))                                              //检验不含周一
                                    {
                                        DateTime dt        = DateTime.Now;                                                //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }

                                    if (!manageruser.Workdays.Contains("3"))                                                         //检验不含周二
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(1); //本周周二

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("4"))                                                         //检验不含周3
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(2); //本周周3

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("5"))                                                         //检验不含周4
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(3); //本周周4

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("6"))                                                         //检验不含周5
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(4); //本周周5


                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("7"))                                                         //检验不含周6
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(5); //本周周6

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("1"))                                                         //检验不含周日
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(6); //本周周日


                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }



                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }


                var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }

                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }



            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var wxdomain = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl);
                if (wxdomain != null)
                {
                    comid = wxdomain.Comid;
                }
            }
            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }



            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }


            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
        private void GetUser()
        {
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            atypee  = user.Atype;
            userid  = user.Id;
            comid   = company.ID;
            comname = company.Com_name;

            //判断页面是否在权限页面链接中:没有,不做处理;有,判断角色是否可以访问此页面
            bool isactionurl = new Sys_ActionData().Isactionurl(Requestfile);

            if (isactionurl)
            {
                bool iscanvisit = new Sys_ActionData().Iscanvisit(Requestfile, userid);
                if (iscanvisit == false)
                {
                    //Response.Redirect("/manage.aspx");
                    Response.Write("<script>window.location.href='/manage.aspx'</script>");
                }
            }



            //根据comid得到公司logo信息
            B2b_company_saleset logoset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (logoset != null)
            {
                int logo_temp = 0;

                if (logoset.Logo != "")
                {
                    logo_temp = int.Parse(logoset.Logo);
                }

                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(logo_temp);
                if (identityFileUpload != null)
                {
                    comlogo = fileUrl + identityFileUpload.Relativepath;
                }
            }

            username = user.Accounts;
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid);

            if (companyinfo.B2bcompanyinfo.Domainname != "")
            {
                companydo = "http://" + companyinfo.B2bcompanyinfo.Domainname;
            }
            else
            {
                companydo = "http://shop" + company.ID + ".etown.cn";
            }

            //根据userid得到用户信息,如果用户没有渠道公司的分配,则显示全部门市
            B2b_company_manageuser muser = B2bCompanyManagerUserData.GetUser(UserHelper.CurrentUserId());

            if (muser != null)
            {
                //控制只有平台总账户才可以进入/ui/permissionui目录
                if (Requestfile.Contains("/ui/permissionui"))
                {
                    if (muser.Id != 1035)
                    {
                        Response.Redirect("http://shop.etown.cn");
                    }
                }

                Sys_Group gg = new Sys_GroupData().GetGroupByUserId(muser.Id);
                if (gg == null)
                {
                    //Response.Write("<script>alert('用户尚未分配角色,请联系管理员!');location.href='/Manage/index1.html'</script>");
                }
                else
                {
                    iscanverify = gg.Iscanverify;
                    groupname   = gg.Groupname;
                    groupid     = gg.Groupid;
                }
            }



            //根据不同用户显示不同的左侧栏
            int totalcount = 0;
            List <Sys_ActionColumn> topList = new Sys_ActionColumnData().GetActionColumnByUser(UserHelper.CurrentUserId(), out totalcount);


            rptTopMenuList.DataSource = topList;
            rptTopMenuList.DataBind();

            foreach (RepeaterItem item in rptTopMenuList.Items)
            {
                int funcId = (item.FindControl("HideFuncId") as HiddenField).Value.ConvertTo <int>();

                int totalaction = 0;
                var menuList    = new Sys_ActionData().GetActionsByColumnId(UserHelper.CurrentUserId(), funcId, out totalaction);

                Repeater rptMenuList = item.FindControl("rptMenuList") as Repeater;
                rptMenuList.DataSource = menuList;
                rptMenuList.DataBind();
            }
        }