Exemple #1
0
        internal async Task <bool> DeleteLabel(Label label)
        {
            if (!await RefreshToken())
            {
                return(false);
            }

            MailApi api = new MailApi();

            int?charid  = (int?)mDBAccount.CharacterId;
            int?labelid = (int?)label.Id;

            try
            {
                await api.DeleteCharactersCharacterIdMailLabelsLabelIdAsync(
                    characterId : charid,
                    labelId : labelid,
                    datasource : ESIConfiguration.DataSource,
                    token : DBAccount.AccessToken);

                mLabels.Remove(label);
                ViewAccount.Sync(this);
                return(true);
            }
            catch (Eve.Api.Client.ApiException e)
            {
                ExceptionHandler.HandleApiException(null, e);
                return(false);
            }
        }
Exemple #2
0
        private void Command_ShowWindow(object sender, CommandEventArgs e)
        {
            mLog.Info("ShowWindow command received");
            StartTimer();

            if (e.Command.Args.Length == 1)
            {
                ViewAccount account = null;
                foreach (var i in Client.ViewAccounts)
                {
                    if (i.Id.ToString() != e.Command.Args[0] && i.UserName != e.Command.Args[0])
                    {
                        i.IsSelected = false;
                    }
                    else
                    {
                        i.IsSelected = true;
                        account      = i;
                    }
                }
            }

            if (MailWindow == null)
            {
                MailWindow         = new MainWindow();
                MailWindow.Closed += (a, b) => MailWindow = null;
                MailWindow.Show();
            }
            e.Handle = new WindowInteropHelper(MailWindow).Handle;
        }
        /// <summary>
        /// 根据当前行设置按钮显示方式
        /// </summary>
        /// <param name="m_Row"></param>
        private void SetControl(int m_Row)
        {
            if (ViewAccount.RowCount < 1)
            {
                this.txt_TranscationID.Text = this.txt_Account.Text = string.Empty;
                this.btn_UnFreeze.Enabled   = this.btn_Freeze.Enabled = this.chk_IsAutoRelieve.Enabled = false;
                return;
            }
            DataRow dw = ViewAccount.GetDataRow(m_Row);

            int    userID    = int.Parse(dw["UserID"].ToString());
            string AccountID = dw["DealerAccoutID"].ToString();

            this.txt_TranscationID.Text = userID.ToString();
            this.txt_Account.Text       = AccountID;
            object obj  = dw["IsDo"];
            bool   IsDo = (bool)obj;

            //没有冻结的帐号
            if (IsDo)
            {
                this.btn_UnFreeze.Enabled      = false;
                this.btn_Freeze.Enabled        = true;
                this.chk_IsAutoRelieve.Enabled = true;
            }
            //冻结冻结的帐号
            else
            {
                this.btn_UnFreeze.Enabled      = true;
                this.btn_Freeze.Enabled        = false;
                this.chk_IsAutoRelieve.Enabled = false;
            }
        }
Exemple #4
0
        public ViewAccount GetUserClaims()
        {
            var identityClaims         = (ClaimsIdentity)User.Identity;
            IEnumerable <Claim> claims = identityClaims.Claims;
            ViewAccount         model  = new ViewAccount()
            {
                UserName  = identityClaims.FindFirst("Username").Value,
                Email     = identityClaims.FindFirst("Email").Value,
                FirstName = identityClaims.FindFirst("FirstName").Value,
                LastName  = identityClaims.FindFirst("LastName").Value,
                ClientId  = identityClaims.FindFirst("UserId").Value,
                PhoneNo   = identityClaims.FindFirst("PhoneNo").Value,
                JobType   = identityClaims.FindFirst("JobType").Value,
            };

            return(model);
        }
Exemple #5
0
        public void Load(ViewAccount account)
        {
            mUndoHistory.Clear();
            UndoIndex = 0;
            mLabelItems.Clear();
            mAccount = account;
            foreach (ViewLabel i in account.Labels)
            {
                if (i.Type == LabelType.MailingList)
                {
                    continue;
                }

                mLabelItems.Add(new LabelItem(this, i));
            }
            CanEdit = true;
        }
Exemple #6
0
        public void TreezeSingle_User_MoneyTypeConfig_Decimal_String_test()
        {
            var user       = Resolve <IUserService>().PlatformUser();
            var moneyTypes = Resolve <IAutoConfigService>().GetList <MoneyTypeConfig>(r => r.Status == Status.Normal)
                             .ToList();

            foreach (var moneyType in moneyTypes)
            {
                var typeConfig = moneyType;
                var view       = new ViewAccount
                {
                    Amount     = new Random().Next(100, 1000).ToDecimal(),
                    ActionType = 1
                };
                var result = Resolve <IBillService>().TreezeSingle(user, typeConfig, 0.01m, "²âÊÔ¶³½á");
                Assert.True(result.Succeeded);
            }
        }
Exemple #7
0
        public void EfCoreRepositoryContext_Tests()
        {
            var user       = Resolve <IUserService>().PlanformUser();
            var moneyTypes = Resolve <IAutoConfigService>().GetList <MoneyTypeConfig>(r => r.Status == Status.Normal)
                             .ToList();

            foreach (var moneyType in moneyTypes)
            {
                var index = new Random().Next(0, moneyTypes.Count);
                var view  = new ViewAccount
                {
                    Amount     = new Random().Next(100, 1000).ToDecimal(),
                    ActionType = 1
                };
                var result = Resolve <IBillService>().Increase(user, moneyType, view.Amount, view.Remark);
                Assert.True(result.Succeeded);
            }
        }
Exemple #8
0
        internal async Task <bool> AddLabel(string label_name)
        {
            if (!await RefreshToken())
            {
                return(false);
            }

            MailApi api = new MailApi();

            int?charid = (int?)mDBAccount.CharacterId;
            PostCharactersCharacterIdMailLabelsLabel label = new PostCharactersCharacterIdMailLabelsLabel(
                PostCharactersCharacterIdMailLabelsLabel.ColorEnum.Ffffff, label_name);

            try
            {
                int?labelid = await api.PostCharactersCharacterIdMailLabelsAsync(
                    characterId : charid,
                    label : label,
                    datasource : ESIConfiguration.DataSource,
                    token : DBAccount.AccessToken);

                if (!labelid.HasValue)
                {
                    return(false);
                }

                mLabels.Add(new Label(mClient, this, labelid ?? -1, label_name, LabelType.Label));
                ViewAccount.Sync(this);
                return(true);
            }
            catch (Eve.Api.Client.ApiException e)
            {
                ExceptionHandler.HandleApiException(null, e);
                return(false);
            }
        }
Exemple #9
0
        // GET: Accounts
        // 如果这里参数名str为id可以通过 Accounts/Index/{id}或Accounts/Index?id={id} 来进行检索
        public async Task <IActionResult> Index(string str, int?deptid)
        {
            IQueryable <Deptment> deptQuery = from m in _context.Deptment orderby m.Sort select m;

            var accounts = from m in _context.Account select m;

            if (!string.IsNullOrEmpty(str))
            {
                accounts = accounts.Where(s => s.Name.Contains(str));
            }

            if (!(deptid is null))
            {
                accounts = accounts.Where(s => s.DeptmentId == deptid);
            }

            var viewAccount = new ViewAccount()
            {
                Accounts = await accounts.ToListAsync(),
                Depts    = new SelectList(await deptQuery.Distinct().ToListAsync(), "Id", "Name")
            };

            return(View(viewAccount));
        }
Exemple #10
0
        internal void UpdateAccountCounts(ViewMailItem item)
        {
            int[,] statetable = new int[, ]
            {
                //Label Added|Label Removed|No Change(True)|No Change(False)
                { 0, -1, -1, 0 }, /*Read Set*/
                { 1, 0, 1, 0 },   /*Read Unset*/
                { 1, -1, 0, 0 },  /*No Change(Unread)*/
                { 0, 0, 0, 0 }    /*No Change(Read)*/
            };

            int readstate = -1;

            if (item.MetaState.HasFlag(ViewMailMetaState.ReadFlagSet))
            {
                readstate = 0;
                UnreadCount--;
            }
            else if (item.MetaState.HasFlag(ViewMailMetaState.ReadFlagUnset))
            {
                readstate = 1;
                UnreadCount++;
            }
            else if (item.IsItemUnread)
            {
                readstate = 2;
            }
            else
            {
                readstate = 3;
            }

            if (UnreadCount < 0)
            {
                UnreadCount = 0;
            }

            for (int i = 0; i < item.Labels.Count; i++)
            {
                var vlabel = item.Labels[i];

                Label label      = ((ISourceInfo)vlabel.Label).LabelSource as Label;
                int   labelstate = -1;

                if (vlabel.MetaState.HasFlag(ViewMailMetaState.LabelAdded))
                {
                    labelstate = 0;
                }
                else if (vlabel.MetaState.HasFlag(ViewMailMetaState.LabelRemoved))
                {
                    labelstate = 1;
                }
                else if (vlabel.Subscribed)
                {
                    labelstate = 2;
                }
                else
                {
                    labelstate = 3;
                }



                label.UnreadCount += statetable[readstate, labelstate];

                MailCache cache = GetCache(label);

                if (cache != null && cache.IsValid)
                {
                    cache.MailItems.Remove(item);

                    if (vlabel.Subscribed)
                    {
                        cache.MailItems.Add(item);
                    }
                }
            }

            ViewAccount.Sync(this);
        }
Exemple #11
0
 public ActionResult LogOn(ViewAccount model, string returnUrl)
 {
     return(RedirectToAction("Index", "Dashboard"));
 }
Exemple #12
0
        public ViewAccount GetUserClaims()
        {
            var identityClaims         = (ClaimsIdentity)User.Identity;
            IEnumerable <Claim> claims = identityClaims.Claims;
            var    id          = claims.FirstOrDefault().Value;
            string firstname   = "";
            string lastname    = "";
            string phoneno     = "";
            string profilepic  = "";
            string CountryCode = "";
            var    usertype    = id.Split('-')[0];

            string fileName = id + ".Jpeg";

            try
            {
                if (usertype == "NCM" || usertype == "NCF")
                {
                    var patient = this._clientDetailRepo.GetAll().Where(x => x.ClientId == id).FirstOrDefault();
                    if (patient != null)
                    {
                        string[] fileEntries = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/ProfilePic"));
                        firstname   = patient.FirstName;
                        lastname    = patient.LastName;
                        phoneno     = Convert.ToString(patient.MobileNo);
                        CountryCode = Convert.ToString(patient.CountryCode);
                        foreach (var item in fileEntries)
                        {
                            if (fileName == Path.GetFileName(item))
                            {
                                profilepic = $"{constant.imgUrl}/ProfilePic/{fileName}";
                            }
                        }
                    }
                }
                else if (usertype == "NCD")
                {
                    var doctor = this._doctorRepository.GetAll().Where(x => x.DoctorId == id).FirstOrDefault();
                    if (doctor != null)
                    {
                        firstname   = doctor.FirstName;
                        lastname    = doctor.LastName;
                        phoneno     = doctor.PhoneNumber;
                        CountryCode = Convert.ToString(doctor.CountryCode);
                        string[] fileEntries = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/ProfilePic/Doctor"));
                        foreach (var item in fileEntries)
                        {
                            if (fileName == Path.GetFileName(item))
                            {
                                profilepic = $"{constant.imgUrl}/ProfilePic/Doctor/{fileName}";
                            }
                        }
                        //profilepic = $"{constant.baseUrl}/ProfilePic/{doctor.PhotoPath}";
                    }
                }
                else if (usertype == "NCS")
                {
                    var secretary = this._secretaryRepository.GetAll().Where(x => x.SecretaryId == id).FirstOrDefault();
                    if (secretary != null)
                    {
                        firstname   = secretary.FirstName;
                        lastname    = secretary.LastName;
                        phoneno     = secretary.PhoneNumber;
                        CountryCode = Convert.ToString(secretary.CountryCode);
                        string[] fileEntries = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/ProfilePic/Secretary"));
                        foreach (var item in fileEntries)
                        {
                            if (fileName == Path.GetFileName(item))
                            {
                                profilepic = $"{constant.imgUrl}/ProfilePic/Secretary/{fileName}";
                            }
                        }
                    }
                }
                else
                {
                    var hospital = this._hospitalDetailsRepository.GetAll().Where(x => x.HospitalId == id).FirstOrDefault();
                    if (hospital != null)
                    {
                        firstname = hospital.HospitalName;
                        phoneno   = hospital.Mobile.ToString();
                        string[] fileEntries = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/ProfilePic/Hospital"));
                        foreach (var item in fileEntries)
                        {
                            if (fileName == Path.GetFileName(item))
                            {
                                profilepic = $"{constant.imgUrl}/ProfilePic/Hospital/{fileName}";
                            }
                        }
                        //profilepic = $"{constant.baseUrl}/{hospital.ProfilePath}";
                    }
                }
            }catch (Exception ex) { }
            ViewAccount model = new ViewAccount()
            {
                UserName   = identityClaims.FindFirst("Username").Value,
                Email      = identityClaims.FindFirst("Email").Value,
                FirstName  = firstname,          //identityClaims.FindFirst("FirstName").Value,
                LastName   = lastname,           //identityClaims.FindFirst("LastName").Value,
                ClientId   = identityClaims.FindFirst("UserId").Value,
                PhoneNo    = phoneno.ToString(), //identityClaims.FindFirst("PhoneNo").Value,
                JobType    = identityClaims.FindFirst("JobType").Value,
                ProfilePic = profilepic
            };

            return(model);
        }
 private void ViewAccountBtn_Click(object sender, EventArgs e)
 {
     Admin.LoadAccountWindow(NAME_SM, USERID_SM, PASSWORD_SM, CONTACTNUMBER_SM, ADDRESS_SM, JOINDATE_SM, IMAGE_SM);
     ViewAccount.Show();
     ViewAccount.BringToFront();
 }