Exemple #1
0
        private void 补打PToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageBox.Show(this, "请选中一条单证!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string caseNo = this.dataGridView1.SelectedRows[0].Cells["colCaseNo"].Value.ToString();
            PolicyResponseEntity response = ws.GetPolicy(GlobalVar.IAUsername, GlobalVar.IAPassword, caseNo);

            if (string.IsNullOrEmpty(response.Trace.ErrorMsg))
            {
                if (MessageBox.Show(this, "请在打印机中准备好单证,确定补打?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
                    == System.Windows.Forms.DialogResult.OK)
                {
                    t_Case policy = response.Policy;
                    Insurance.Instance.PrintIt(policy);
                    this.dataGridView1.SelectedRows[0].DefaultCellStyle.BackColor = Color.Gray;
                }
            }
            else
            {
                MessageBox.Show(this, response.Trace.ErrorMsg, response.Trace.Detail, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #2
0
        public TraceEntity Withdraw(WithdrawEntity entity)
        {
            TraceEntity result = new TraceEntity();

            //agent,sesscode,productno,productname 用户名,密码,产品代码,产品名称
            string[] config     = entity.IOC_Class_Parameters.Split(',');
            t_Case   caseEntity = Case.Get(entity.CaseNo);
            string   rep        = ws.CannelPolicyById(
                DESEncrypt(caseEntity.customerID), config[0], config[1], config[2], entity.PolicyNo, caseEntity.customerID);

            string[] array = rep.Split('|');
            if (array.Length > 1)
            {
                if (array[0] != "1")
                {
                    Common.LogIt(rep);
                    result.ErrorMsg = rep;
                }
            }
            else
            {
                Common.LogIt(rep);
                result.ErrorMsg = rep;
            }

            return(result);
        }
Exemple #3
0
    public static t_Case Get(string caseNo, string connectionString)
    {
        string strSql = @"
SELECT a.*, b.displayname
  FROM [t_Case] a with(nolock)
  inner join t_user b with(nolock) on a.caseOwner = b.username
  where a.caseNo = '{0}'
  order by datetime desc";

        strSql = string.Format(strSql, caseNo);
        DataSet ds = SqlHelper.ExecuteDataset(connectionString, CommandType.Text, strSql);

        t_Case policy = NBear.Mapping.ObjectConvertor.ToObject <t_Case>(ds.Tables[0].Rows[0]);

        return(policy);
    }
Exemple #4
0
    /// <summary>
    /// 延迟投保(追溯?)
    /// </summary>
    /// <param name="entityObj"></param>
    public static IssuingResultEntity IssueAsync(object entityObj)
    {
        string strSql = "";
        IssuingResultEntity result = new IssuingResultEntity();

        try
        {
            IssueEntity entity          = (IssueEntity)entityObj;
            int         interfaceId_bak = entity.InterfaceId;//暂存
            t_Case      policy          = Case.Get(entity.CaseNo, entity.ConnectionString);

            if (!string.IsNullOrEmpty(policy.CertNo))
            {
                result.Trace.Detail = "已有保单号。";
            }
            else if (!policy.enabled)
            {
                result.Trace.Detail = "已撤销。";
            }
            else
            {
                entity.ID = entity.ID.ToUpper();    //有些第三方接口无法通过身份证中小写的x字母
                IssuingFacade facade = new IssuingFacade();
                result = facade.Issue(entity);

                if (string.IsNullOrEmpty(result.Trace.ErrorMsg))
                {
                    if (!string.IsNullOrEmpty(result.Trace.Detail))    //有特殊情况
                    {
                        strSql = "update t_case set IssuingFailed = @IssuingFailed where caseNo = @caseNo";
                        SqlHelper.ExecuteNonQuery(entity.ConnectionString, CommandType.Text, strSql,
                                                  new string[] { "@IssuingFailed", "@caseNo" },
                                                  new object[] { result.Trace.Detail, entity.CaseNo });
                    }

                    if (!string.IsNullOrEmpty(result.PolicyNo))
                    {
                        //主键更新,不会阻塞  保存返回的正式保单号
                        strSql = "update t_case set certNo = '{0}', [isIssued] = 1 {1} where caseNo = '{2}'";
                        string interfacIdSql = string.Empty;

                        if (entity.InterfaceId != interfaceId_bak)    //如果中途转投了别的接口
                        {
                            interfacIdSql = ",[interface_Id] = " + entity.InterfaceId;
                        }

                        strSql = string.Format(strSql, result.PolicyNo, interfacIdSql, entity.CaseNo);
                        int eff = SqlHelper.ExecuteNonQuery(entity.ConnectionString, CommandType.Text, strSql);
                        if (eff == 0)
                        {
                            Common.LogIt("ExecuteNonQuery影响行数为0 : " + strSql);
                        }
                    }
                }
                else
                {
                    int len = result.Trace.ErrorMsg.Length;
                    len    = len > 100 ? 100 : len;
                    strSql = "update t_case set IssuingFailed = @IssuingFailed where caseNo = @caseNo";
                    SqlHelper.ExecuteNonQuery(entity.ConnectionString, CommandType.Text, strSql,
                                              new string[] { "@IssuingFailed", "@caseNo" },
                                              new object[] { result.Trace.ErrorMsg.Substring(0, len), entity.CaseNo });
                }
            }

            return(result);
        }
        catch (Exception e)
        {
            //Common.LogIt(e.ToString());
            throw;
        }
    }