Ejemplo n.º 1
0
        public int UpdateSysParams(string userId, SysParams paras, int option)
        {
            var sysParas = GetSysParams(userId);

            if ((option != 2) && (userId != sysParas.AdminUserId))
            {
                return(-2);
            }

            if ((option == 1) && (paras == null))
            {
                paras = sysParas;
            }
            if (paras != null)
            {
                if (option != 2)
                {
                    paras.AdminUserId = sysParas.AdminUserId;
                }

                _db.Put(Key_Sys_Params, paras);
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Ejemplo n.º 2
0
        public DTOResponse SaveSysparams(BasicRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                SysParams entity = HelperSerializer.GetObjectFromJsonString <SysParams>(request.PostData);
                if (entity == null)
                {
                    throw new Exception("传入的参数无法解析!");
                }

                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <SysParams> expression1 = dbConn.From <SysParams>();
                    expression1.Where(x => x.ID == entity.ID);
                    expression1.UpdateFields.Add("PARAVALUE");

                    int count1 = dbConn.UpdateOnly <SysParams>(entity, expression1);
                    dtoResponse.TotalCount = count1;
                    dtoResponse.IsSuccess  = count1 == 1 ? true : false;

                    //dtoResponse.IsSuccess = dbConn.Update<SysParams>(entity);
                    dtoResponse.MessageText = "操作完成:" + dtoResponse.IsSuccess;
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 3
0
        public int FinishedOrder(string userId)
        {
            SysParams sysPara = GetSysParams("");
            DateTime  dt      = DateTime.Now;
            int       dt0     = dt.Hour * 60 + dt.Minute;

            if (dt0 < sysPara.Deadline)
            {
                return(-2001);
            }

            string key = GetCurrentDate();

            if (!_sendNotify.TryGetValue(key, out SendStatus status))
            {
                status = new SendStatus();
                _sendNotify.Add(key, status);
            }
            if (!status.Finished)
            {
                var orders           = GetOrders(userId, "", 1).ToList();
                var productType      = orders.First(p => p.UserId == userId).Product.Split('-')[0];
                var theSameTypeOrder = orders.Where(p => p.Product.StartsWith(productType));
                if (theSameTypeOrder.Any())
                {
                    var    ids = theSameTypeOrder.Select(p => p.UserId).Join(",");
                    string msg = $"小伙伴,{productType}到了,快来取哦!";
                    Utils.SendNotifyTextMsgEx(auther.GetAccessToken(), auther.AgentId, ids, msg);

                    return(0);
                }
                //if (orders.Count > 0)
                //{
                //    StringBuilder ids = new StringBuilder();
                //    foreach (Order order in orders)
                //    {
                //        if (userId != order.UserId)
                //        {
                //            ids.Append(order.UserId);
                //            ids.Append(',');
                //        }
                //    }
                //    ids.Length = ids.Length - 1;
                //    string msg = "小伙伴,餐到了,快来取哦!";
                //    Utils.SendNotifyTextMsgEx(auther.GetAccessToken(), auther.AgentId, ids.ToString(), msg);

                //    return 0;
                //}
                else
                {
                    return(-2003);
                }
            }
            else
            {
                return(-2002);
            }
        }
Ejemplo n.º 4
0
        public override JobExecuteState ExecuteCustomImp(string strJobKey)
        {
            JobExecuteState jobExecuteState1 = new JobExecuteState();
            DTOResponse     dtoResponse1     = new DTOResponse();
            DCSInfService   dcsInfService    = new DCSInfService();
            string          str1             = "AcceptWcsUpdateInfEquitmentStaus";
            DTOResponse     dtoResponse2     = SysParamsService.CheckPrarams(new SysParamsReuqest()
            {
                ParamsName = str1
            });
            bool isSuccess;

            if (dtoResponse2.IsSuccess)
            {
                SysParams resultObject = dtoResponse2.ResultObject as SysParams;
                if (resultObject == null)
                {
                    jobExecuteState1.MessageText = "系统参数为空";
                    return(jobExecuteState1);
                }
                if (resultObject.PARAVALUE == "TRUE")
                {
                    DTOResponse     dtoResponse3     = dcsInfService.UpdateEquipmentStatus();
                    JobExecuteState jobExecuteState2 = jobExecuteState1;
                    isSuccess = dtoResponse3.IsSuccess;
                    string str2 = isSuccess.ToString();
                    jobExecuteState2.ReturnValue = str2;
                    jobExecuteState1.MessageCode = dtoResponse3.MessageCode;
                    jobExecuteState1.MessageText = dtoResponse3.MessageText;
                }
            }
            string      str3         = "UpdateKanbanFormInfEquitmentStaus";
            DTOResponse dtoResponse4 = SysParamsService.CheckPrarams(new SysParamsReuqest()
            {
                ParamsName = str3
            });

            if (dtoResponse4.IsSuccess)
            {
                SysParams resultObject = dtoResponse4.ResultObject as SysParams;
                if (resultObject == null)
                {
                    jobExecuteState1.MessageText = "系统参数为空";
                    return(jobExecuteState1);
                }
                if (resultObject.PARAVALUE == "TRUE")
                {
                    DTOResponse     dtoResponse3     = dcsInfService.UpdateKanbanFormEquipmentStatus();
                    JobExecuteState jobExecuteState2 = jobExecuteState1;
                    isSuccess = dtoResponse3.IsSuccess;
                    string str2 = isSuccess.ToString();
                    jobExecuteState2.ReturnValue = str2;
                    jobExecuteState1.MessageCode = dtoResponse3.MessageCode;
                    jobExecuteState1.MessageText = dtoResponse3.MessageText;
                }
            }
            return(jobExecuteState1);
        }
Ejemplo n.º 5
0
        public int SendNotify(string userId, string mobs, int option)
        {
            DateTime  dt      = DateTime.Now;
            int       dt0     = dt.Hour * 60 + dt.Minute;
            SysParams sysPars = GetSysParams(userId);
            int       errcode = -1;

            if (((option & 0x01) == 0) || (dt0 > sysPars.Deadline))
            {
                var orders = GetOrders(userId, "", 12);
                if (orders == null || orders.Count == 0)
                {
                    return(-1002);
                }
                else
                {
                    StringBuilder msg = new StringBuilder();
                    foreach (var order in orders)
                    {
                        msg.Append($"品种:{order.Product}-{order.Memo} 数量;{order.Count}\n");
                    }
                    string msgText = msg.ToString();
                    if (!string.IsNullOrWhiteSpace(sysPars.AdminUserId) && (option & 0x02) != 0)
                    {
                        var rst = Utils.SendNotifyTextMsg(auther.GetAccessToken(), auther.AgentId, sysPars.AdminUserId, msgText);
                        if (rst.errcode == 0)
                        {
                            errcode = 0;
                        }
                    }
                    if ((string.IsNullOrEmpty(mobs) || (option & 0x04) != 0) && (!string.IsNullOrWhiteSpace(sysPars.ContactMob)))
                    {
                        mobs = mobs + "," + sysPars.ContactMob;
                    }
                    if (!string.IsNullOrWhiteSpace(mobs))
                    {
                        var svr = RometeClientManager.GetClient <INotifyMsgService>("https://oa.p9i.cn/Service/MsgNotifyJson.assx");
                        var ans = svr.SendMsgToMobs("", "", mobs, msgText);
                        if (ans.Success)
                        {
                            errcode = 0;
                        }
                    }
                    else
                    {
                        errcode = -1003;
                    }
                }
            }
            else
            {
                errcode = -1001;
            }

            return(errcode);
        }
Ejemplo n.º 6
0
    public static string Get(string key)
    {
        string    MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString();
        MRMISGADB db            = new MRMISGADB(MRMISGADBConn);
        SysParams entry         = db.SysParams.FirstOrDefault(p => p.Key.Trim() == key);

        if (entry == null)
        {
            return(string.Format("No {0} entry", key));
        }
        else
        {
            return(entry.Value);
        }
    }
Ejemplo n.º 7
0
        public int FinishedOrder(string userId)
        {
            SysParams sysPara = GetSysParams("");
            DateTime  dt      = DateTime.Now;
            int       dt0     = dt.Hour * 60 + dt.Minute;

            if (dt0 < sysPara.Deadline)
            {
                return(-2001);
            }

            string key = GetCurrentDate();

            if (!_sendNotify.TryGetValue(key, out SendStatus status))
            {
                status = new SendStatus();
                _sendNotify.Add(key, status);
            }
            if (!status.Finished)
            {
                var orders = GetOrders(userId, "", 1);
                if (orders.Count > 0)
                {
                    StringBuilder ids = new StringBuilder();
                    foreach (Order order in orders)
                    {
                        if (userId != order.UserId)
                        {
                            ids.Append(order.UserId);
                            ids.Append(',');
                        }
                    }
                    ids.Length = ids.Length - 1;
                    string msg = "小伙伴,餐到了,快来取哦!";
                    Utils.SendNotifyTextMsgEx(auther.GetAccessToken(), auther.AgentId, ids.ToString(), msg);

                    return(0);
                }
                else
                {
                    return(-2003);
                }
            }
            else
            {
                return(-2002);
            }
        }
Ejemplo n.º 8
0
        public int PlaceOrder(string userId, string product, int count, string memo)
        {
            var userinfo = auther.GetUserinfo(userId);

            if (userinfo == null)
            {
                return(-1);
            }

            Initial();
            string deptName = "";

            if (userinfo.department != null && userinfo.department.Length > 0)
            {
                _deptName.TryGetValue(userinfo.department[0], out deptName);
            }

            SysParams sysPara = GetSysParams("");

#if !DEBUG
            DateTime dt  = DateTime.Now;
            int      dt0 = dt.Hour * 60 + dt.Minute;
            if ((dt0 > sysPara.Deadline) || (dt0 + 120 < sysPara.Deadline))
            {
                //throw new Exception("不在订餐时间");
                return(-2);
            }
#endif

            Order value = new Order();
            value.UserId = userId;
            value.Name   = userinfo.name;
            value.DeptId = deptName;
            if (count <= 0)
            {
                count = 1;
            }
            value.Count     = count;
            value.Product   = product;
            value.Memo      = memo;
            value.CheckTime = DateTime.Now;
            string ordersKey = GetOrdersKey(GetCurrentDate());
            _db.HPut(ordersKey, userId, value);
            _db.HPut(Key_LastOrder, userId, value);

            return(0);
        }
Ejemplo n.º 9
0
    public static void Update(string key, string value)
    {
        MrTimeZone etz           = new MrTimeZone();
        string     MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString();
        MRMISGADB  db            = new MRMISGADB(MRMISGADBConn);
        SysParams  entry         = db.SysParams.FirstOrDefault(p => p.Key.Trim() == key);

        if (entry != null)
        {
            entry.Value      = value;
            entry.ChangeDate = etz.eastTimeNow();
        }
        else
        {
            SysParams sp = new SysParams
            {
                Key        = key,
                Value      = value,
                ChangeDate = etz.eastTimeNow()
            };
            db.SysParams.InsertOnSubmit(sp);
        }
        db.SubmitChanges();

/*)
 *      MRParams entry = db.MRParams.FirstOrDefault(p => p.Key.Trim() == keyLastDate);
 *      if (entry != null)
 *      {
 *          LastDate = Convert.ToDateTime((string)entry.Value);
 *          changeDate = (DateTime)entry.ChangeDate;
 *      }
 *      else
 *      {
 *          int curyear = etz.eastTimeNow().Year;
 *          LastDate = new DateTime(curyear, 3, 1, 23, 59, 59, System.Globalization.CultureInfo.InvariantCulture.Calendar);
 *          changeDate = etz.eastTimeNow();
 *          MRParams newParm = new MRParams();
 *          newParm.Key = keyLastDate;
 *          newParm.Value = LastDate.ToString();
 *          newParm.ChangeDate = changeDate;
 *          db.MRParams.InsertOnSubmit(newParm);
 *          db.SubmitChanges();
 *      }
 *      lblDateLastChanged.Text = "Date Last Changed: " + changeDate.ToString();
 */
    }
Ejemplo n.º 10
0
        public SysParams GetSysParams(string userId)
        {
            SysParams sysPara = null;

            if (!_db.Get <SysParams>(Key_Sys_Params, out sysPara))
            {
                sysPara = ConfigurationManager.GetSection <SysParams>("SysParams");
                if (sysPara == null)
                {
                    sysPara             = new SysParams();
                    sysPara.ContactMob  = "";
                    sysPara.AdminUserId = "";
                    sysPara.Deadline    = 17 * 60 + 30;
                }
            }

            return(sysPara);
        }
Ejemplo n.º 11
0
 public string[] UnitChipArray(int Cols)
 {
     if (SysParams.Count > 0)/*UnitChipArray*/
     {
         if (!SysParams.ContainsKey("Exchange"))
         {
             return(new string[0]);
         }
         if (!SysParams["Exchange"].ContainsKey("Serial" + Cols.ToString()))
         {
             return(new string[0]);
         }
         if (SysParams["Exchange"]["Serial" + Cols.ToString()] != null)
         {
             return(SysParams["Exchange"]["Serial" + Cols.ToString()].Split(','));
         }
     }
     return(new string[0]);
 }
Ejemplo n.º 12
0
        public BaseTemplateForm()
        {
            BackGround     = new TextureBrush(Resources.title_block_01);
            BackGroundFill = new TextureBrush(Resources.line_blue_02);
            InitializeComponent();
            SysParams.InitParams();
            //this.SetStyle(ControlStyles.AllPaintingInWmPaint |
            //ControlStyles.OptimizedDoubleBuffer |
            //ControlStyles.UserPaint, true);


            //this.SetStyle(
            //ControlStyles.SupportsTransparentBackColor |
            //ControlStyles.ResizeRedraw, true);
            SetBtnLocation();
            chkLocalDBDelegate cdb = chkLocalDB;

            cdb.BeginInvoke(null, null);
        }
Ejemplo n.º 13
0
        public void add(string user1, string user2)
        {
            DataTable dt = Common.retTalkHistory(user1, user2);

            CefSharp.IFrame ifm = browser.GetBrowser().MainFrame;
            this.comm.CallJS(browser, " clearAll()");
            // this.CallJS(browser, addFunctionStr);
            if (dt != null && dt.Rows.Count > 0)
            {
                string messageDate = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow        dr         = dt.Rows[i];
                    string         fromid     = dr["fromjid"].ToString();
                    string         toid       = dr["tojid"].ToString();
                    string         contentStr = dr["body"].ToString();
                    Int64          tmpval     = Convert.ToInt64(dr["SENTDATE"].ToString());
                    DateTime       d          = new DateTime(1970, 1, 1).ToLocalTime().AddMilliseconds(long.Parse(dr["SENTDATE"].ToString()));
                    string         dateTime   = d.ToString("yyyy-MM-dd HH:mm:ss");
                    ChatBoxContent content    = new ChatBoxContent();
                    content.Text = contentStr;
                    string messType = SysParams.retSysMessage(contentStr);
                    if (messageDate != d.ToString("yyyy-MM-dd"))
                    {
                        //添加间隔线和日期

                        messageDate = d.ToString("yyyy-MM-dd");
                        this.chatClass.AppendHistoryLine(this.browser, messageDate);
                    }
                    this.chatClass.AppendChatBoxContentAll(this.browser, messType, fromid, d, content,
                                                           this.mform.MineID, this.mform.FriendID, Color.SeaGreen, true, true);

                    //this.AppendChatBoxContentAll(messType, fromid, d, content, Color.SeaGreen, true, true);
                }
            }
        }
Ejemplo n.º 14
0
    public static void Update(string key, string value)
    {
        MrTimeZone etz           = new MrTimeZone();
        string     MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString();
        MRMISGADB  db            = new MRMISGADB(MRMISGADBConn);
        SysParams  entry         = db.SysParams.FirstOrDefault(p => p.Key.Trim() == key);

        if (entry != null)
        {
            entry.Value      = value;
            entry.ChangeDate = etz.eastTimeNow();
        }
        else
        {
            SysParams sp = new SysParams
            {
                Key        = key,
                Value      = value,
                ChangeDate = etz.eastTimeNow()
            };
            db.SysParams.InsertOnSubmit(sp);
        }
        db.SubmitChanges();
    }
Ejemplo n.º 15
0
 public int UpdateSysParams(string userId, SysParams paras, int option)
 {
     return(_orders.UpdateSysParams(userId, paras, option));
 }