Beispiel #1
0
        public JsonResult GetRoleByID(string id)
        {
            var model = ManageSystemBusiness.GetRoleByID(id);

            JsonDictionary.Add("model", model);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #2
0
        public JsonResult DeleteMUser(int id)
        {
            bool bl = M_UsersBusiness.DeleteM_User(id, 9);

            JsonDictionary.Add("status", (bl ? 1 : 0));
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #3
0
        public JsonResult UpdateUserStatus(int id, int status)
        {
            bool bl = M_UsersBusiness.UpdateM_UserStatus(id, status);

            JsonDictionary.Add("status", (bl ? 1 : 0));
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #4
0
        public JsonResult GetUserDetail(int id)
        {
            var item = M_UsersBusiness.GetUserDetail(id);

            JsonDictionary.Add("Item", item);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #5
0
        /// <summary>
        /// 新增或修改用户
        /// </summary>
        public JsonResult ValidateLoginName(string loginName)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            JsonDictionary.Add("Info", M_UsersBusiness.GetM_UserCountByLoginName(loginName) > 0 ? "登录名已存在" : "");
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #6
0
        /// <summary>
        /// 删除属性值
        /// </summary>
        /// <param name="valueid"></param>
        /// <returns></returns>
        public JsonResult DeleteAttrValue(string valueid)
        {
            bool bl = new ProductsBusiness().UpdateAttrValueStatus(valueid, EnumStatus.Delete, OperateIP, CurrentUser.UserID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #7
0
        /// <summary>
        /// 获取分类详情(带属性)
        /// </summary>
        /// <param name="categoryid"></param>
        /// <returns></returns>
        public JsonResult GetCategoryDetailsByID(string categoryid)
        {
            var model = new ProductsBusiness().GetCategoryDetailByID(categoryid);

            JsonDictionary.Add("Model", model);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #8
0
        /// <summary>
        /// 组织架构替换人员
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="olduserid"></param>
        /// <returns></returns>
        public JsonResult ChangeUsersParentID(string userid, string olduserid)
        {
            bool bl = new OrganizationBusiness().ChangeUsersParentID(userid, olduserid, CurrentUser.AgentID, CurrentUser.UserID, OperateIP);

            JsonDictionary.Add("status", bl);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #9
0
        //编辑员工角色
        public JsonResult UpdateUserRole(string userid, string roleid)
        {
            bool bl = new OrganizationBusiness().UpdateUserRole(userid, roleid, CurrentUser.AgentID, CurrentUser.UserID, OperateIP);

            JsonDictionary.Add("status", bl);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #10
0
        public JsonResult GetUserAll()
        {
            var list = OrganizationBusiness.GetUsers(CurrentUser.AgentID).Where(m => m.Status == 1).OrderBy(m => m.FirstName).ToList();

            JsonDictionary.Add("items", list);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #11
0
        public JsonResult GetUserNoTeam()
        {
            var list = OrganizationBusiness.GetUsers(CurrentUser.AgentID).Where(m => m.TeamID == "");

            JsonDictionary.Add("items", list);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #12
0
        /// <summary>
        /// 根据上级获取用户列表
        /// </summary>
        /// <param name="parentid"></param>
        /// <returns></returns>
        public JsonResult GetUsersByParentID(string parentid = "")
        {
            var list = OrganizationBusiness.GetUsersByParentID(parentid, CurrentUser.AgentID).OrderBy(m => m.FirstName).ToList();

            JsonDictionary.Add("items", list);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #13
0
        public JsonResult IsExistLoginName(string loginname)
        {
            var bl = OrganizationBusiness.IsExistLoginName(loginname);

            JsonDictionary.Add("status", bl);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #14
0
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="departid"></param>
        /// <returns></returns>
        public JsonResult DeleteDepartment(string departid)
        {
            var status = new OrganizationBusiness().UpdateDepartmentStatus(departid, CloudSalesEnum.EnumStatus.Delete, CurrentUser.UserID, OperateIP, CurrentUser.AgentID);

            JsonDictionary.Add("status", (int)status);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #15
0
        /// <summary>
        /// 获取品牌详细信息
        /// </summary>
        /// <returns></returns>
        public JsonResult GetBrandDetail(string brandID)
        {
            Brand model = new ProductsBusiness().GetBrandByBrandID(brandID);

            JsonDictionary.Add("Item", model);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #16
0
        public JsonResult GetDepartmentByID(string id)
        {
            var model = OrganizationBusiness.GetDepartmentByID(id, CurrentUser.AgentID);

            JsonDictionary.Add("model", model);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #17
0
        /// <summary>
        /// 添加分类通用属性
        /// </summary>
        /// <param name="categoryid"></param>
        /// <param name="attrid"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public JsonResult AddCategoryAttr(string categoryid, string attrid, int type)
        {
            bool bl = new ProductsBusiness().AddCategoryAttr(categoryid, attrid, type, OperateIP, CurrentUser.UserID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #18
0
        //车缝、裁剪录入
        public JsonResult CreateOrderGoodsDoc(string orderID, string taskID, int docType, int isOver, string details, string remark, string ownerID, string operateID, string clientID, string expressID, string expressCode)
        {
            string id = OrdersBusiness.BaseBusiness.CreateOrderGoodsDoc(orderID, taskID, (EnumGoodsDocType)docType, isOver, expressID, expressCode, details, remark, ownerID, operateID, clientID);

            JsonDictionary.Add("id", id);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #19
0
        /// <summary>
        /// 获取下级分类
        /// </summary>
        /// <param name="categoryid"></param>
        /// <returns></returns>
        public JsonResult GetChildCategorysByID(string categoryid)
        {
            var list = new ProductsBusiness().GetChildCategorysByID(categoryid, CurrentUser.ClientID);

            JsonDictionary.Add("Items", list);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #20
0
        /// <summary>
        /// 获取产品信息
        /// </summary>
        /// <param name="productid"></param>
        /// <returns></returns>
        public JsonResult GetProductByID(string productid)
        {
            var model = new ProductsBusiness().GetProductByID(productid);

            JsonDictionary.Add("Item", model);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #21
0
        public JsonResult UpdateUserPwd(string userID, string loginPwd)
        {
            bool bl = OrganizationBusiness.UpdateUserPass(userID, loginPwd, CurrentUser.AgentID);

            JsonDictionary.Add("status", bl);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #22
0
        /// <summary>
        /// 编辑产品是否推荐
        /// </summary>
        /// <param name="productid"></param>
        /// <param name="isRecommend"></param>
        /// <returns></returns>
        public JsonResult UpdateProductIsRecommend(string productid, bool isRecommend)
        {
            bool bl = new ProductsBusiness().UpdateProductIsRecommend(productid, isRecommend, OperateIP, CurrentUser.UserID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #23
0
        public JsonResult UpdateCartBatch(string autoid, string batch)
        {
            var bl = ShoppingCartBusiness.UpdateCartBatch(autoid, batch, CurrentUser.UserID);

            JsonDictionary.Add("status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #24
0
        public JsonResult UpdateCartPrice(string autoid, decimal price)
        {
            var bl = ShoppingCartBusiness.UpdateCartPrice(autoid, price, CurrentUser.UserID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #25
0
        /// <summary>
        /// 审核上架
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public JsonResult AuditPurchase(string ids)
        {
            bool bl = new OrdersBusiness().AuditStorageIn(ids, CurrentUser.UserID, CurrentUser.ClientID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #26
0
        /// <summary>
        /// 根据cityCode获取下级地区列表
        /// </summary>
        /// <param name="pcode"></param>
        /// <returns></returns>
        public JsonResult GetCityByPCode(string cityCode)
        {
            var list = CommonBusiness.GetCitys().Where(c => c.PCode == cityCode);

            JsonDictionary.Add("Items", list);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #27
0
 public JsonResult UpdateNeedStatus(string ids, int status)
 {
     ids=ids.Trim(',');
     var result = UserNeedsBusiness.UpdateStatus(ids, status,CurrentUser.UserID);
     JsonDictionary.Add("result", result);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Beispiel #28
0
        /// <summary>
        /// 编辑子产品状态
        /// </summary>
        /// <param name="productdetailid"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public JsonResult UpdateProductDetailsStatus(string productdetailid, int status)
        {
            bool bl = new ProductsBusiness().UpdateProductDetailsStatus(productdetailid, (EnumStatus)status, OperateIP, CurrentUser.UserID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #29
0
        /// <summary>
        /// 产品编码是否存在
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public JsonResult IsExistsProductCode(string code)
        {
            bool bl = new ProductsBusiness().IsExistProductCode(code, CurrentUser.ClientID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #30
0
        /// <summary>
        /// 删除购物车产品
        /// </summary>
        /// <param name="autoid"></param>
        /// <returns></returns>
        public JsonResult DeleteCart(string autoid)
        {
            var bl = ShoppingCartBusiness.DeleteCart(autoid, CurrentUser.UserID);

            JsonDictionary.Add("Status", bl);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #31
0
        public void RootResourceTest()
        {
            var subJson = new JsonDictionary();
            subJson.Add("resources", new JsonDictionary { { "Grandchild", new JsonDictionary() } });
            var topJson = new JsonDictionary();
            topJson.Add("resources", new JsonDictionary { { "Sub", subJson } });

            // Create the resource hierachy.
            var topResource = new ResourceV1_0(new KeyValuePair<string, object>("", topJson));
            var subResource = topResource.Resources["Sub"];
            var grandchildResource = subResource.Resources["Grandchild"];

            // Check the generated full name.
            Assert.AreEqual("", topResource.Path);
            Assert.AreEqual("Sub", subResource.Path);
            Assert.AreEqual("Sub.Grandchild", grandchildResource.Path);
        }
        public void RootResourceTest()
        {
            var subJson = new JsonDictionary();
            subJson.Add("resources", new JsonDictionary { { "Grandchild", new JsonDictionary() } });
            var topJson = new JsonDictionary();
            topJson.Add("resources", new JsonDictionary { { "Sub", subJson } });

            // Create the resource hierachy.
            var topResource = new Resource(ServiceFactory.Default, "", topJson);
            var subResource = topResource.Resources["Sub"];
            var grandchildResource = subResource.Resources["Grandchild"];

            // Check the generated full name.
            Assert.AreEqual("", topResource.Path);
            Assert.AreEqual("Sub", subResource.Path);
            Assert.AreEqual("Sub.Grandchild", grandchildResource.Path);
        }
Beispiel #33
0
 private IService CreateV1Service()
 {
     var dict = new JsonDictionary();
     dict.Add("name", "TestName");
     dict.Add("version", "v1");
     return new ConcreteClass(dict);
 }
Beispiel #34
0
        public void TestGetResource()
        {
            var container = CreateV1Service();
            container.Resources.Clear();

            // Create json.
            var subJson = new JsonDictionary();
            subJson.Add("resources", new JsonDictionary { { "Grandchild", new JsonDictionary() } });
            var topJson = new JsonDictionary();
            topJson.Add("resources", new JsonDictionary { { "Sub", subJson } });

            // Create the resource hierachy.
            var topResource = ServiceFactory.Default.CreateResource("Top", topJson);
            var subResource = topResource.Resources["Sub"];
            var grandchildResource = subResource.Resources["Grandchild"];
            container.Resources.Add("Top", topResource); 

            // Check the generated full name.
            Assert.AreEqual(container.Methods, BaseService.GetResource(container, "").Methods);
            Assert.AreEqual(topResource, BaseService.GetResource(container, "Top"));
            Assert.AreEqual(subResource, BaseService.GetResource(container, "Top.Sub"));
            Assert.AreEqual(grandchildResource, BaseService.GetResource(container, "Top.Sub.Grandchild"));
        }
Beispiel #35
0
        public void TestMethodsOnService()
        {
            var testMethod = new JsonDictionary();
            testMethod.Add("id", "service.testMethod");
            testMethod.Add("path", "service/testMethod");
            testMethod.Add("httpMethod", "GET");
            var methods = new JsonDictionary() { { "testMethod", testMethod } };
            var dict = new JsonDictionary() { { "methods", methods }, { "name", "TestName" }, { "version", "v1" } };

            IService impl = new ConcreteClass(dict);
            Assert.IsNotNull(impl.Methods);
            Assert.AreEqual(1, impl.Methods.Count);
            Assert.AreEqual("testMethod", impl.Methods["testMethod"].Name);
        }
Beispiel #36
0
        public void TestOAuth2Scopes()
        {
            var scopes = new JsonDictionary();
            scopes.Add("https://www.example.com/auth/one", new Scope() { ID = "https://www.example.com/auth/one" });
            scopes.Add("https://www.example.com/auth/two", new Scope() { ID = "https://www.example.com/auth/two" });
            var oauth2 = new JsonDictionary() { { "scopes", scopes } };
            var auth = new JsonDictionary() { { "oauth2", oauth2 } };
            var dict = new JsonDictionary() { { "auth", auth }, { "name", "TestName" }, { "version", "v1" } };

            IService impl = new ConcreteClass(dict);
            Assert.IsNotNull(impl.Scopes);
            Assert.AreEqual(2, impl.Scopes.Count);
            Assert.IsTrue(impl.Scopes.ContainsKey("https://www.example.com/auth/one"));
            Assert.IsTrue(impl.Scopes.ContainsKey("https://www.example.com/auth/two"));
        }
Beispiel #37
0
        private static JsonDictionary ParseObject(TokenStream ts)
        {
            // to parse an object, you get the object name, and then parse the value
            JsonToken token = ts.GetNextToken();

            if (token.Type != JsonToken.TokenType.String && token.Type != JsonToken.TokenType.ObjectEnd)
            {
                throw new ArgumentException(
                    "Unable to parse object. Found object " + token +
                    " while looking for property name or object end.");
            }

            JsonDictionary dict = new JsonDictionary();
            if (token.Type != JsonToken.TokenType.ObjectEnd)
            {
                for (JsonToken cur = ts.GetNextToken(); cur != null; cur = ts.GetNextToken())
                {
                    switch (cur.Type)
                    {
                        case JsonToken.TokenType.ObjectEnd:
                            logger.Debug("Found object end");
                            return dict;
                        case JsonToken.TokenType.MemberSeperator:
                            token = ts.GetNextToken();
                            break;
                        case JsonToken.TokenType.NameSeperator:
                            object value = ParseExpression(null, ts);
                            if (dict.ContainsKey(token.Value))
                            {
                                throw new ArgumentException(
                                    "JsonObject contains duplicate definition for [" + token.Value + "]");
                            }
                            dict.Add(token.Value, value);
                            break;
                        default:
                            throw new ArgumentException(
                                "Found invalid Json was expecting } or , or : found " + cur);
                    }
                }
            }
            return dict;
        }
        public void SubresourceTest()
        {
            var topJson = new JsonDictionary();
            topJson.Add("resources", new JsonDictionary() { { "Sub", new JsonDictionary() } });

            // Create the resource hierachy and confirm results.
            var topResource = new Resource(ServiceFactory.Default, "Top", topJson);
            Assert.IsNotNull(topResource.Resources);
            Assert.AreEqual(1, topResource.Resources.Count);
            Assert.AreEqual("Sub", topResource.Resources["Sub"].Name);
            Assert.AreEqual(topResource, topResource.Resources["Sub"].Parent);
        }
Beispiel #39
0
 private IService CreateLegacyV03Service()
 {
     var dict = new JsonDictionary();
     dict.Add("name", "TestName");
     dict.Add("version", "v1");
     dict.Add("features", new[] { Features.LegacyDataResponse.GetStringValue() });
     return new ConcreteClass(dict);
 }
Beispiel #40
0
        public void SubresourceTest()
        {
            var topJson = new JsonDictionary();
            topJson.Add("resources", new JsonDictionary() { { "Sub", new JsonDictionary() } });

            // Create the resource hierachy and confirm results.
            var topResource = new ResourceV1_0(new KeyValuePair<string, object>("Top", topJson));
            Assert.IsNotNull(topResource.Resources);
            Assert.AreEqual(1, topResource.Resources.Count);
            Assert.AreEqual("Sub", topResource.Resources["Sub"].Name);
            Assert.AreEqual(topResource, topResource.Resources["Sub"].Parent);
        }
Beispiel #41
0
        public void TestSimpleGetters()
        {
            var dict = new JsonDictionary();
            dict.Add("name", "TestName");
            dict.Add("version", "v1");
            dict.Add("description", "Test Description");
            dict.Add("documentationLink", "https://www.google.com/");
            dict.Add("features", new List<object>{ "feature1", "feature2" });
            dict.Add("labels", new List<object>{ "label1", "label2" });
            dict.Add("id", "TestId");
            dict.Add("title", "Test API");

            IService impl = new ConcreteClass(dict);
            Assert.AreEqual("Test Description", impl.Description);
            Assert.AreEqual("https://www.google.com/", impl.DocumentationLink);
            MoreAsserts.ContentsEqualAndInOrder(new List<string> { "feature1", "feature2" }, impl.Features);
            MoreAsserts.ContentsEqualAndInOrder(new List<string> { "label1", "label2" }, impl.Labels);
            Assert.AreEqual("TestId", impl.Id);
            Assert.AreEqual("Test API", impl.Title);
        }
Beispiel #42
0
        public void TestPropertiesCase()
        {
            JsonDictionary dict = new JsonDictionary();
            string name = "TestName";
            dict.Add("location", "path");
            dict.Add("required", true);
            dict.Add("description", "A string description");
            dict.Add("default", "A default value");
            dict.Add("type", "string");
            dict.Add("repeated", true);
            dict.Add("enum", new List<string> { "atom", "json" });
            dict.Add("enumDescriptions", new List<string> { "atom are small particals", "json is my friend" });
            dict.Add("minimum", "43");
            dict.Add("maximum", "53");
            dict.Add("pattern", "[1-9][0-9]*");
            var impl = new ParameterFactory.BaseParameter(new KeyValuePair<string, object>(name, dict));

            Assert.AreEqual("TestName", impl.Name);
            Assert.AreEqual("path", impl.ParameterType);
            Assert.AreEqual("A string description", impl.Description);
            Assert.AreEqual("string", impl.ValueType);
            Assert.AreEqual(true, impl.IsRequired);
            Assert.AreEqual(true, impl.IsRepeatable);
            Assert.AreEqual("A default value", impl.DefaultValue);
            MoreAsserts.ContentsEqualAndInOrder(new List<string> { "atom", "json" }, impl.EnumValues);
            MoreAsserts.ContentsEqualAndInOrder(
                new List<string> { "atom are small particals", "json is my friend" }, impl.EnumValueDescriptions);
            Assert.AreEqual("53", impl.Maximum);
            Assert.AreEqual("43", impl.Minimum);
            Assert.AreEqual("[1-9][0-9]*", impl.Pattern);
        }
Beispiel #43
0
 JsonDictionary GetJson(string token, List<Song> songs)
 {
     JsonDictionary dict = new JsonDictionary();
     dict.Add(token, GetJson(songs));
     return dict;
 }