protected void btnAgentProvider_Click(object sender, EventArgs e)
    {
        User    u = Profile.AccountInfo;
        Company c = u.Company;

        if (string.IsNullOrEmpty(c.Regcode) || string.IsNullOrEmpty(c.Orgcode) || string.IsNullOrEmpty(c.Phone))
        {
            throw new HHException(ExceptionType.OperationError, "操作失败,进行申请前请进入【公司信息】页完善公司相关信息,包括【联系电话】,【组织结构代码】,【工商注册号】等。");
        }
        else
        {
            Pending p = new Pending();
            p.CompanyID = c.CompanyID;
            switch ((sender as Button).PostBackUrl)
            {
            case "#Agent":
                p.CompanyType = CompanyType.Agent | c.CompanyType;
                break;

            case "#Provider":
                p.CompanyType = CompanyType.Provider | c.CompanyType;
                break;
            }
            p.CreateTime = DateTime.Now;
            p.CreateUser = u.UserID;
            p.DenyReason = string.Empty;
            p.Status     = PendingStatus.Pending;
            p.UpdateTime = DateTime.Now;
            p.UpdateUser = u.UserID;
            bool r = Pendings.PendingAdd(p);
            if (r)
            {
                BindCompanyType();
            }
            else
            {
                throw new HHException(ExceptionType.OperationError, "操作失败,申请过程中发生了错误,请联系管理员!");
            }
        }
    }
    void BindCompanyType()
    {
        if (Profile.AccountInfo.UserType == UserType.InnerUser)
        {
            mbNC.ShowMsg("内部用户无法查看客户状态!", System.Drawing.Color.Red);
            pnlManager.Visible = false;
        }
        else
        {
            mbNC.HideMsg();
            User u = Profile.AccountInfo;
            AdaptButton(u.Company.CompanyType);

            ltComType.Text = GetCompantType(u.Company.CompanyType);

            Pending pend = Pendings.PendingGet(u.CompanyID);
            if (pend == null)
            {
                ltPendingCom.Text = "--";
            }
            else
            {
                ltPendingCom.Text = GetCompantType(pend.CompanyType);
                ltStatus.Text     = GetStatus(pend.Status);
                if (pend.Status == PendingStatus.Deny && !string.IsNullOrEmpty(pend.DenyReason))
                {
                    ltDenyUser.Text = "<span style='color:#ff0000'>" +
                                      Users.GetUser(pend.UpdateUser).DisplayName +
                                      ": </span>" +
                                      pend.DenyReason;
                }
                if (pend.Status == PendingStatus.Pending)
                {
                    btnAgent.Visible    = false;
                    btnProvider.Visible = false;
                }
            }
        }
    }
Beispiel #3
0
        public string RenderHTML()
        {
            cs = Pendings.PendingsLoad();
            string nav = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?users-pendinglist";

            StringBuilder sb    = new StringBuilder();
            int           count = cs.Count;

            if (count == 0)
            {
                sb.Append("<div class=\"empty_cl\">暂无待审核企业类型变更申请!</div>");
            }
            else
            {
                int min = Math.Min(count, _ItemCount);
                sb.Append("<ul>");
                string comName = string.Empty;
                for (int i = 0; i < min; i++)
                {
                    comName = GetCompanyName(cs[i].CompanyID);

                    sb.AppendFormat(_format,
                                    comName,
                                    GlobalSettings.SubString(comName, 20),
                                    GetCompanyType(cs[i].CompanyType)
                                    );
                }
                sb.Append("</ul>");
                if (min < count)
                {
                    sb.Append("<a class=\"clExec\" onclick=\"resolvePending('" + nav + "')\" href=\"#\" >还有<span>" + (count - min) + "</span>条待审核企业类型变更信息,马上处理!</a>");
                }
                else
                {
                    sb.Append("<a class=\"clExec\" onclick=\"resolvePending('" + nav + "')\" href=\"#\">马上处理此<span>" + count + "</span>条待审核企业类型变更信息!</a>");
                }
            }
            return(sb.ToString());
        }
    void BindCompany()
    {
        int comId = int.Parse(Request.QueryString["CompanyID"]);
        int pId   = int.Parse(Request.QueryString["PendingID"]);

        btnUpdateQualify.PostBackUrl = "CompanyQualify.aspx?ID=" + comId;
        btnUpdateDeposit.PostBackUrl = "CompanyDeposit.aspx?ID=" + comId;
        btnUpdateCredit.PostBackUrl  = "CompanyCredit.aspx?ID=" + comId;
        Company c = Companys.GetCompany(comId);

        ltCompanyName.Text = c.CompanyName;
        ltAddress.Text     = c.Address;
        ltFax.Text         = c.Fax;
        ltOrgCode.Text     = c.Orgcode;
        ltPhone.Text       = c.Phone;
        ltRegCode.Text     = c.Regcode;
        try
        {
            ltRegion.Text = Areas.GetArea(c.CompanyRegion).RegionName;
        }
        catch { ltRegion.Text = "--"; }
        ltRemark.Text = c.Remark;
        if (!string.IsNullOrEmpty(c.Website))
        {
            ltWebSite.Text = "<a href='" + c.Website + "' target='_blank'>" + c.Website + "</a>";
        }
        else
        {
            ltWebSite.Text = "--";
        }
        ltZipCode.Text     = c.Zipcode;
        ltCompanyType.Text = GetCompanyType(c.CompanyType);
        Pending p = Pendings.PendingGetById(pId);

        ltPendingType.Text = GetCompanyType(p.CompanyType);
    }
Beispiel #5
0
        private async Task RemovePendings(PendingConsultationsModel pending)
        {
            var popup = await Prism.PrismApplicationBase.Current.MainPage.DisplayAlert
                            ("Cancel consultation?", $"Would you like to cancel your pending consultation with {pending.Name} on {pending.SelectedDay}?", "Yes", "No");

            if (popup)
            {
                Pendings.Remove(pending);
                await App.RetryPolicy(async() => await App.ConnectionString.DeleteAsync(pending));

                toast.ShowToast("Successfully removed pending consultation!");

                if (await App.ConnectionString.Table <PendingConsultationsModel>().CountAsync() == 0)
                {
                    Empty = true;
                    View  = false;
                }

                Analytics.TrackEvent("Remove Consultation", new Dictionary <string, string>
                {
                    { "Registered Users", "No. of times consultation is removed" }
                });
            }
        }
Beispiel #6
0
        public void MinePendingTransactions()
        {
            logger.LogInformation($"Buscando transacciones que minar.\n" +
                                  $"\tÚltimo bloque #{Blockchain.Last.BlockNumber}.\n" +
                                  $"\tCadenas secundarias #{Blockchain.BranchesCount}\n" +
                                  $"\tTransacciones pendientes #{pendings.Count}\n" +
                                  $"\tPares registrados #{Peers.Count}: {string.Join(", ",Peers.List())}"
                                  );

            BlockItem[] pendingsToMine;
            lock (semaphore)
            {
                pendingsToMine = Pendings.ToArray();
            }

            if (pendingsToMine.Length > 0)
            {
                logger.LogInformation($"Minando {pendingsToMine.Length} transacciones");
                try
                {
                    var block = Blockchain.MineNextBlock(pendingsToMine);

                    if (block != null)
                    {
                        lock (semaphore)
                        {
                            logger.LogInformation("Hemos minado un bloque!!!");
                            Peers.Broadcast(block);
                            var transactions = block.GetTransactions();
                            foreach (var item in transactions)
                            {
                                pendings.Remove(item.GetKey());
                            }
                        }
                    }
                    else
                    {
                        logger.LogInformation("No hemos logrado minado el bloque antes que otro :(");
                    }

                    var chain = Blockchain.Trunk.ToArray();
                    KeyValuePair <string, BlockItem>[] invalids;
                    lock (semaphore)
                    {
                        invalids = pendings.Where(p => !p.Value.IsValid(chain)).ToArray();
                    }

                    foreach (var invalid in invalids)
                    {
                        logger.LogWarning($"Item {invalid.Value.GetType().Name} inválido: {string.Join("\n\r\t", invalid.Value.Messages)}");
                    }
                }
                catch (Exception ex)
                {
                    logger.LogCritical($"Error minando transacciones pendientes: {ex}");
                }
            }
            else
            {
                logger.LogDebug("No se encontraron transacciones que minar");
            }
        }
 void BindPendings()
 {
     egvPendings.DataSource = Pendings.PendingsLoad();
     egvPendings.DataBind();
 }