Exemplo n.º 1
0
        /// <summary>
        /// 在一个action被执行前调用
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            int productid = 1;
            BaseController control = filterContext.Controller as BaseController;

            //跳过对/Base/的任何检查
            if (control != null && control.GetType() == typeof(BaseController))
            {
                base.OnActionExecuting(filterContext);
                return;
            }

            string LoginIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] as string;
            //用户权限较验
            CRMService crm = new CRMService();

            //获得当前用户的登陆信息
            CookieUserInfo cui = MembershipService.GetUserCookie();
            //CookieUserInfo cui = new CookieUserInfo() { UserID = "1", UserName = "******", LoginGuid = Guid.NewGuid().ToString() };
            Int32? userid = null;
            if (cui != null)
            {
                userid = Convert.ToInt32(cui.UserID);
                Hashtable counthtparm = new Hashtable();
                counthtparm["UserID"] = userid.Value;
                counthtparm["LoginIP"] = LoginIP;
                int countIP = CRMMapper.Get().QueryForObject<int>("BlackIP.MyFind", counthtparm);
                if (countIP != 0)
                {
                    filterContext.Result = new RedirectResult("/Base/IPError.mvc");
                }
            }
            else
            {
                userid = -1;
                Hashtable counthtparm = new Hashtable();
                counthtparm["UserID"] = userid.Value;
                counthtparm["LoginIP"] = LoginIP;
                int countIP = CRMMapper.Get().QueryForObject<int>("BlackIP.MyFind", counthtparm);
                if (countIP != 0)
                {
                    filterContext.Result = new RedirectResult("/Base/IPError.mvc");
                }
            }

            //用户ip使用次数校验
            int count = 0;
            int times = 30;
            Hashtable htparm = new Hashtable();
            if (userid != null)
                htparm["UserID"] = userid.Value;
            else
                htparm["UserID"] = -1;
            htparm["LoginIP"] = LoginIP;
            htparm["Now"] = DateTime.Now;
            htparm["Last"] = DateTime.Now.AddMinutes(-1);
            count = CRMMapper.Get().QueryForObject<Int32>("UserLogin.Total", htparm);
            if (count < times)
            {
                UserLogin userlogin = new UserLogin();
                if (userid != null)
                    userlogin.UserID = userid.Value;
                else
                    userlogin.UserID = -1;
                userlogin.LoginIP = LoginIP;
                userlogin.LoginTime = DateTime.Now;
                userlogin.FuntionCode = control.functionCode();
                userlogin.URL = HttpContext.Current.Request.Url.PathAndQuery;
                new UserLoginDao().Insert(userlogin);

            }
            else
            {
                BlackIP bIP = new BlackIP();
                bIP.LogIP = LoginIP;
                bIP.UserID = userid.Value;
                bIP.BlackTime = DateTime.Now;
                new BlackIPDao().Insert(bIP);
                filterContext.Result = new RedirectResult("/Base/IPError.mvc");
            }
            //检验是否是重复登录
            if (userid != null)
            {
                string url = HttpContext.Current.Request.Url.PathAndQuery;
                UserLoginGuidService ulgs = new UserLoginGuidService();
                UserLoginGuid ulg = ulgs.selectbyuserid(userid.Value);
                if (ulg != null)
                {
                    if (ulg.LoginGuid != cui.LoginGuid)
                    {
                        UserModel olduser = new MembershipUserService().GetUserName(Int32.Parse(cui.UserID));
                        DateTime oldtime = olduser.LastLoginDate;
                        string oldip = olduser.LastLoginIp;
                        if (oldtime.AddMinutes(30) < DateTime.Now || oldip == LoginIP)
                            filterContext.Result = new RedirectResult("/Base/MutiLogin.mvc?Url=" + url);
                        else
                        {
                            int t = 30 - (DateTime.Now - oldtime).Minutes;
                            filterContext.Result = new RedirectResult("/Base/LessTime.mvc?t=" + t);
                        }
                    }
                }
            }
            int helptopic = 0;
            EnumPrivilegeCheckResult checkresult = crm.UserPrivilegeCheck(control.ProductID, control.functionCode(), userid, out helptopic);

            //处理验证结果
            switch (checkresult)
            {
                case EnumPrivilegeCheckResult.未登陆失败:
                    filterContext.Result = new RedirectResult("/Base/NotLogin.mvc");
                    return;

                case EnumPrivilegeCheckResult.非会员失败:
                    filterContext.Result = new RedirectResult("/Base/NotMember.mvc/" + helptopic);
                    return;

                case EnumPrivilegeCheckResult.会员等级不足失败:
                    filterContext.Result = new RedirectResult("/Base/MemberLevelError.mvc/" + helptopic);
                    return;

                case EnumPrivilegeCheckResult.未购买产品失败:
                    filterContext.Result = new RedirectResult("/Base/NotBuyer.mvc/" + helptopic);
                    return;
                case EnumPrivilegeCheckResult.试用账号超过次数上限:
                    filterContext.Result = new RedirectResult("/Base/TryError.mvc");
                    return;

            }
            //如果是子账户,检查是否有相应权限
            if (userid != null && new MemberUserInfoDao().Find((int)userid) != null)
            {
                int uid = (int)userid;
                bool IsAdmin = new MemberUserInfoDao().IsAdmin(uid);
                if (!IsAdmin)//如果是子账户
                {
                    //找到子账户的functionlist
                    string functionlist = FindFunctionlist(uid, productid);
                    List<string> codelist = new List<string>();
                    if (functionlist != null)
                    {
                        string[] list = functionlist.Split(',');
                        //再找到相应的functioncode

                        foreach (string str in list)
                        {
                            if (str.Trim().ToLower() != "on")
                            {
                                codelist.Add(new ProductFunctionDao().Find(Int32.Parse(str)).FunctionCode);
                            }
                        }
                    }
                    codelist.Add("IndexPage");//首页都有
                    //如果当前code不在列表中则失败
                    if (!codelist.Contains(control.functionCode()))
                    {
                        filterContext.Result = new RedirectResult("/Base/NotAdmin.mvc");
                    }
                }
            }
            //通过检杳,允许访问
            base.OnActionExecuting(filterContext);
        }
Exemplo n.º 2
0
        public ActionResult Qualification(FormCollection collection)
        {
            //all files
            /*foreach (string filename in Request.Files)
            {
                HttpPostedFileBase hfile = Request.Files[filename];
                System.IO.FileInfo findo = new System.IO.FileInfo(hfile.FileName);

                hfile.SaveAs("C:\\" + findo.Name );
            }*/

            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;
            if (CurrentUserInfo != null)
            {
                int userid = Int32.Parse(CurrentUserInfo.UserID);
                MemberUserInfo member = new MemberUserInfo();
                member = new MemberUserInfoDao().Find(userid);

                IDictionary result = CRMMapper.Get().QueryForObject<IDictionary>("EnterpriseTotalInfo.MyFind", member.MemberID);
                IList<IDictionary> GMPresult = CRMMapper.Get().QueryForList<IDictionary>("GMPCerts.MyFind", member.MemberID);
                IList<IDictionary> Techresult = CRMMapper.Get().QueryForList<IDictionary>("TechCerts.MyFind", member.MemberID);
                string HtmlGMP = string.Empty;
                int GMPCount = 0;
                foreach (IDictionary gmp in GMPresult)
                {
                    GMPCount++;
                    string temp = string.Empty;
                    string temp1 = string.Empty;
                    if (gmp["GMPCertStarting"] != null)
                        temp = ((DateTime)gmp["GMPCertStarting"]).Date.ToString();
                    if (gmp["GMPCertTime"] != null)
                        temp1 = ((DateTime)gmp["GMPCertTime"]).Date.ToString();
                    HtmlGMP += "<tr class=\"GMP" + GMPCount + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + GMPCount + "号码:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"GMPCertNo"+GMPCount+ "\" type=\"text\" class=\"kuang GMPCertNo\" size=\"40\" value=\""+gmp["GMPCertNo"]+"\"/></span><span class='view STYLE3'>*</span></td></tr>"
                           + "<tr class=\"GMP" + GMPCount + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + GMPCount + "认证范围:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"GMPCertRange" + GMPCount + "\" type=\"text\" class=\"kuang\" size=\"40\" value=\""+gmp["GMPCertRange"]+"\"/></span></td></tr>"
                           + "<tr class=\"GMP" + GMPCount + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + GMPCount + "发证时间:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"GMPCertStarting" + GMPCount + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp + "\"/></span></td></tr>"
                           + "<tr class=\"GMP" + GMPCount + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + GMPCount + "有效期:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                           + "<input name=\"GMPCertTime" + GMPCount + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp1+ "\"/></span></td></tr>";

                }
                string HtmlTech = string.Empty;
                int TechCount = 0;
                foreach (IDictionary gmp in Techresult)
                {
                    TechCount++;
                    string temp=string.Empty;
                    string temp1 = string.Empty;
                    if (gmp["TechCertStarting"] != null)
                        temp=((DateTime)gmp["TechCertStarting"]).Date.ToString();
                    if (gmp["TechCertTime"] != null)
                        temp1 = ((DateTime)gmp["TechCertTime"]).Date.ToString();

                    HtmlTech += "<tr class=\"Tech" + TechCount + "\"><td height=\"25\" align=\"right\" class=\"view\">高新技术企业证书" + TechCount + "号码:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"TechCertNo" + TechCount + "\" type=\"text\" class=\"kuang TechCertNo\" size=\"40\" value=\"" + gmp["TechCertNo"] + "\"/></span><span class='view STYLE3'>*</span></td></tr>"
                           + "<tr class=\"Tech" + TechCount + "\"><td height=\"25\" align=\"right\" class=\"view\">高新技术企业证书" + TechCount + "发证时间:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"TechCertStarting" + TechCount + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp + "\"/></span></td></tr>"
                           + "<tr class=\"Tech" + TechCount + "\"><td height=\"25\" align=\"right\" class=\"view\">高新技术企业证书" + TechCount + "有效期:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"TechCertTime" + TechCount + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp1 + "\"/></span></td></tr>";

                }
                if (collection.Count == 0)
                {
                    ViewData["Result"] = result;
                    ViewData["GMPResult"] = HtmlGMP;
                    ViewData["GMPCount"] = GMPCount;
                    ViewData["TechResult"] = HtmlTech;
                    ViewData["TechCount"] = TechCount;
                }
                else
                {
                    bool IsSuccess = true;
                    Hashtable htparm = new Hashtable();
                    IDictionary form = new Dictionary<string, string>();
                    int TotalGMPCount = 0;
                    int TotalTechCount = 0;
                    foreach(string key in collection.AllKeys)
                    {
                        htparm[key] = collection[key];
                        form[key] = collection[key];
                        if (key.IndexOf("GMPCertNo")!=-1 && ((string)htparm[key]) != "")
                            TotalGMPCount++;
                        if (key.IndexOf("TechCertNo")!=-1 && ((string)htparm[key]) != "")
                            TotalTechCount++;
                    }
                    htparm["MemberID"] = member.MemberID;
                    int memberid = new MemberUserInfoDao().Find(userid).MemberID;

                    if (result != null)
                    {
                        try
                        {
                            //update

                            CRMMapper.Get().Update("EnterpriseTotalInfo.MyUpdate", htparm);

                            if (GMPCount > TotalGMPCount)
                            {
                                Hashtable ht = new Hashtable();
                                ht["num"] = GMPCount - TotalGMPCount;
                                ht["Memberid"] = memberid;
                                CRMMapper.Get().Delete("GMPCerts.MyDelete", ht);
                                for (int i = 1; i <= TotalGMPCount; i++)
                                {
                                    htparm["GMPCertNo"] = collection["GMPCertNo" + i];
                                    htparm["GMPCertRange"] = collection["GMPCertRange" + i];
                                    htparm["GMPCertStarting"] = collection["GMPCertStarting" + i];
                                    htparm["GMPCertTime"] = collection["GMPCertTime" + i];
                                    htparm["Memberid"] = memberid;
                                    CRMMapper.Get().Update("GMPCerts.MyUpdate", htparm);
                                }
                            }
                            else
                            {
                                for (int i = 1; i <= GMPCount; i++)
                                {
                                    htparm["GMPCertNo"] = collection["GMPCertNo" + i];
                                    htparm["GMPCertRange"] = collection["GMPCertRange" + i];
                                    htparm["GMPCertStarting"] = collection["GMPCertStarting" + i];
                                    htparm["GMPCertTime"] = collection["GMPCertTime" + i];
                                    htparm["Memberid"] = memberid;
                                    CRMMapper.Get().Update("GMPCerts.MyUpdate", htparm);
                                }
                                for (int j = GMPCount + 1; j <= TotalGMPCount; j++)
                                {
                                    htparm["GMPCertNo"] = collection["GMPCertNo" + j];
                                    htparm["GMPCertRange"] = collection["GMPCertRange" + j];
                                    htparm["GMPCertStarting"] = collection["GMPCertStarting" + j];
                                    htparm["GMPCertTime"] = collection["GMPCertTime" + j];
                                    htparm["Memberid"] = memberid;
                                    CRMMapper.Get().Insert("GMPCerts.MyInsert", htparm);
                                }
                            }
                            if (TechCount > TotalTechCount)
                            {
                                Hashtable ht = new Hashtable();
                                ht["num"] = TechCount - TotalTechCount;
                                ht["Memberid"] = memberid;
                                CRMMapper.Get().Delete("TechCerts.MyDelete", ht);
                                for (int i = 1; i <= TotalTechCount; i++)
                                {
                                    htparm["TechCertNo"] = collection["TechCertNo" + i];
                                    htparm["TechCertStarting"] = collection["TechCertStarting" + i];
                                    htparm["TechCertTime"] = collection["TechCertTime" + i];
                                    htparm["Memberid"] = memberid;
                                    CRMMapper.Get().Update("TechCerts.MyUpdate", htparm);
                                }
                            }
                            else
                            {
                                for (int i = 1; i <= TechCount; i++)
                                {
                                    htparm["TechCertNo"] = collection["TechCertNo" + i];
                                    htparm["TechCertStarting"] = collection["TechCertStarting" + i];
                                    htparm["TechCertTime"] = collection["TechCertTime" + i];
                                    htparm["Memberid"] = memberid;
                                    CRMMapper.Get().Update("TechCerts.MyUpdate", htparm);
                                }
                                for (int j = TechCount + 1; j <= TotalTechCount; j++)
                                {
                                    htparm["TechCertNo"] = collection["TechCertNo" + j];
                                    htparm["TechCertStarting"] = collection["TechCertStarting" + j];
                                    htparm["TechCertTime"] = collection["TechCertTime" + j];
                                    htparm["Memberid"] = memberid;
                                    CRMMapper.Get().Insert("TechCerts.MyInsert", htparm);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            string hh = ex.Message;
                            IsSuccess = false;
                        }
                        //IsSuccess=true;
                    }
                    else
                    {
                        try
                        {
                            //Insert
                            CRMMapper.Get().Insert("EnterpriseTotalInfo.MyInsert", htparm);
                            for (int i = 1; i <= TotalGMPCount; i++)
                            {
                                htparm["GMPCertNo"] = collection["GMPCertNo" + i];
                                htparm["GMPCertRange"] = collection["GMPCertRange" + i];
                                htparm["GMPCertStarting"] = collection["GMPCertStarting" + i];
                                htparm["GMPCertTime"] = collection["GMPCertTime" + i];
                                htparm["Memberid"] = memberid;
                                CRMMapper.Get().Insert("GMPCerts.MyInsert", htparm);
                            }
                            for (int j = 1; j <= TotalTechCount; j++)
                            {
                                htparm["TechCertNo"] = collection["TechCertNo" + j];
                                htparm["TechCertStarting"] = collection["TechCertStarting" + j];
                                htparm["TechCertTime"] = collection["TechCertTime" + j];
                                htparm["Memberid"] = memberid;
                                CRMMapper.Get().Insert("TechCerts.MyInsert", htparm);
                            }
                        }
                        catch (Exception ex)
                        {
                            string hh = ex.Message;
                            IsSuccess = false;
                        }
                        //IsSuccess = true;

                    }
                    HtmlGMP = string.Empty;
                    HtmlTech = string.Empty;
                    for (int i = 1; i <= TotalGMPCount;i++)
                    {
                        string temp = string.Empty;
                        string temp1 = string.Empty;
                        if (collection["GMPCertStarting" + i] != null && collection["GMPCertStarting" + i] != "")
                            temp = DateTime.Parse(collection["GMPCertStarting" + i]).Date.ToString();
                        if (collection["GMPCertTime" + i] != null && collection["GMPCertTime" + i] != "")
                            temp1 = DateTime.Parse(collection["GMPCertTime" + i]).Date.ToString();
                        HtmlGMP += "<tr class=\"GMP" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + i + "号码:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"GMPCertNo" + i + "\" type=\"text\" class=\"kuang GMPCertNo\" size=\"40\" value=\"" + collection["GMPCertNo" + i] + "\"/></span><span class='view STYLE3'>*</span></td></tr>"
                           + "<tr class=\"GMP" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + i + "认证范围:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"GMPCertRange" + i + "\" type=\"text\" class=\"kuang\" size=\"40\" value=\"" + collection["GMPCertRange" + i] + "\"/></span></td></tr>"
                           + "<tr class=\"GMP" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + i + "发证时间:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                           + "<input name=\"GMPCertStarting" + i + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp + "\"/></span></td></tr>"
                           + "<tr class=\"GMP" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">GMP证书" + i + "有效期:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"GMPCertTime" + i + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp1 + "\"/></span></td></tr>";

                    }
                    for (int i = 1; i <= TotalTechCount; i++)
                    {
                        string temp = string.Empty;
                        string temp1 = string.Empty;
                        if (collection["TechCertStarting" + i] != null && collection["TechCertStarting" + i] != "")
                            temp = DateTime.Parse(collection["TechCertStarting" + i]).Date.ToString();
                        if (collection["TechCertTime" + i] != null && collection["TechCertTime" + i] != "")
                            temp1 = DateTime.Parse(collection["TechCertTime" + i]).Date.ToString();
                        HtmlTech += "<tr class=\"Tech" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">高新技术企业证书" + i + "号码:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"TechCertNo" + i + "\" type=\"text\" class=\"kuang TechCertNo\" size=\"40\" value=\"" + collection["TechCertNo" + i] + "\"/></span><span class='view STYLE3'>*</span></td></tr>"
                         + "<tr class=\"Tech" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">高新技术企业证书" + i + "发证时间:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"TechCertStarting" + i + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp + "\"/></span></td></tr>"
                           + "<tr class=\"Tech" + i + "\"><td height=\"25\" align=\"right\" class=\"view\">高新技术企业证书" + i + "有效期:</td><td height=\"25\" colspan=\"3\" align=\"left\"><span style=\"HEIGHT: 31px\">"
                              + "<input name=\"TechCertTime" + i + "\" type=\"text\" class=\"kuang date\" size=\"40\" value=\"" + temp1 + "\"/></span></td></tr>";

                    }
                    ViewData["Result"] = form;
                    ViewData["GMPResult"] = HtmlGMP;
                    ViewData["GMPCount"] = TotalGMPCount;
                    ViewData["TechResult"] = HtmlTech;
                    ViewData["TechCount"] = TechCount;
                    ViewData["Success"] = IsSuccess;
                }
            }
            ViewData["titlename"] = "企业资质信息";
            return View();
        }
Exemplo n.º 3
0
 public JsonResult SaveScene(string userid, string URL, string Detail, string Name, string Desc, string ProjectID, string MedicineCode)
 {
     Hashtable htparm = new Hashtable();
     htparm["Name"] = Name;
     htparm["Desc"] = Desc;
     htparm["Detail"] = Detail;
     htparm["ProjectID"] = ProjectID;
     htparm["MedicineCode"] = MedicineCode;
     int uid = Int32.Parse(userid);
     int memberid = new MemberUserInfoDao().Find(uid).MemberID;
     string eName = new EnterpriseMemberInfoDao().Find(memberid).EnterpriseName;
     htparm["eid"] = new EnterpriseCodeDao().FindByEnterprise(eName).Single().ID;
     try
     {
         if (URL.IndexOf("SceneNo") > 0)
         {
             int start = URL.IndexOf("SceneNo") + 7;
             htparm["SceneNo"] = Int32.Parse(URL.Substring(start, URL.Length - start));
             htparm["URL"] = URL + "/" + htparm["SceneNo"];
             EmedEvaluationProjectMapper.Get().Update("Scene.myupdate", htparm);
         }
         else
         {
             htparm["SceneNo"] = EmedEvaluationProjectMapper.Get().QueryForObject<int>("Scene.GetMaxNo", "") + 1;
             htparm["URL"] = URL + "/" + htparm["SceneNo"];
             EmedEvaluationProjectMapper.Get().Insert("Scene.myinsert", htparm);
         }
     }
     catch (Exception e)
     {
         return Json("保存失败");
     }
     return Json("保存成功");
 }
Exemplo n.º 4
0
        public ActionResult ChildUserManager()
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;
            int userid = Int32.Parse(CurrentUserInfo.UserID);
            int memberid = new MemberUserInfoDao().Find(userid).MemberID;

            Hashtable htparm = new Hashtable();
            htparm["MemberID"] = memberid;
            IList<int> List;
            IList<string> namelist=new List<string>();
            List = CRMMapper.Get().QueryForList<int>("MemberUserInfo.AllChildUser", htparm);
            foreach (int id in List)
            {
                namelist.Add(MembershipService.GetUserName(id));
            }
            ViewData["List"] = namelist;
            ViewData["titlename"] = "子账户权限管理";
            return View();
        }
Exemplo n.º 5
0
        public ActionResult Message()
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;
            if (Int32.Parse(sitemaster["isadmin"]) > 0)
            {
                int userid = Int32.Parse(CurrentUserInfo.UserID);
                int memberid = new MemberUserInfoDao().Find(userid).MemberID;

                Hashtable htparm = new Hashtable();
                htparm["MemberID"] = memberid;
                IList<IDictionary> List;
                IList<IDictionary> namelist = new List<IDictionary>();
                List = CRMMapper.Get().QueryForList<IDictionary>("MemberUserInfo.AllUser", htparm);
                foreach (IDictionary person in List)
                {
                    string personname = MembershipService.GetUserName((int)person["userid"]);
                    person["id"] = personname;
                    namelist.Add(person);
                }
                IList<string> messagelist;
                Hashtable htparm1 = new Hashtable();
                htparm1["Category"] = 9;
                messagelist = CRMMapper.Get().QueryForList<string>("ProductFunction.AllMessage", htparm1);
                ViewData["List"] = namelist;
                ViewData["Message"] = messagelist;
                ViewData["titlename"] = "短信设置";
            }
            else
            {
                return RedirectToAction("MemberLevelError", "Base");
            }
            return View();
        }
Exemplo n.º 6
0
        public ActionResult ChildUser(FormCollection collection)
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;

            int userid = Int32.Parse(CurrentUserInfo.UserID);
            MemberUserInfo mui=new MemberUserInfoDao().Find(userid);
            int memberid = mui.MemberID;
            CRMService crm = new CRMService();
            int memberlevel=(int)crm.GetUserMemberLevel(userid);
            if (CurrentUserInfo != null)
            {
                if (collection.Count == 0)
                {
                    ViewData["Name"] = CurrentUserInfo.UserName;
                    //获得初始的功能列表

                    Hashtable htparm = new Hashtable();
                    htparm["MemberLevel"] = memberlevel;
                    //IList<ProductFunction> versionFunctionList = crm.GetFunctions(memberid, ProductID,htparm);
                    //string functionlist = string.Empty;
                    Dictionary<string, string> functiondict = new Dictionary<string, string>();
                    int functioncount = 1;

                    string html = string.Empty;
                    IList<ProductFunction> versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm,1);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind1");
                        functioncount++;
                    }
                    functiondict.Add("kind1", html);

                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 12);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind12");
                        functioncount++;
                    }
                    functiondict.Add("kind12", html);

                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 2);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind2");
                        functioncount++;
                    }
                    functiondict.Add("kind2", html);
                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 3);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind3");
                        functioncount++;
                    }
                    functiondict.Add("kind3", html);
                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 4);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind4");
                        functioncount++;
                    }
                    functiondict.Add("kind4", html);
                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 5);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind5");
                        functioncount++;
                    }
                    functiondict.Add("kind5", html);
                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 6);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind6");
                        functioncount++;
                    }
                    functiondict.Add("kind6", html);
                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 7);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind7");
                        functioncount++;
                    }
                    functiondict.Add("kind7", html);
                    html = string.Empty;
                    versionFunctionList = crm.GetEachKindFunctions(memberid, ProductID, htparm, 8);
                    foreach (ProductFunction func in versionFunctionList)
                    {

                        html += GetDict(functioncount, func, "kind8");
                        functioncount++;
                    }
                    functiondict.Add("kind8", html);
                    html = string.Empty;
                    ViewData["Function"] = functiondict;
                    ViewData["Max"] = "";
                }
                else
                {

                    bool IsAdmin = new MemberUserInfoDao().IsAdmin(userid);
                    if (!IsAdmin)
                    {
                        ViewData["Admin"] = IsAdmin;
                        ViewData["Function"] = "";
                        ViewData["Max"] = "";
                        return View();
                    }
                    else
                    {
                        //检查是否超过规定的子账户数
                        Hashtable htp=new Hashtable();
                        htp["MemberID"] = memberid;
                        int maxchildcount = 0;
                        int childusercount = CRMMapper.Get().QueryForObject<int>("MemberUserInfo.ChildUserCount", htp);
                        if (CRMMapper.Get().QueryForObject<int>("SpecialChild.getcount", memberid) > 0)
                        {
                            maxchildcount = CRMMapper.Get().QueryForObject<int>("SpecialChild.getchildcount", memberid);
                        }
                        else
                        {
                        maxchildcount=GetMaxCount(memberlevel);
                        }
                        if (childusercount >= maxchildcount)
                        {
                            ViewData["Max"] = "对不起,您的子账户数超过了您的会员等级规定的子账户数!";
                        }
                        else
                        {
                            UserModel newuser = new UserModel();
                            newuser.Username = collection["UserName"];
                            newuser.Password = collection["Password"];
                            newuser.Email = "";

                            /*if (!MembershipService.CheckValidateCode(collection["ValidateCode"]))
                            {
                                ViewData["Name"] = CurrentUserInfo.UserName;
                                ViewData["UserInfo"] = collection["UserName"];
                                ViewData["Validatecode"] = "False";
                                return View();
                            }*/
                            if (!MembershipService.UserIsExists(newuser.Username))
                            {
                                MembershipService.CreateNewUser(newuser);
                                MemberUserInfo newMember = new MemberUserInfo();
                                int tempuserid = MembershipService.GetUserID(collection["UserName"]);
                                newMember.UserID = tempuserid;
                                newMember.MemberID = memberid;
                                newMember.Name = collection["Name"];
                                newMember.IsMemberAdmin = 0;
                                newMember.Mobile = collection["Mobile"];
                                newMember.Status = 1;
                                new MemberUserInfoDao().Insert(newMember);

                                //插入子账户功能表
                                ChildUserFunction newchildfunc = new ChildUserFunction();
                                newchildfunc.UserID = tempuserid;
                                newchildfunc.ProductID = ProductID;
                                newchildfunc.FunctionIDList = GetFunctionstring(collection);
                                new ChildUserFunctionDao().Insert(newchildfunc);
                                ViewData["Function"] = GetFunctionstringForView(userid, newchildfunc.FunctionIDList, memberid, ProductID);
                                ViewData["PostExist"] = "False";
                                ViewData["ChildUser"] = "******";
                                ViewData["Max"] = "";
                            }
                            else
                            {
                                ViewData["PostExist"] = "True";
                                ViewData["Max"] = "";
                            }

                        }

                            ViewData["IsExists"] = false;
                            ViewData["Admin"] = IsAdmin;
                            ViewData["Name"] = CurrentUserInfo.UserName;
                            ViewData["UserInfo"] = collection["UserName"];
                            ViewData["RealName"] = collection["Name"];
                            ViewData["Mobile"] = collection["Mobile"];
                    }
                }

            }
            ViewData["titlename"] = "子账户新增";
            return View();
        }
Exemplo n.º 7
0
        public JsonResult MessageSet(string UserName, string MessageName)
        {
            //得到子账户ID
            int userid = MembershipService.GetUserID(UserName);
            //得到子账户functionlist
            int functionid = CRMMapper.Get().QueryForObject<int>("ProductFunction.FunctionID", MessageName);
            IDictionary idc = FindCitylist(userid, functionid);
            string functionlist = string.Empty;
            string levellist = string.Empty;
            if (idc != null)
            {
                if (idc["CityList"] != null)
                    functionlist = idc["CityList"].ToString();

                if (idc["MessageLevel"] != null)
                    levellist = idc["MessageLevel"].ToString();
            }
            //得到企业ID
            int memberid = new MemberUserInfoDao().Find(userid).MemberID;
            //Hashtable htparm = new Hashtable();
            //CRMService crm = new CRMService();
            //htparm["MemberLevel"] = (int)crm.GetUserMemberLevel(userid);
            string result = GetCitystringForView(functionlist, memberid, productid);
            string levelresult = GetProLv(levellist);
            return this.Json(new { result = result, levelresult = levelresult });
            //return this.Json(result);
        }
Exemplo n.º 8
0
        public JsonResult ListAll(string product, string userid, string projectid, string formulation, string quality)
        {
            string resulttable = string.Empty;
            int memberid = new MemberUserInfoDao().Find(Int32.Parse(userid)).MemberID;
            Hashtable htparm = new Hashtable();
            htparm["product"] = product;
            htparm["projectid"] = Int32.Parse(projectid);
            htparm["quality"] = quality;
            htparm["formulation"] = formulation;
            string formulationlist = EmedAppraiseMapper.Get().QueryForObject<string>("AuctionGroup.All", htparm);
            string[] flists = formulationlist.Split(',');
            htparm["flists"] = flists;
            IList<IDictionary> list = EmedAppraiseMapper.Get().QueryForList<IDictionary>("AuctionMedicine.Simulate", htparm);
            int count = list.Count;
            MemberEnterpriseAliasDao mDao = new MemberEnterpriseAliasDao();
            IList<MemberEnterpriseAlias> enterpriseList = mDao.FindByMemberID(memberid);
            List<string> enterlist = new List<string>();
            foreach (MemberEnterpriseAlias m in enterpriseList)
            {
                enterlist.Add(m.EnterpriseName);
            }
            foreach (IDictionary l in list)
            {
                if (enterlist.Contains(l["ProductEnterprise"].ToString()))
                {
                    resulttable += "<tr class='tr_bg sort' style='width: 100%;background-color: Silver;'>";
                }
                else
                {
                    resulttable += "<tr class='tr_bg sort' style='width: 100%;'>";
                }

                resulttable += "<td>" + l["CommonName"].ToString() + "</td>";
                resulttable += result(l["Formulation"]);
                resulttable += result(l["ChineseSpecification"]);
                resulttable += result(l["ConvertCoefficient"]);
                resulttable += result(l["Unit"]);
                resulttable += result(l["Packaging"]);
                resulttable += result(l["Material"]);
                resulttable += result(l["QualityLevel"]);
                resulttable += result(l["ProductEnterprise"]);
                resulttable += result(l["LimitPrice"]);
                resulttable += "<td><input size='1' autocomplete='off' type='text' class='Quote' style='margin-left: 8px;'/></td><td class='result'></td></tr>";
            }

            return Json(new { html = resulttable, count = count });
        }
Exemplo n.º 9
0
 public JsonResult GetFormulation(string product, string userid, string projectid)
 {
     int memberid = new MemberUserInfoDao().Find(Int32.Parse(userid)).MemberID;
     Hashtable htparm = new Hashtable();
     htparm["product"] = product;
     htparm["projectid"] = Int32.Parse(projectid);
     string formulation = string.Empty;
     string quality = string.Empty;
     IList<string> flist = EmedAppraiseMapper.Get().QueryForList<string>("AuctionMedicine.Queryformulation", htparm);
     IList<string> qlist = EmedAppraiseMapper.Get().QueryForList<string>("AuctionMedicine.Querylevel", htparm);
     foreach (string l in flist)
     {
         /*string[] formulations=l["formulation"].ToString();
         foreach (string f in formulations)
         {
             formulation += "<option value='" + l["formulation"] + "'>" + l["formulation"] + "</option>";
         }
         string[] levels = l["QualityLevel"].ToString().Split(',');
         foreach (string f in levels)
         {
             quality += "<option value='" + l["QualityLevel"] + "'>" + l["QualityLevel"] + "</option>";
         }*/
         formulation += "<option value='" + l + "'>" + l + "</option>";
     }
     foreach (string l in qlist)
     {
         /*string[] formulations=l["formulation"].ToString();
         foreach (string f in formulations)
         {
             formulation += "<option value='" + l["formulation"] + "'>" + l["formulation"] + "</option>";
         }
         string[] levels = l["QualityLevel"].ToString().Split(',');
         foreach (string f in levels)
         {
             quality += "<option value='" + l["QualityLevel"] + "'>" + l["QualityLevel"] + "</option>";
         }*/
         quality += "<option value='" + l + "'>" + l + "</option>";
     }
     return Json(new { formulation = formulation, quality = quality });
 }
Exemplo n.º 10
0
 public JsonResult Rights(string UserName)
 {
     //得到子账户ID
     int userid = MembershipService.GetUserID(UserName);
     //得到子账户functionlist
     string functionlist = FindFunctionlist(userid, productid);
     //得到企业ID
     int memberid = new MemberUserInfoDao().Find(userid).MemberID;
     Hashtable htparm = new Hashtable();
     CRMService crm = new CRMService();
     htparm["MemberLevel"] = (int)crm.GetUserMemberLevel(userid);
     string result = GetFunctionstringForView(functionlist, memberid, productid, htparm);
     return this.Json(result);
 }