Beispiel #1
0
        /// <summary>
        /// 保存收款认领方法
        /// </summary>
        private void SaveClaim()
        {
            To_Claim claimModel = new To_Claim();

            claimModel.collectingID  = int.Parse(Request.QueryString["id"]); //收款id
            claimModel.collectingNum = LblNumber.Text;                       //收款单号
            claimModel.makerman      = LblMaker.Text;                        //认领人员
            claimModel.MakerID       = int.Parse(HidMaker.Value);            //认领人员id
            claimModel.payer         = txtUnit.Text;                         //付款单位
            claimModel.payerID       = int.Parse(hidComID.Value);            //付款单位id
            claimModel.collectAmount = double.Parse(HidReceiptAmount.Value); //收款金额

            To_Collecting collectModel = To_CollectingManager.getTo_CollectingById(claimModel.collectingID);

            collectModel.PaymentUnit = txtUnit.Text;
            int comid = 0;

            int.TryParse(hidComID.Value, out comid);
            collectModel.PaymentUnitID = comid;
            To_CollectingManager.updateTo_CollectPaymentUnit(collectModel);

            To_ClaimManager claimManager = new To_ClaimManager();
            int             result       = claimManager.Add(claimModel);

            if (result > 0)
            {
                SaveClaimDetail(result, claimModel.collectingID);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('认领成功');self.location.href='ClaimList.aspx';", true);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public To_Claim GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select *  ");
            strSql.Append("  from To_Claim ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;


            To_Claim  model = new To_Claim();
            DataTable ds    = DBHelper.GetDataSet(strSql.ToString(), parameters);

            if (ds.Rows.Count > 0)
            {
                if (ds.Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Rows[0]["ID"].ToString());
                }
                if (ds.Rows[0]["collectingID"].ToString() != "")
                {
                    model.collectingID = int.Parse(ds.Rows[0]["collectingID"].ToString());
                }
                model.makerman = ds.Rows[0]["makerman"].ToString();
                if (ds.Rows[0]["makerID"].ToString() != "")
                {
                    model.MakerID = int.Parse(ds.Rows[0]["makerID"].ToString());
                }
                model.payer = ds.Rows[0]["payer"].ToString();
                if (ds.Rows[0]["payerID"].ToString() != "")
                {
                    model.payerID = int.Parse(ds.Rows[0]["payerID"].ToString());
                }
                if (ds.Rows[0]["collectAmount"].ToString() != "")
                {
                    model.collectAmount = Convert.ToDouble(ds.Rows[0]["collectAmount"]);
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(To_Claim model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update To_Claim set ");

            strSql.Append(" collectingID = @collectingID , ");
            strSql.Append(" collectingNum = @collectingNum , ");
            strSql.Append(" makerman = @makerman , ");
            strSql.Append(" makerID = @makerID , ");
            strSql.Append(" payer = @payer , ");
            strSql.Append(" payerID = @payerID , ");
            strSql.Append(" collectAmount = @collectAmount ");
            strSql.Append(" where ID=@ID ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",            SqlDbType.Int,      4),
                new SqlParameter("@collectingID",  SqlDbType.Int,      4),
                new SqlParameter("@collectingNum", SqlDbType.VarChar, 50),
                new SqlParameter("@makerman",      SqlDbType.VarChar, 20),
                new SqlParameter("@makerID",       SqlDbType.Int,      4),
                new SqlParameter("@payer",         SqlDbType.VarChar, 50),
                new SqlParameter("@payerID",       SqlDbType.Int,      4),
                new SqlParameter("@collectAmount", SqlDbType.Decimal, 18)
            };

            parameters[0].Value = model.ID;
            parameters[1].Value = model.collectingID;
            parameters[2].Value = model.collectingNum;
            parameters[3].Value = model.makerman;
            parameters[4].Value = model.MakerID;
            parameters[5].Value = model.payer;
            parameters[6].Value = model.payerID;
            parameters[7].Value = model.collectAmount;
            int rows = DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(To_Claim model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into To_Claim(");
            strSql.Append("collectingID,collectingNum,makerman,makerID,payer,payerID,collectAmount");
            strSql.Append(") values (");
            strSql.Append("@collectingID,@collectingNum,@makerman,@makerID,@payer,@payerID,@collectAmount");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@collectingID",  SqlDbType.Int,      4),
                new SqlParameter("@collectingNum", SqlDbType.VarChar, 50),
                new SqlParameter("@makerman",      SqlDbType.VarChar, 20),
                new SqlParameter("@makerID",       SqlDbType.Int,      4),
                new SqlParameter("@payer",         SqlDbType.VarChar, 50),
                new SqlParameter("@payerID",       SqlDbType.Int,      4),
                new SqlParameter("@collectAmount", SqlDbType.Decimal, 18)
            };

            parameters[0].Value = model.collectingID;
            parameters[1].Value = model.collectingNum;
            parameters[2].Value = model.makerman;
            parameters[3].Value = model.MakerID;
            parameters[4].Value = model.payer;
            parameters[5].Value = model.payerID;
            parameters[6].Value = model.collectAmount;

            //DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            object objResult = DBHelper.GetSingle(strSql.ToString(), parameters);

            return(objResult == null ? 0 : Convert.ToInt32(objResult));

            //using (SqlConnection conn=new SqlConnection(DBHelper.connectionString))
            //{
            //    conn.Open();
            //    SqlCommand command = new SqlCommand("select @@IDENTITY", conn);
            //    object id = command.ExecuteScalar();
            //    return id == null ? 0 : Convert.ToInt32(id);
            //}
        }
Beispiel #5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <To_Claim> DataTableToList(DataTable dt)
        {
            List <To_Claim> modelList = new List <To_Claim>();
            int             rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                To_Claim model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new To_Claim();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["collectingID"].ToString() != "")
                    {
                        model.collectingID = int.Parse(dt.Rows[n]["collectingID"].ToString());
                    }
                    model.makerman = dt.Rows[n]["makerman"].ToString();
                    if (dt.Rows[n]["makerID"].ToString() != "")
                    {
                        model.MakerID = int.Parse(dt.Rows[n]["makerID"].ToString());
                    }
                    model.payer = dt.Rows[n]["payer"].ToString();
                    if (dt.Rows[n]["payerID"].ToString() != "")
                    {
                        model.payerID = int.Parse(dt.Rows[n]["payerID"].ToString());
                    }
                    if (dt.Rows[n]["collectAmount"].ToString() != "")
                    {
                        model.collectAmount = Convert.ToDouble(dt.Rows[n]["collectAmount"]);
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #6
0
        /// <summary>
        /// 保存收款认领的方法
        /// </summary>
        private void SaveClaim()
        {
            string          claimId      = Request.QueryString["claimId"];
            To_ClaimManager claimManager = new To_ClaimManager();
            To_Claim        claimModel   = claimManager.GetModel(int.Parse(claimId));

            //更新收款单的单位信息
            To_Collecting collectModel = To_CollectingManager.getTo_CollectingById(claimModel.collectingID);

            collectModel.PaymentUnit = txtUnit.Text;
            int comid = 0;

            int.TryParse(hidComID.Value, out comid);
            collectModel.PaymentUnitID = comid;
            To_CollectingManager.updateTo_CollectPaymentUnit(collectModel);
            //认领主表的数据没有什么需要修改,故没有写,只修改认领明细中的数据

            int result = SaveClaimDetail(claimModel.ID, claimModel.collectingID);

            if (result == 1)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('修改成功');self.location.href='ClaimList.aspx';", true);
            }
        }
Beispiel #7
0
        protected void BtnSubmit_Click(object sender, ImageClickEventArgs e)
        {
            To_ClaimManager b_claim = new To_ClaimManager();
            To_Claim        m_claim = new To_Claim();

            Step1 step1 = Context.Handler as Step1;

            m_claim.collectingID = Convert.ToInt32(Request.QueryString["id"]);
            m_claim.costType     = HidReceiptType.Value;
            m_claim.payer        = HidPayer.Value;
            m_claim.payerID      = int.Parse(HidPayerID.Value);
            m_claim.payerType    = int.Parse(HidPayerType.Value);
            m_claim.salesman     = HidSalesman.Value;
            m_claim.salesmanID   = int.Parse(HidSalesmanID.Value);
            m_claim.makerID      = (Session["login"] as LoginInfo).Id;

            int claimID = b_claim.Add(m_claim);

            if (claimID != 0)
            {
                To_CollectingManager.ChangeClaim(Convert.ToInt32(Request.QueryString["id"]), chkFinish.Checked ? 2 : 1);
                if (chkFinish.Checked)
                {
                    SendMessage(m_claim.collectingID, HidSalesman.Value, 1);
                }
                else
                {
                    SendMessage(m_claim.collectingID, HidSalesman.Value, 0);
                }

                if (HidClaimDetail.Value.Trim() != string.Empty)
                {
                    string[] items = HidClaimDetail.Value.Trim().TrimEnd('@').Split('@');

                    if (items.Length > 0)
                    {
                        To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();
                        To_ClaimDetail        m_claimDetail = new To_ClaimDetail();

                        foreach (string item in items)
                        {
                            string[] detail = item.Trim().Split('$');
                            if (detail.Length > 0)
                            {
                                int     policyID   = int.Parse(detail[0].Trim());
                                decimal amount     = decimal.Parse(detail[1].Trim().TrimStart('¥').TrimStart('¥'));
                                decimal realAmount = decimal.Parse(detail[2].Trim());

                                m_claimDetail.claimID           = claimID;
                                m_claimDetail.mark              = "";
                                m_claimDetail.policyID          = policyID;
                                m_claimDetail.realAmount        = realAmount;
                                m_claimDetail.receiptAmount     = amount;
                                m_claimDetail.receiptStatusCode = 0;

                                b_claimDetail.Add(m_claimDetail);
                            }
                        }
                    }
                }


                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('认领成功');self.location.href='../FundsAllocation.aspx';", true);
            }
        }
Beispiel #8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(To_Claim model)
 {
     return(dal.Update(model));
 }
Beispiel #9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(To_Claim model)
 {
     return(dal.Add(model));
 }