Beispiel #1
0
        private void Initial()
        {
            if (_deptName.Count > 0)
            {
                return;
            }

            try
            {
                var svr       = RometeClientManager.GetClient <IDepartmentAPI>("https://oapi.dingtalk.com/department");
                var tempDepts = svr.list(auther.GetAccessToken(), 1, true);
                Dictionary <int, Department> depts = new Dictionary <int, Department>();
                foreach (Department dept in tempDepts.department)
                {
                    depts.Add(dept.id, dept);
                }
                foreach (Department dept in tempDepts.department)
                {
                    Department dp = dept;
                    while (dp.parentid != 1)
                    {
                        dp = depts[dp.parentid];
                    }
                    _deptName.Add(dept.id, dp.name);
                }
            }
            catch
            {
                _deptName.Clear();
            }
        }
Beispiel #2
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);
        }
Beispiel #3
0
 public override void Run()
 {
     try
     {
         IUserAuther auther = RometeClientManager.GetClient(PsPropertiesUtil.GetProperties(context, "loginUrl"), typeof(IUserAuther), 60000) as IUserAuther;
         context.user.LoginResult = auther.Login(context.user.UserName, context.user.Password, context.user.IMEI);
         context.handler.SendEmptyMessage(Login.RETURN);
     }
     catch (WebException e)
     {
         Log.Error("LoginActivity", e.ToString());
         LogUtil.SaveLogInfoToFile(e.ToString());
         context.handler.SendEmptyMessage(Login.NETERROR);
     }
     catch (System.Exception e1)
     {
         Log.Error("LoginActivity", e1.ToString());
         LogUtil.SaveLogInfoToFile(e1.ToString());
         context.handler.SendEmptyMessage(Login.ERROR);
     }
 }
Beispiel #4
0
 public override void Run()
 {
     try
     {
         ISharedPreferences mSharedPreference = context.GetSharedPreferences(Constant.Com_Fra, FileCreationMode.WorldWriteable);
         IEnvManagerSvr     newinfo           = RometeClientManager.GetClient(PsPropertiesUtil.GetProperties(context, "loadinfoUrl"), typeof(IEnvManagerSvr), 60000) as IEnvManagerSvr;
         AppEnvironment     appenvironment    = newinfo.GetUserEnv(mSharedPreference.GetString(Constant.PS_UTAG, ""), 0);
         Message            msg    = context.mainhandler.ObtainMessage();
         Bundle             bundle = new Bundle();
         bundle.PutString("HeaderURL", appenvironment.MainPage.HeadUrl);
         bundle.PutInt("HeaderHeight", appenvironment.MainPage.HeadHeight);
         bundle.PutString("LoadImg", appenvironment.SplashImg);
         ObjList  list       = appenvironment.MainPage.FuncDefs;
         string[] funsname   = new string[list.Count];
         string[] funurl     = new string[list.Count];
         string[] funiconurl = new string[list.Count];
         string[] funsbdnurl = new string[list.Count];
         for (int i = 0; i < list.Count; i++)
         {
             funsname[i]   = (list[i] as FuncEntry).Title;
             funurl[i]     = (list[i] as FuncEntry).Url;
             funiconurl[i] = (list[i] as FuncEntry).IconUrl;
             funsbdnurl[i] = (list[i] as FuncEntry).StateUrl;
         }
         bundle.PutStringArray("funsname", funsname);
         bundle.PutStringArray("funsurl", funurl);
         bundle.PutStringArray("funsiconurl", funiconurl);
         bundle.PutStringArray("funsbdnurl", funsbdnurl);
         msg.Data   = bundle;
         msg.What   = 1;
         msg.Target = context.mainhandler;
         msg.SendToTarget();
     }
     catch (System.Exception e)
     {
         throw;
     }
 }