예제 #1
0
        private ActionResult GetPages(C_UserSearch condition, string where)
        {
            PageJsonModel <C_UserShow> page = new PageJsonModel <C_UserShow>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = @"(select c.*,o.Name ChiefName,o.Phone ChiefPhone ,t.Name LevelName,I.Name IName  from  C_User as c left join C_User as o on c.Chief=o.ID  left join C_UserType t on c.C_UserTypeID=t.Lever left join C_User I on c.Introducer=I.UserName ) as C_UserShow";
            page.strSelect = " * ";
            page.strWhere  = where;
            if (string.IsNullOrWhiteSpace(condition.orderby) == false)
            {
                page.strOrder = Common.FilteSQLStr(condition.orderby);
            }
            else
            {
                page.strOrder = "ID desc";
            }

            page.LoadList();

            if (page.pageResponse != null && page.pageResponse.RtnList != null && page.pageResponse.RtnList.Count > 0)
            {
                return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        //public ActionResult DirectlyIndex_inport()
        //{
        //    string msg = "";
        //    try
        //    {
        //        var file = Request.Files[0];
        //        string path = Request.MapPath("~/");
        //        string ext = Path.GetExtension(file.FileName);//获得文件扩展名
        //        if (!Directory.Exists(Server.MapPath("~/Codetxt/")))
        //        {
        //            Directory.CreateDirectory(Server.MapPath("~/Codetxt/"));
        //        }
        //        if (file.ContentLength == 0 || file == null)
        //        {
        //            msg = "上传的文件没有内容!";
        //            TempData["ToIndex_err"] = msg;
        //            return View();
        //        }
        //        if (file.ContentLength > 3242880)
        //        {
        //            msg = "上传的文件不能超过3MB!!";
        //            TempData["ToIndex_err"] = msg;
        //            return View();
        //        }
        //        if (ext != ".txt")
        //        {
        //            msg = "上传文件格式不对!";
        //            TempData["ToIndex_err"] = msg;
        //            return View();
        //        }
        //        string DatNow = DateTime.Now.ToString("yyyyMMddHHmmss");
        //        file.SaveAs(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
        //        StreamReader sr = new StreamReader(Server.MapPath("~/Codetxt/" + DatNow + ".txt"), Encoding.Default);
        //        String line;
        //        while ((line = sr.ReadLine()) != null)
        //        {
        //            string[] list = line.ToString().Split(' ');
        //            C_User para = new C_User();
        //            para.state = "已审核";
        //            para.Chief = 0;
        //            para.C_UserTypeID = 1;
        //            para.UserName = "******" + (C_User.GetTopUseID() + 1 + 1000);

        //            para.Name = list[0];
        //            para.Phone = list[1];
        //            para.PassWord = list[2];
        //            para.Card = list[3];
        //            para.Identifier = list[4];
        //            para.wxNo = list[5];

        //            if (string.IsNullOrWhiteSpace(para.Name))
        //            {
        //                return Content("姓名不能为空");
        //            }
        //            if (string.IsNullOrWhiteSpace(para.Identifier))
        //            {
        //                return Content("授权编号不能为空");
        //            }
        //            if (RepeatHelper.NoRepeat("C_User", "Identifier", para.Identifier, para.ID) > 0)
        //            {
        //                return Content("授权编号已存在");
        //            }



        //            para.InsertAndReturnIdentity();
        //        }
        //        sr.Close();
        //        System.IO.File.Delete(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
        //        msg = "导入成功!";
        //        TempData["ToIndex_err"] = msg;
        //        return View("DirectlyIndex");
        //    }
        //    catch
        //    {
        //        msg = "导入失败,文件太大!!";
        //        TempData["ToIndex_err"] = msg;
        //        return View("DirectlyIndex");
        //    }

        //}

        /// <summary>
        /// 查询条件
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        private string StrWhere(C_UserSearch condition)
        {
            string where = string.Empty;
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where += string.Format(" and (Name like '%{0}%' or Phone like '%{0}%' or Identifier like '%{0}%' or LevelName like '%{0}%' or (Province+City+Area) like '%{0}%')", condition.keyword);
            }
            return(where);
        }
예제 #3
0
 public ActionResult GetUserPage(C_UserSearch condition)
 {
     string where = string.Empty;
     if (string.IsNullOrWhiteSpace(condition.keyword))
     {
         where += " and UserName like '%" + condition.keyword + "%'";
     }
     return(GetPages(condition, where));
 }
예제 #4
0
        public ActionResult GetInstroceDetail(C_UserSearch condition)
        {
            string where = string.Empty;
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where += " and Name like '%" + condition.keyword + "%'";
            }
            PageJsonModel <C_UserInduce> page = NewMethod(condition, where);

            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        private static PageJsonModel <C_UserInduce> NewMethod(C_UserSearch condition, string where)
        {
            PageJsonModel <C_UserInduce> page = new PageJsonModel <C_UserInduce>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = @"( select c.*,t.Name ILeverName from  (select c.*,t.Name LeverName from (SELECT c.*,b.C_UserTypeID IC_UserTypeID ,b.Name IName,b.Phone IPhone FROM C_User c left join C_User b on c.Introducer=b.UserName where c.Introducer!='' and c.Chief=0) c left join C_UserType t on  c.C_UserTypeID=t.Lever) c left join C_UserType t on c.IC_UserTypeID=t.Lever ) as Show";
            page.strSelect = " * ";
            page.strWhere  = where;
            page.strOrder  = "ID desc";
            page.LoadList();
            return(page);
        }
예제 #6
0
        private ActionResult GetMy_tjs(C_UserSearch condition, string where)
        {
            PageJsonModel <C_User> page = new PageJsonModel <C_User>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = string.Format(@" C_User ");
            page.strSelect = " * ";
            page.strWhere  = where;
            page.strOrder  = "ID desc";
            page.LoadList();
            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        private ActionResult GetPages(C_UserSearch condition, string where)
        {
            PageJsonModel <C_UserShow> page = new PageJsonModel <C_UserShow>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = @"( select c.ID ID,c.wxNo wxNo ,c.Name Name,c.Phone Phone,c.Card Card,c.C_UserTypeID C_UserTypeID,c.DatCreate DatCreate,c.DatVerify DatVerify,c.state state,c.Identifier Identifier,c.Chief Chief,t.Name LevelName from C_User as  c left join C_UserType as t on t.Lever=c.C_UserTypeID ) as C_UserShow";
            page.strSelect = " * ";
            page.strWhere  = where;
            page.strOrder  = "ID desc";
            page.LoadList();
            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        public ActionResult ExportExcel(C_UserSearch condition)
        {
            StringBuilder where = new StringBuilder();
            where.Append("select UserName,Name,wxNo,Phone,Province,City,Area,WxQRCode from [C_User] where 1=1 ");
            where.Append("and state='已审核'  and Chief=0  ");
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where.Append(string.Format(" and (Name like '%{0}%' or Phone like '%{0}%' or Identifier like '%{0}%' or LevelName like '%{0}%')", condition.keyword));
            }
            DataTable dt = ExportWay.ExcelDataTable(where.ToString());

            string[] list = { "经销商编号", "经销商名称", "联系人", "联系方式", "省份", "市区", "城镇", "详细地址" };
            return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "直属客户信息" + DateTime.Now.ToShortTimeString() + ".xls"));
        }
예제 #9
0
        public ActionResult ExportExcel(C_UserSearch condition)
        {
            StringBuilder where = new StringBuilder();
            where.Append(@"select p.ProductNumber ProductNumber,p.ProductName ProductName,count(*) count from Scale s 
left join Product p on s.ProductNo=p.ProductNumber where s.StateID in (6,7,9) group by ProductName,p.ProductImg,p.ProductNumber ");
            //where.Append("and state='已审核'  and Chief=0  ");
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where.Append(string.Format(" and (ProductName like '%{0}%' )", condition.ProductName));
            }
            DataTable dt = ExportWay.ExcelDataTable(where.ToString());

            string[] list = { "产品编号", "产品名称", "数量" };
            return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "入库统计信息" + DateTime.Now.ToShortTimeString() + ".xls"));
        }
예제 #10
0
        private ActionResult GetPages(C_UserSearch condition, string where)
        {
            PageJsonModel <C_UserUpGrade> page = new PageJsonModel <C_UserUpGrade>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = @"(SELECT [C_UserUpGrade].*,t1.Name OldUserTypeName,t2.Name NewUserTypeName,C_User.Name C_Name FROM [C_UserUpGrade] 
                                      left join C_UserType t1 on [C_UserUpGrade].OldUserTypeID=t1.Lever
                                      left join C_UserType t2 on [C_UserUpGrade].NewUserTypeID=t2.Lever 
                                      left join C_User on [C_UserUpGrade].UserName=C_User.UserName
                                      where ParentUser='' and AuditStat='未审核') as Show";
            page.strSelect = " * ";
            page.strWhere  = where;
            page.strOrder  = "ID desc";
            page.LoadList();
            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        public ActionResult ExportExcel(C_UserSearch condition)
        {
            StringBuilder where = new StringBuilder();
            where.Append(@"select b.ProductNumber,b.ProductName,COUNT(SmallCode) as SmallCount,sum(b.kw) as [money]
                            from Scale as a left join Product as b on a.ProductNo=b.ProductNumber
                            where StateID in (6,9)");

            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where.Append(string.Format(" and (b.ProductName like '%{0}%' )", condition.keyword));
            }
            where.Append(@" group by b.ProductName,b.ProductNumber,b.ProductImg");

            DataTable dt = ExportWay.ExcelDataTable(where.ToString());

            string[] list = { "产品编号", "产品名称", "库存数量" };
            return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "出库统计信息" + DateTime.Now.ToShortTimeString() + ".xls"));
        }
예제 #12
0
        /// <summary>
        /// 加载发货代理
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public ActionResult LoadOutScaleC_User(C_UserSearch condition)
        {
            string where = string.Empty;
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where += " and ( UserName+Name like '%" + condition.keyword + "%' or Province like '%" + condition.keyword + "%' or City like '%" + condition.keyword + "%')";
            }
            PageJsonModel <C_UserShow> page = new PageJsonModel <C_UserShow>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = "( select c.PortraitUrl PortraitUrl,c.UserName UserName,c.ID ID, c.Name Name,c.Phone Phone,c.Province Province,c.City City,c.C_UserTypeID C_UserTypeID,c.DatCreate DatCreate,c.DatVerify DatVerify,c.state state,c.Identifier Identifier,c.Chief Chief,t.Name LevelName from C_User as  c left join C_UserType as t on t.Lever=c.C_UserTypeID ) as C_UserShow";
            page.strSelect = "* ";
            page.strWhere  = " and Chief=" + CurrentUser.ID + where; // " or UserName='******'"
            page.strOrder  = "ID ";
            page.LoadList();
            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
예제 #13
0
        /// <summary>
        /// 读取我推荐的人
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public ActionResult LoadMy_tjs(C_UserSearch condition)
        {
            string where = string.Empty;
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where += string.Format(" and (Name like '%{0}%' or Phone like '%{0}%')", condition.keyword);
            }
            if (!string.IsNullOrWhiteSpace(condition.username))
            {
                where += string.Format(" and Introducer='{0}' ", condition.username);
            }
            else
            {
                where += string.Format(" and Introducer='{0}' ", CurrentUser.UserName);
            }


            return(GetMy_tjs(condition, where));
        }
예제 #14
0
 /// <summary>
 /// 回收站条件
 /// </summary>
 /// <param name="condition"></param>
 /// <returns></returns>
 public ActionResult GetUserDelPage(C_UserSearch condition)
 {
     string where = StrWhere(condition);
     where       += " and state='已删除' ";
     return(GetPages(condition, where));
 }
예제 #15
0
 public ActionResult GetBlackPage(C_UserSearch condition)
 {
     string where = string.Empty;
     where       += " and state='黑名单' ";
     return(GetPages(condition, where));
 }
예제 #16
0
 /// <summary>
 /// 未审核条件
 /// </summary>
 /// <param name="condition"></param>
 /// <returns></returns>
 public ActionResult GetNoVerifyPage(C_UserSearch condition)
 {
     string where = StrWhere(condition);
     where       += " and state='未审核' and Chief=0";
     return(GetPages(condition, where));
 }
예제 #17
0
 /// <summary>
 /// 转移下级代理条件
 /// </summary>
 /// <param name="condition"></param>
 /// <returns></returns>
 public ActionResult GetOldChiefPage(C_UserSearch condition)
 {
     string where = StrWhere(condition);
     where       += " and state='已审核'  and  ID!=" + condition.ID + " and C_UserTypeID<" + condition.C_UserTypeID;
     return(GetPages(condition, where));
 }
예제 #18
0
 public ActionResult UserIDVerifyPage(C_UserSearch condition)
 {
     string where = StrWhere(condition);
     where       += " and state='已审核' and Chief=" + condition.ID;
     return(GetPages(condition, where));
 }