public ActionResult Category(string id)
        {
            ViewBag.isok  = "OK";
            ViewBag.Appid = WeChatConfig.GetKeyValue("appid");
            ViewBag.Uri   = WeChatConfig.GetKeyValue("shareurl");

            noncestr = CommonMethod.GetCode(16);

            string jsapi_ticket = Js_sdk_Signature.IsExistjsapi_ticket(token.IsExistAccess_Token());

            timestamp = DateTime.Now.Ticks.ToString().Substring(0, 10);;
            string url = Request.Url.ToString().Replace("#", "");

            JssdkSignature         = Js_sdk_Signature.GetjsSDK_Signature(noncestr, jsapi_ticket, timestamp, url);
            ViewBag.noncestr       = noncestr;
            ViewBag.jsapi_ticket   = jsapi_ticket;
            ViewBag.timestamp      = timestamp;
            ViewBag.JssdkSignature = JssdkSignature;
            ViewBag.PageFlag       = id;

            var sid = TypeParser.ToInt32(Request["sid"]);

            if (sid <= 0)
            {
                sid = 2;
            }
            ViewBag.SupplierID   = sid;
            ViewBag.SupplierName = supplierB.Get(s => s.SUPPLIER_ID == sid).SUPPLIER_NAME;
            ViewBag.ProductList  = VIEW_MST_PRD.ToListViewModel(prdB.GetListBy(p => p.CATE_ID == id && p.STATUS == true && p.ISCHECK == true, p => p.SEQ_NO));
            var model = VIEW_MST_CATEGORY.ToViewModel(categoryB.Get(c => c.CATE_CD == id));

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Update(VIEW_MST_CATEGORY model)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                return(this.JsonFormat(ModelState, status, "ERROR"));
            }
            try
            {
                model.MODIFY_DT     = DateTime.Now;
                model.SYNCVERSION   = DateTime.Now;
                model.SYNCOPERATION = "U";
                if (CategoryB.Modify(VIEW_MST_CATEGORY.ToEntity(model), "CATEGORY_NAME", "ISSHOW", "ACTIVE", "ISLEAVES", "ISHOT", "VERSION", "MODIFY_DT", "SYNCVERSION", "SYNCOPERATION", "REMARK1") >= 1)
                {
                    status = true;
                }
            }
            catch (Exception e)
            {
                return(this.JsonFormat(status, status, SysOperate.Update));
            }

            return(this.JsonFormat("/admin/category/PrdCateIndex", status, SysOperate.Update.ToMessage(status), status));
        }
        public MODEL.DataTableModel.DataTableGrid GetCategoryGridTree(MODEL.DataTableModel.DataTableRequest treeData)
        {
            int count = 0;

            var data = base.GetListBy(sc => true).OrderBy(sc => sc.CATE_CD);

            count = data.Count();
            //GetPermission(request, out count);
            List <VIEW_MST_CATEGORY> listCategory = new List <VIEW_MST_CATEGORY>();
            //查找所有的一级权限
            var ParentCatalog = data.Where(con => con.SYNCOPERATION != "D");

            foreach (var parent in ParentCatalog)
            {
                //实体转化
                VIEW_MST_CATEGORY parentItem = VIEW_MST_CATEGORY.ToViewModel(parent);
                //获取子级
                GetCategoryChildren(ref parentItem, data.ToList());
                listCategory.Add(parentItem);
            }
            return(new MODEL.DataTableModel.DataTableGrid()
            {
                data = listCategory,
                total = count
            });
        }
Beispiel #4
0
        public ActionResult Add(VIEW_MST_CATEGORY model)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                return(this.JsonFormat(ModelState, status, "ERROR"));
            }
            try
            {
                //model.PARENT_CD = "MAIN";
                model.CREATE_DT     = DateTime.Now;
                model.VERSION       = 1;
                model.MODIFY_DT     = DateTime.Now;
                model.SYNCVERSION   = DateTime.Now;
                model.SYNCOPERATION = "A";
                CategoryB.Add(VIEW_MST_CATEGORY.ToEntity(model));
                status = true;
            }
            catch (Exception e)
            {
                return(this.JsonFormat(status, status, SysOperate.Add));
            }
            return(this.JsonFormat("/admin/category/PrdCateIndex", status, SysOperate.Add.ToMessage(status), status));
        }
Beispiel #5
0
 public ActionResult WelCome()
 {
     ViewBag.UserID       = OperateContext.Current.UsrId;
     ViewBag.UserName     = OperateContext.Current.UsrName;
     ViewBag.PrdList      = VIEW_MST_PRD.ToListViewModel(prd_MANAGER.GetListBy(s => true, s => s.SEQ_NO));
     ViewBag.CategoryList = VIEW_MST_CATEGORY.ToListViewModel(categroyB.GetListBy(s => s.SYNCOPERATION != "D"));
     return(View());
 }
Beispiel #6
0
        public ActionResult PrdCateDetail(string cd)
        {
            ViewBag.TYPE     = "Add";
            ViewBag.CATE_IDS = DataSelect.ToListViewModel(VIEW_MST_CATEGORY.ToListViewModel(CategoryB.GetListBy(m => m.ACTIVE == true)));
            var model = CategoryB.Get(m => m.CATE_CD == cd);

            if (model == null)
            {
                return(View(new VIEW_MST_CATEGORY()));
            }
            ViewBag.TYPE  = "Update";
            model.VERSION = model.VERSION + 1;
            return(View(VIEW_MST_CATEGORY.ToViewModel(model)));
        }
Beispiel #7
0
        public ActionResult Index()
        {
            ViewBag.PageFlag        = "Index";
            ViewBag.CategoryList    = VIEW_MST_CATEGORY.ToListViewModel(categoryManager.GetListBy(c => c.ACTIVE == true));
            ViewBag.PositionHotList = positionManager.LoadListBy(p => p.STATUS == "Y" && p.ISHOT == "Y", p => p.PUBLISH_DT, false).Skip(0).Take(20).Select(p => new VIEW_MST_POSITION()
            {
                POSITION_CD    = p.POSITION_CD,
                COMPANY_CD     = p.COMPANY_CD,
                NAME           = p.NAME,
                DEPARTMENTNAME = p.DEPARTMENTNAME,
                WORKTYPE       = p.WORKTYPE,
                MONEY          = p.MONEY,
                WORKPLACE      = p.WORKPLACE,
                EXPERIENCE     = p.EXPERIENCE,
                EDUCATION      = p.EDUCATION,
                REMARK         = p.REMARK,
                ISNEW          = p.ISNEW,
                ISHOT          = p.ISHOT,
                STATUS         = p.STATUS,
                PUBLISH_DT     = p.PUBLISH_DT,
                COMPANY_NAME   = p.MST_COMPANY.COMPANY_NAME,
                COMPANY_SIZE   = p.MST_COMPANY.COMPANY_SIZE,
                INDUSTRY       = p.MST_COMPANY.INDUSTRY,
                DEVELOPMENT    = p.MST_COMPANY.DEVELOPMENT
            }).ToList();
            ViewBag.PositionNewList = positionManager.LoadListBy(p => p.STATUS == "Y" && p.ISNEW == "Y", p => p.PUBLISH_DT, false).Skip(0).Take(20).Select(p => new VIEW_MST_POSITION()
            {
                POSITION_CD    = p.POSITION_CD,
                COMPANY_CD     = p.COMPANY_CD,
                NAME           = p.NAME,
                DEPARTMENTNAME = p.DEPARTMENTNAME,
                WORKTYPE       = p.WORKTYPE,
                MONEY          = p.MONEY,
                WORKPLACE      = p.WORKPLACE,
                EXPERIENCE     = p.EXPERIENCE,
                EDUCATION      = p.EDUCATION,
                REMARK         = p.REMARK,
                ISNEW          = p.ISNEW,
                ISHOT          = p.ISHOT,
                STATUS         = p.STATUS,
                PUBLISH_DT     = p.PUBLISH_DT,
                COMPANY_NAME   = p.MST_COMPANY.COMPANY_NAME,
                COMPANY_SIZE   = p.MST_COMPANY.COMPANY_SIZE,
                INDUSTRY       = p.MST_COMPANY.INDUSTRY,
                DEVELOPMENT    = p.MST_COMPANY.DEVELOPMENT
            }).ToList();

            return(View());
        }
Beispiel #8
0
        public ActionResult ProductDetail(string id)
        {
            ViewBag.TYPE     = "Add";
            ViewBag.CATE_IDS = DataSelect.ToListViewModel(VIEW_MST_CATEGORY.ToListViewModel(categroyB.GetListBy(m => m.ISSHOW == true && m.ACTIVE == true)));
            var model = prdB.Get(m => m.PRD_CD == id);

            if (model == null)
            {
                return(View(new VIEW_MST_PRD()
                {
                    PRD_CD = "PRD" + Common.Tools.Get8Digits()
                }));
            }
            ViewBag.TYPE = "Update";
            return(View(VIEW_MST_PRD.ToViewModel(model)));
        }
 // <summary>
 /// 获取子集
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="allList"></param>
 public void GetCategoryChildren(ref VIEW_MST_CATEGORY parent, List <MST_CATEGORY> allList)
 {
     foreach (MST_CATEGORY category in allList)
     {
         if (category.PARENT_CD == parent.CATE_CD && category.SYNCOPERATION != "D")
         {
             //实体转化
             VIEW_MST_CATEGORY child = VIEW_MST_CATEGORY.ToViewModel(category);
             if (parent.children == null)
             {
                 parent.children = new List <VIEW_MST_CATEGORY>();
             }
             //添加到父级的Children中
             parent.children.Add(child);
             GetCategoryChildren(ref child, allList);//递归添加子树
         }
     }
 }
Beispiel #10
0
        public ActionResult Index()
        {
            ViewBag.PageFlag = "Index";
            if (string.IsNullOrEmpty(CommonMethod.getCookie("userid")) || string.IsNullOrEmpty(CommonMethod.getCookie("openid")))
            {
                //CommonMethod.delCookie("userid");
                //登陆
                string code = Request.QueryString["code"];//获取授权code
                if (!string.IsNullOrEmpty(code))
                {
                    string openIdUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + WeChatConfig.GetKeyValue("appid") + "&secret=" + WeChatConfig.GetKeyValue("appsecret") + "&code=" + code + "&grant_type=authorization_code";
                    string content   = Tools.GetPage(openIdUrl, "");
                    openid = Tools.GetJsonValue(content, "openid");//根据授权  获取当前人的openid
                    var model = weiUserM.GetModelWithOutTrace(u => u.openid == openid);
                    if (model != null)
                    {
                        CommonMethod.delCookie("openid");
                        CommonMethod.delCookie("userid");
                        CommonMethod.setCookie("openid", openid, 1);
                        CommonMethod.setCookie("userid", model.userNum, 1);
                    }
                }
                else
                {
                    string codeurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx242aa47391c159f6&redirect_uri=http://www.aoshacar.com/AoShaCar/Index&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
                    Response.Redirect(codeurl);
                }
                //end
            }
            ViewBag.PageFlag = "Index";
            var sid = TypeParser.ToInt32(Request["sid"]);

            if (sid <= 0)
            {
                sid = 2;
            }
            ViewBag.SupplierID   = sid;
            ViewBag.SupplierName = supplierB.Get(s => s.SUPPLIER_ID == sid).SUPPLIER_NAME;
            ViewBag.CategoryList = VIEW_MST_CATEGORY.ToListViewModel(categoryB.GetListBy(c => c.ACTIVE == true));
            ViewBag.ProductList  = VIEW_MST_PRD.ToListViewModel(prdB.GetListBy(p => p.ISCHECK == true && p.STATUS == true && p.ISHOT == true, p => p.SEQ_NO));

            return(View());
        }
        public IEnumerable <DataTree> GetCategoryTree(MODEL.DataTableModel.DataTreeRequest request)
        {
            //返回ui层的菜单
            IEnumerable <DataTree> rootRole = new List <DataTree>();
            var data = base.GetListBy(sc => true).OrderBy(sc => sc.CATE_CD);
            //GetPermission(request, out count);
            List <VIEW_MST_CATEGORY> listCategory = new List <VIEW_MST_CATEGORY>();
            //查找所有的一级权限
            var ParentCatalog = data.Where(con => con.PARENT_CD == "" && con.SYNCOPERATION != "D");

            foreach (var parent in ParentCatalog)
            {
                //实体转化
                VIEW_MST_CATEGORY parentItem = VIEW_MST_CATEGORY.ToViewModel(parent);
                //获取子级
                GetCategoryChildren(ref parentItem, data.ToList());
                listCategory.Add(parentItem);
            }
            rootRole = DataTree.ToListViewModel(listCategory);

            return(rootRole);
        }
        public IEnumerable <DataSelect> GetAllCategorySelectToViewModel(MODEL.DataTableModel.DataSelectRequest selectData)
        {
            IEnumerable <VIEW_MST_CATEGORY> list = VIEW_MST_CATEGORY.ToListViewModel(GetAllCategorySelect(selectData));

            return(DataSelect.ToListModel(list));
        }