예제 #1
0
 public string Add(SYS_PARAMSMODEL model)
 {
     return(SYS_PARAMSDAL.Instance.Insert(model));
 }
예제 #2
0
 public int Update(SYS_PARAMSMODEL model)
 {
     return(SYS_PARAMSDAL.Instance.Update(model));
 }
예제 #3
0
        public string SettinSave(FormCollection context)
        {
            try
            {
                //var list = SYS_PARAMSBLL.Instance.GetWhereKey("IntervalSP");
                //SYS_PARAMSBLL.Instance.DeleteAll();

                //string result = "";
                //SYS_PARAMSMODEL model = new SYS_PARAMSMODEL();

                //var intervalSP = Request["intervalSP"];
                //model.FKEY = "IntervalSP";
                //model.FVALUE = intervalSP;
                //model.FDESCRIPTION = "商品资料同步时间间隔(秒)";
                //result = SYS_PARAMSBLL.Instance.Add(model);

                //var intervalCG = Request["intervalCG"];
                //model.FKEY = "IntervalCG";
                //model.FVALUE = intervalCG;
                //model.FDESCRIPTION = "采购订单同步时间间隔(秒)";
                //result = SYS_PARAMSBLL.Instance.Add(model);

                //var intervalFH = Request["intervalFH"];
                //model.FKEY = "IntervalFH";
                //model.FVALUE = intervalFH;
                //model.FDESCRIPTION = "发货通知同步时间间隔(秒)";
                //result = SYS_PARAMSBLL.Instance.Add(model);

                //var intervalXS = Request["intervalXS"];
                //model.FKEY = "IntervalXS";
                //model.FVALUE = intervalXS;
                //model.FDESCRIPTION = "销售出库同步时间间隔(秒)";
                //result = SYS_PARAMSBLL.Instance.Add(model);

                //var inventoryMax = Request["inventoryMax"];
                //model.FKEY = "InventoryMax";
                //model.FVALUE = inventoryMax;
                //model.FDESCRIPTION = "配柜库存浮动上限";
                //result = SYS_PARAMSBLL.Instance.Add(model);

                //var inventoryMin = Request["inventoryMin"];
                //model.FKEY = "InventoryMin";
                //model.FVALUE = inventoryMin;
                //model.FDESCRIPTION = "配柜库存浮动下限";
                //result = SYS_PARAMSBLL.Instance.Add(model);

                var             list       = SYS_PARAMSBLL.Instance.GetAll();
                SYS_PARAMSMODEL model      = new SYS_PARAMSMODEL();
                var             intervalSP = Request["intervalSP"];
                bool            isHave     = false;
                foreach (var item in list)
                {
                    if (item.FKEY == "IntervalSP")
                    {
                        item.FVALUE = intervalSP;
                        SYS_PARAMSBLL.Instance.Update(item);
                        isHave = true;
                        break;
                    }
                }
                if (!isHave)
                {
                    model.FKEY         = "IntervalSP";
                    model.FVALUE       = intervalSP;
                    model.FDESCRIPTION = "商品资料同步时间间隔(秒)";
                    SYS_PARAMSBLL.Instance.Add(model);
                }
                var intervalCG = Request["intervalCG"];
                isHave = false;
                foreach (var item in list)
                {
                    if (item.FKEY == "IntervalCG")
                    {
                        item.FVALUE = intervalCG;
                        SYS_PARAMSBLL.Instance.Update(item);
                        isHave = true;
                        break;
                    }
                }
                if (!isHave)
                {
                    model.FKEY         = "IntervalCG";
                    model.FVALUE       = intervalCG;
                    model.FDESCRIPTION = "采购订单同步时间间隔(秒)";
                    SYS_PARAMSBLL.Instance.Add(model);
                }
                var intervalFH = Request["intervalFH"];
                isHave = false;
                foreach (var item in list)
                {
                    if (item.FKEY == "IntervalFH")
                    {
                        item.FVALUE = intervalFH;
                        SYS_PARAMSBLL.Instance.Update(item);
                        isHave = true;
                        break;
                    }
                }
                if (!isHave)
                {
                    model.FKEY         = "IntervalFH";
                    model.FVALUE       = intervalFH;
                    model.FDESCRIPTION = "发货通知同步时间间隔(秒)";
                    SYS_PARAMSBLL.Instance.Add(model);
                }

                var intervalXS = Request["intervalXS"];
                isHave = false;
                foreach (var item in list)
                {
                    if (item.FKEY == "IntervalXS")
                    {
                        item.FVALUE = intervalXS;
                        SYS_PARAMSBLL.Instance.Update(item);
                        isHave = true;
                        break;
                    }
                }
                if (!isHave)
                {
                    model.FKEY         = "IntervalXS";
                    model.FVALUE       = intervalXS;
                    model.FDESCRIPTION = "销售出库同步时间间隔(秒)";
                    SYS_PARAMSBLL.Instance.Add(model);
                }

                var inventoryMax = Request["inventoryMax"];
                isHave = false;
                foreach (var item in list)
                {
                    if (item.FKEY == "InventoryMax")
                    {
                        item.FVALUE = inventoryMax;
                        SYS_PARAMSBLL.Instance.Update(item);
                        isHave = true;
                        break;
                    }
                }
                if (!isHave)
                {
                    model.FKEY         = "InventoryMax";
                    model.FVALUE       = inventoryMax;
                    model.FDESCRIPTION = "配柜库存浮动上限";
                    SYS_PARAMSBLL.Instance.Add(model);
                }

                var inventoryMin = Request["inventoryMin"];
                isHave = false;
                foreach (var item in list)
                {
                    if (item.FKEY == "InventoryMin")
                    {
                        item.FVALUE = inventoryMin;
                        SYS_PARAMSBLL.Instance.Update(item);
                        isHave = true;
                        break;
                    }
                }
                if (!isHave)
                {
                    model.FKEY         = "InventoryMin";
                    model.FVALUE       = inventoryMin;
                    model.FDESCRIPTION = "配柜库存浮动下限";
                    SYS_PARAMSBLL.Instance.Add(model);
                }

                return(JSONhelper.ToJson("保存成功!"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(ex.Message);
            }
        }