예제 #1
0
        /// <summary>
        /// 数据保存
        /// </summary>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!CheckInput())
            {
                return;
            }

            BllDepositArrTable depositArrTable = new BllDepositArrTable();

            depositArrTable.SLIP_NUMBER         = this.txtSlipNumber.Text.Trim();
            depositArrTable.SLIP_DATE           = this.txtDate.Value;
            depositArrTable.CUSTOMER_CLAIM_CODE = this.txtCustomerCode.Text;
            depositArrTable.STATUS_FLAG         = CConstant.NORMAL_STATUS;
            depositArrTable.CREATE_USER         = UserTable.CODE;
            depositArrTable.LAST_UPDATE_USER    = UserTable.CODE;
            depositArrTable.COMPANY_CODE        = UserTable.COMPANY_CODE;

            foreach (DataGridViewRow dgvr in dgvData.Rows)
            {
                BllDepositArrLineTable depositArrLineTable = new BllDepositArrLineTable();
                depositArrLineTable.LINE_NUMBER       = CConvert.ToInt32(dgvr.Cells["NO"].Value);
                depositArrLineTable.ORDER_SLIP_NUMBER = CConvert.ToString(dgvr.Cells["ORDER_SLIP_NUMBER"].Value);
                depositArrLineTable.ARR_AMOUNT        = CConvert.ToDecimal(dgvr.Cells["AMOUNT"].Value);
                depositArrLineTable.MEMO        = CConvert.ToString(dgvr.Cells["MEMO"].Value);
                depositArrLineTable.STATUS_FLAG = CConstant.NORMAL_STATUS;
                depositArrTable.addLineTable(depositArrLineTable);
            }

            try
            {
                if (bDepositArr.Add(depositArrTable) > 0)
                {
                    MessageBox.Show("保存成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    InitPage();
                }
                else
                {
                    MessageBox.Show("保存失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Logger.Error("预收款分配输入保存失败。", ex);
            }
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BllDepositArrTable depositArrTable)
        {
            int i      = 0;
            int result = 0;

            while (i < 10)
            {
                try
                {
                    List <CommandInfo> listSql = new List <CommandInfo>();
                    StringBuilder      strSql  = new StringBuilder();
                    strSql.Append("insert into BLL_DEPOSIT_ARR(");
                    strSql.Append("SLIP_NUMBER,SLIP_DATE,CUSTOMER_CLAIM_CODE,STATUS_FLAG,CREATE_USER,CREATE_DATE_TIME,LAST_UPDATE_TIME,LAST_UPDATE_USER,COMPANY_CODE)");
                    strSql.Append(" values (");
                    strSql.Append("@SLIP_NUMBER,@SLIP_DATE,@CUSTOMER_CLAIM_CODE,@STATUS_FLAG,@CREATE_USER,GETDATE(),GETDATE(),@LAST_UPDATE_USER,@COMPANY_CODE)");
                    SqlParameter[] parameters =
                    {
                        new SqlParameter("@SLIP_NUMBER",         SqlDbType.VarChar,   20),
                        new SqlParameter("@SLIP_DATE",           SqlDbType.DateTime),
                        new SqlParameter("@CUSTOMER_CLAIM_CODE", SqlDbType.VarChar,   20),
                        new SqlParameter("@STATUS_FLAG",         SqlDbType.Int,        4),
                        new SqlParameter("@CREATE_USER",         SqlDbType.VarChar,   20),
                        new SqlParameter("@LAST_UPDATE_USER",    SqlDbType.VarChar,   20),
                        new SqlParameter("@COMPANY_CODE",        SqlDbType.VarChar, 20)
                    };
                    parameters[0].Value = depositArrTable.SLIP_NUMBER;
                    parameters[1].Value = depositArrTable.SLIP_DATE;
                    parameters[2].Value = depositArrTable.CUSTOMER_CLAIM_CODE;
                    parameters[3].Value = depositArrTable.STATUS_FLAG;
                    parameters[4].Value = depositArrTable.CREATE_USER;
                    parameters[5].Value = depositArrTable.LAST_UPDATE_USER;
                    parameters[6].Value = depositArrTable.COMPANY_CODE;

                    listSql.Add(new CommandInfo(strSql.ToString(), parameters));

                    foreach (BllDepositArrLineTable depositArrLineTable in depositArrTable.LineTable)
                    {
                        strSql = new StringBuilder();
                        strSql.Append("insert into BLL_DEPOSIT_ARR_LINE(");
                        strSql.Append("SLIP_NUMBER,LINE_NUMBER,ORDER_SLIP_NUMBER,ARR_AMOUNT,MEMO,STATUS_FLAG)");
                        strSql.Append(" values (");
                        strSql.Append("@SLIP_NUMBER,@LINE_NUMBER,@ORDER_SLIP_NUMBER,@ARR_AMOUNT,@MEMO,@STATUS_FLAG)");
                        SqlParameter[] lineParam =
                        {
                            new SqlParameter("@SLIP_NUMBER",       SqlDbType.VarChar,   20),
                            new SqlParameter("@LINE_NUMBER",       SqlDbType.Int,        4),
                            new SqlParameter("@ORDER_SLIP_NUMBER", SqlDbType.VarChar,   20),
                            new SqlParameter("@ARR_AMOUNT",        SqlDbType.Decimal,    9),
                            new SqlParameter("@MEMO",              SqlDbType.NVarChar, 255),
                            new SqlParameter("@STATUS_FLAG",       SqlDbType.Int, 4)
                        };
                        lineParam[0].Value = depositArrTable.SLIP_NUMBER;
                        lineParam[1].Value = depositArrLineTable.LINE_NUMBER;
                        lineParam[2].Value = depositArrLineTable.ORDER_SLIP_NUMBER;
                        lineParam[3].Value = depositArrLineTable.ARR_AMOUNT;
                        lineParam[4].Value = depositArrLineTable.MEMO;
                        lineParam[5].Value = depositArrLineTable.STATUS_FLAG;
                        listSql.Add(new CommandInfo(strSql.ToString(), lineParam));
                    }

                    result = DbHelperSQL.ExecuteSqlTran(listSql);
                    break;
                }
                catch (Exception ex)
                {
                    i++;
                    if (i > 10)
                    {
                        throw ex;
                    }
                    depositArrTable.SLIP_NUMBER = CConvert.ToString(CConvert.ToInt32(GetMaxID()) + 1);
                }
            }

            return(result);
        }
예제 #3
0
파일: BDepositArr.cs 프로젝트: zhr008/ERP-1
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BllDepositArrTable depositArrTable)
 {
     return(dal.Add(depositArrTable));
 }