Пример #1
0
        public JsonResult SaveLableColor(string lablecolor, int lableType)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            LableColorEntity     model      = serializer.Deserialize <LableColorEntity>(lablecolor);

            model.CreateUserID = CurrentUser.UserID;
            model.ClientID     = CurrentUser.ClientID;
            model.Status       = 0;
            int ColorID = -1;

            if (model.ColorID == 0)
            {
                ColorID = SystemBusiness.BaseBusiness.CreateLableColor(model.ColorName, model.ColorValue,
                                                                       model.ClientID, model.CreateUserID, model.Status, (EnumMarkType)lableType);
            }
            else
            {
                int bl = SystemBusiness.BaseBusiness.UpdateLableColor(model.ClientID, model.ColorID,
                                                                      model.ColorName, model.ColorValue, CurrentUser.UserID, (EnumMarkType)lableType);
                ColorID = bl > 0 ? model.ColorID : bl;
            }
            JsonDictionary.Add("ID", ColorID);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #2
0
        public List <LableColorEntity> GetLableColor(string clientid, EnumMarkType lableType)
        {
            string tableName = "";

            if (lableType == EnumMarkType.Customer)
            {
                tableName = "CustomerColor";
                if (CustomColor.ContainsKey(clientid))
                {
                    return(CustomColor[clientid]);
                }
            }
            else if (lableType == EnumMarkType.Orders)
            {
                tableName = "OrderColor";
                if (OrderColor.ContainsKey(clientid))
                {
                    return(OrderColor[clientid]);
                }
            }
            else if (lableType == EnumMarkType.Tasks)
            {
                tableName = "TaskColor";
                if (TaskColor.ContainsKey(clientid))
                {
                    return(TaskColor[clientid]);
                }
            }

            List <LableColorEntity> list = new List <LableColorEntity>();
            DataTable dt = LableColorDAL.BaseProvider.GetLableColor(tableName, clientid);

            foreach (DataRow dr in dt.Rows)
            {
                LableColorEntity model = new LableColorEntity();
                model.FillData(dr);
                list.Add(model);
            }

            if (lableType == EnumMarkType.Customer)
            {
                CustomColor.Add(clientid, list);
            }
            else if (lableType == EnumMarkType.Orders)
            {
                OrderColor.Add(clientid, list);
            }
            else if (lableType == EnumMarkType.Tasks)
            {
                TaskColor.Add(clientid, list);
            }
            return(list);
        }