protected void Page_Load(object sender, EventArgs e)
 {
     int id = 0;
     if (int.TryParse(Request.QueryString["id"], out id))
     {
         ly = LiabilityOperation.GetLiabilityById(id);
     }
     FormDataBind();
 }
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        string orderEncode = Request.Form[txtOrderEncode.ID].Trim();
        string fillUser = Request.Form[txtFillUser.ID].Trim();
        string strFillTime = Request.Form[txtFillTime.ID].Trim();
        string detail = Request.Form[txtDetail.ID].Trim();
        if (string.IsNullOrEmpty(orderEncode) || Validator.IsMatchLessThanChineseCharacter(orderEncode, ORDER_ENCODE_LENGTH))
        {
            lblMsg.Text = "订单号不能为空,且长度不能超过" + ORDER_ENCODE_LENGTH + "个字符!";
            return;
        }
        Order order = OrderOperation.GetOrderByEncode(orderEncode);
        if (order == null)
        {
            lblMsg.Text = "此订单号不存在!";
            return;
        }
        string encode = StringHelper.GetNextEncodeNumber(8, "00000000");

        if (string.IsNullOrEmpty(fillUser) || Validator.IsMatchLessThanChineseCharacter(fillUser, FILL_USER_LENGTH))
        {
            lblMsg.Text = "填表人不能为空,且长度不能超过"+FILL_USER_LENGTH+"个字符!";
        }

        DateTime fillTime = new DateTime(1999, 1, 1);
        if (string.IsNullOrEmpty(strFillTime) || !DateTime.TryParse(strFillTime, out fillTime))
        {
            lblMsg.Text = "填表时间不能为空,且只能为时间格式!";
            return;
        }
        if (string.IsNullOrEmpty(detail) || Validator.IsMatchLessThanChineseCharacter(detail, DETAIL_LENGTH))
        {
            lblMsg.Text = "事情经过不能为空,且长度不能超过" + DETAIL_LENGTH + "个字符!";
            return;
        }
        Liability ly = new Liability();
        ly.Encode = encode;
        ly.Order = order;
        ly.FillUser = fillUser;
        ly.FillTime = fillTime;
        ly.EventType = EnumConvertor.ConvertToLiabilityEventType(byte.Parse(ddlEventType.SelectedItem.Value));
        ly.Detail = Request.Form[txtDetail.ID].Trim();
        ly.Result = "";
        ly.CompanyId = order.CompanyId;
        ly.Status = LiabilityStatus.WAIT_AUDIT;
        ly.ClientName = order.Client.RealName;
        ly.CreateUser = user.RealName;
        ly.CreateTime = DateTime.Now;
        ly.CurrencyType = "人民币";
        LiabilityOperation.CreateLiability(ly);

        ly = LiabilityOperation.GetLiabilityByEncode(encode);
        Response.Write("<script language='javascript' type='text/javascript'>alert('添加成功!');location.href='LiabilityOrder.aspx?id=" + ly.Id + "';</script>");
    }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int id = 0;
     if (int.TryParse(Request.QueryString["id"], out id))
     {
         ly = LiabilityOperation.GetLiabilityById(id);
     }
     hdLiabilityId.Value = id.ToString();
     if (!IsPostBack)
     {
         FormDataBind();
     }
 }
Beispiel #4
0
 public void CreateLiability(Liability ly)
 {
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputNVarcharParameter("@encode", 50, ly.Encode),
         SqlUtilities.GenerateInputNVarcharParameter("@order_encode", 50, ly.Order.Encode),
         SqlUtilities.GenerateInputIntParameter("@company_id", ly.CompanyId),
         SqlUtilities.GenerateInputParameter("@event_type", SqlDbType.TinyInt, (byte)ly.EventType),
         SqlUtilities.GenerateInputParameter("@status", SqlDbType.TinyInt, (byte)ly.Status),
         SqlUtilities.GenerateInputNVarcharParameter("@fill_user", 50, ly.FillUser),
         SqlUtilities.GenerateInputDateTimeParameter("@fill_time", ly.FillTime),
         SqlUtilities.GenerateInputNVarcharParameter("@create_user", 50, ly.CreateUser),
         SqlUtilities.GenerateInputDateTimeParameter("@create_time", ly.CreateTime),
         SqlUtilities.GenerateInputNVarcharParameter("@detail", 2000, ly.Detail),
         SqlUtilities.GenerateInputNVarcharParameter("@result", 1000, ly.Result),
         SqlUtilities.GenerateInputNVarcharParameter("@client_name", 50, ly.ClientName),
         SqlUtilities.GenerateInputNVarcharParameter("@currency_type", 50, ly.CurrencyType)
     };
     string sql = "INSERT INTO liabilities (encode, order_encode, company_id, event_type, status, fill_user, fill_time, create_user, create_time, detail, result, client_name, currency_type) VALUES(@encode, @order_encode, @company_id, @event_type, @status, @fill_user, @fill_time,      @create_user, @create_time, @detail, @result, @client_name, @currency_type)";
     SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param);
 }
Beispiel #5
0
 public void UpdateLiability(Liability ly)
 {
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@id", ly.Id),
         SqlUtilities.GenerateInputNVarcharParameter("@order_encode", 50, ly.Order.Encode),
         SqlUtilities.GenerateInputIntParameter("@company_id", ly.CompanyId),
         SqlUtilities.GenerateInputParameter("@event_type", SqlDbType.TinyInt, (byte)ly.EventType),
         SqlUtilities.GenerateInputNVarcharParameter("@bar_code", 50, ly.BarCode),
         SqlUtilities.GenerateInputParameter("@status", SqlDbType.TinyInt, (byte)ly.Status),
         SqlUtilities.GenerateInputNVarcharParameter("@fill_user", 50, ly.FillUser),
         SqlUtilities.GenerateInputDateTimeParameter("@fill_time", ly.FillTime),
         SqlUtilities.GenerateInputNVarcharParameter("@detail", 2000, ly.Detail),
         SqlUtilities.GenerateInputNVarcharParameter("@result", 1000, ly.Result),
         SqlUtilities.GenerateInputNVarcharParameter("@currency_type", 50, ly.CurrencyType),
         SqlUtilities.GenerateInputParameter("@correct_status", SqlDbType.TinyInt, ly.CorrectStatus),
         SqlUtilities.GenerateInputNVarcharParameter("@client_name", 50, ly.ClientName),
         SqlUtilities.GenerateInputParameter("@total_money", SqlDbType.Decimal, ly.TotalMoney),
         SqlUtilities.GenerateInputParameter("@zr_dt_money", SqlDbType.Decimal, ly.ZrDtMoney),
         SqlUtilities.GenerateInputParameter("@zr_ur_money", SqlDbType.Decimal, ly.ZrUrMoney),
         SqlUtilities.GenerateInputParameter("@client_pt_eadu", SqlDbType.Decimal, ly.ClientPtEadu),
         SqlUtilities.GenerateInputParameter("@eadu_pt_client", SqlDbType.Decimal, ly.EaduPtClient),
         SqlUtilities.GenerateInputParameter("@carrier_pt_eadu", SqlDbType.Decimal, ly.CarrierPtEadu),
         SqlUtilities.GenerateInputParameter("@eadu_pt_carrier", SqlDbType.Decimal, ly.EaduPtCarrier),
         SqlUtilities.GenerateInputParameter("@jl_dt_money", SqlDbType.Decimal, ly.JlDtMoney),
         SqlUtilities.GenerateInputParameter("@jl_ur_money", SqlDbType.Decimal, ly.JlUrMoney),
         SqlUtilities.GenerateInputNVarcharParameter("@zr_department", 50, ly.ZrDepartment),
         SqlUtilities.GenerateInputNVarcharParameter("@zr_user", 50, ly.ZrUser),
         SqlUtilities.GenerateInputNVarcharParameter("@carrier_name", 50, ly.CarrierName),
         SqlUtilities.GenerateInputNVarcharParameter("@jl_department", 50, ly.JlDepartment),
         SqlUtilities.GenerateInputNVarcharParameter("@jl_user", 50, ly.JlUser),
         SqlUtilities.GenerateInputNVarcharParameter("@liability_user", 50, ly.LiabilityUser),
         SqlUtilities.GenerateInputNVarcharParameter("@correct_user", 50, ly.CorrectUser),
         SqlUtilities.GenerateInputNVarcharParameter("@finance_user", 50, ly.FinanceUser),
         SqlUtilities.GenerateInputNVarcharParameter("@cashier_user", 50, ly.CashierUser)
     };
     string sql = "UPDATE liabilities SET company_id = @company_id, order_encode = @order_encode, bar_code = @bar_code, currency_type =          @currency_type, event_type = @event_type, correct_status = @correct_status, status = @status, fill_user = @fill_user, fill_time = @fill_time, detail = @detail, result = @result, total_money = @total_money, zr_department = @zr_department, zr_dt_money = @zr_dt_money, zr_user = @zr_user, zr_ur_money = @zr_ur_money, client_name = @client_name, client_pt_eadu = @client_pt_eadu, eadu_pt_client = @eadu_pt_client, carrier_name =              @carrier_name, carrier_pt_eadu = @carrier_pt_eadu, eadu_pt_carrier = @eadu_pt_carrier, jl_department = @jl_department, jl_dt_money = @jl_dt_money, jl_user = @jl_user, jl_ur_money = @jl_ur_money, liability_user = @liability_user, correct_user = @correct_user, finance_user = @finance_user, cashier_user = @cashier_user FROM liabilities WHERE id = @id";
     SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param);
 }
Beispiel #6
0
 public Liability GetLiabilityById(int id)
 {
     Liability ly = null;
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@id", id)
     };
     string sql = "SELECT id, company_id, encode, order_encode, bar_code, currency_type, create_user, create_time, event_type, correct_status, status, fill_user, fill_time, detail, result, total_money, zr_department, zr_dt_money, zr_user, zr_ur_money, client_name, client_pt_eadu, eadu_pt_client, carrier_name, carrier_pt_eadu, eadu_pt_carrier, jl_department, jl_dt_money, jl_user, jl_ur_money, liability_user, correct_user, finance_user, cashier_user FROM liabilities WHERE id = @id";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
     {
         while (dr.Read())
         {
             ly = new Liability();
             ly.Id = dr.GetInt32(0);
             ly.CompanyId = dr.GetInt32(1);
             ly.Encode = dr.GetString(2);
             Order order = new OrderDAL().GetOrderByEncode(dr.GetString(3));
             ly.Order = order;
             if (!dr.IsDBNull(4))
             {
                 ly.BarCode = dr.GetString(4);
             }
             if (!dr.IsDBNull(5))
             {
                 ly.CurrencyType = dr.GetString(5);
             }
             ly.CreateUser = dr.GetString(6);
             ly.CreateTime = dr.GetDateTime(7);
             ly.EventType = EnumConvertor.ConvertToLiabilityEventType(dr.GetByte(8));
             ly.CorrectStatus = dr.GetBoolean(9);
             ly.Status = EnumConvertor.ConvertToLiabilityStatus(dr.GetByte(10));
             ly.FillUser = dr.GetString(11);
             ly.FillTime = dr.GetDateTime(12);
             ly.Detail = dr.GetString(13);
             ly.Result = dr.GetString(14);
             ly.TotalMoney = dr.GetDecimal(15);
             if (!dr.IsDBNull(16))
             {
                 ly.ZrDepartment = dr.GetString(16);
             }
             if (!dr.IsDBNull(17))
             {
                 ly.ZrDtMoney = dr.GetDecimal(17);
             }
             if (!dr.IsDBNull(18))
             {
                 ly.ZrUser = dr.GetString(18);
             }
             if (!dr.IsDBNull(19))
             {
                 ly.ZrUrMoney = dr.GetDecimal(19);
             }
             ly.ClientName = dr.GetString(20);
             ly.ClientPtEadu = dr.GetDecimal(21);
             ly.EaduPtClient = dr.GetDecimal(22);
             if (!dr.IsDBNull(23))
             {
                 ly.CarrierName = dr.GetString(23);
             }
             ly.CarrierPtEadu = dr.GetDecimal(24);
             ly.EaduPtCarrier = dr.GetDecimal(25);
             if (!dr.IsDBNull(26))
             {
                 ly.JlDepartment = dr.GetString(26);
             }
             if (!dr.IsDBNull(27))
             {
                 ly.JlDtMoney = dr.GetDecimal(27);
             }
             if (!dr.IsDBNull(28))
             {
                 ly.JlUser = dr.GetString(28);
             }
             if (!dr.IsDBNull(29))
             {
                 ly.JlUrMoney = dr.GetDecimal(29);
             }
             if (!dr.IsDBNull(30))
             {
                 ly.LiabilityUser = dr.GetString(30);
             }
             if (!dr.IsDBNull(31))
             {
                 ly.CorrectUser = dr.GetString(31);
             }
             if (!dr.IsDBNull(32))
             {
                 ly.FinanceUser = dr.GetString(32);
             }
             if (!dr.IsDBNull(33))
             {
                 ly.CashierUser = dr.GetString(33);
             }
         }
     }
     return ly;
 }
Beispiel #7
0
        public PaginationQueryResult<Liability> GetFinishedLiabilityByParameters(PaginationQueryCondition condition, int companyId, DateTime startDate, DateTime endDate)
        {
            PaginationQueryResult<Liability> result = new PaginationQueryResult<Liability>();
            DateTime minTime = new DateTime(1999, 1, 1);
            string sqlParam = "";
            if (companyId > 0)
            {
                sqlParam += " AND company_id = @company_id";
            }
            if (startDate > minTime && endDate > minTime)
            {
                sqlParam = " AND create_time BETWEEN @start_date AND @end_date";
            }
            else if (startDate > minTime && endDate <= minTime)
            {
                sqlParam = " AND create_time >= @start_date ";
            }
            else if (startDate <= minTime && endDate > minTime)
            {
                sqlParam = " AND create_time <= @end_date";
            }

            SqlParameter[] param = new SqlParameter[] {
                SqlUtilities.GenerateInputIntParameter("@company_id", companyId),
                SqlUtilities.GenerateInputDateTimeParameter("@start_date", startDate),
                SqlUtilities.GenerateInputDateTimeParameter("@end_date", endDate)
            };
            string sql = "SELECT TOP " + condition.PageSize + " id, company_id, encode, order_encode, bar_code, currency_type, create_user, create_time, event_type, correct_status, status, fill_user, fill_time, detail, result, total_money, zr_department, zr_dt_money, zr_user, zr_ur_money, client_name, client_pt_eadu, eadu_pt_client, carrier_name, carrier_pt_eadu, eadu_pt_carrier, jl_department, jl_dt_money, jl_user, jl_ur_money, liability_user, correct_user, finance_user, cashier_user FROM liabilities WHERE is_delete = 0 AND status = 5" + sqlParam;
            if (condition.CurrentPage > 1)
            {
                sql += " AND id< (SELECT MIN(id) FROM (SELECT TOP " + condition.PageSize * (condition.CurrentPage - 1) + " id FROM liabilities WHERE is_delete = 0 AND status = 5 " + sqlParam + " ORDER BY id DESC) AS L)";
            }
            sql += " ORDER BY id DESC; SELECT COUNT(*) FROM liabilities WHERE is_delete = 0 AND status = 5" + sqlParam;
            using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
            {
                while (dr.Read())
                {
                    Liability ly = new Liability();
                    ly.Id = dr.GetInt32(0);
                    ly.CompanyId = dr.GetInt32(1);
                    ly.Encode = dr.GetString(2);
                    Order order = new OrderDAL().GetOrderByEncode(dr.GetString(3));
                    ly.Order = order;
                    if (!dr.IsDBNull(4))
                    {
                        ly.BarCode = dr.GetString(4);
                    }
                    if (!dr.IsDBNull(5))
                    {
                        ly.CurrencyType = dr.GetString(5);
                    }
                    ly.CreateUser = dr.GetString(6);
                    ly.CreateTime = dr.GetDateTime(7);
                    ly.EventType = EnumConvertor.ConvertToLiabilityEventType(dr.GetByte(8));
                    ly.CorrectStatus = dr.GetBoolean(9);
                    ly.Status = EnumConvertor.ConvertToLiabilityStatus(dr.GetByte(10));
                    ly.FillUser = dr.GetString(11);
                    ly.FillTime = dr.GetDateTime(12);
                    ly.Detail = dr.GetString(13);
                    ly.Result = dr.GetString(14);
                    ly.TotalMoney = dr.GetDecimal(15);
                    if (!dr.IsDBNull(16))
                    {
                        ly.ZrDepartment = dr.GetString(16);
                    }
                    if (!dr.IsDBNull(17))
                    {
                        ly.ZrDtMoney = dr.GetDecimal(17);
                    }
                    if (!dr.IsDBNull(18))
                    {
                        ly.ZrUser = dr.GetString(18);
                    }
                    if (!dr.IsDBNull(19))
                    {
                        ly.ZrUrMoney = dr.GetDecimal(19);
                    }
                    ly.ClientName = dr.GetString(20);
                    ly.ClientPtEadu = dr.GetDecimal(21);
                    ly.EaduPtClient = dr.GetDecimal(22);
                    if (!dr.IsDBNull(23))
                    {
                        ly.CarrierName = dr.GetString(23);
                    }
                    ly.CarrierPtEadu = dr.GetDecimal(24);
                    ly.EaduPtCarrier = dr.GetDecimal(25);
                    if (!dr.IsDBNull(26))
                    {
                        ly.JlDepartment = dr.GetString(26);
                    }
                    if (!dr.IsDBNull(27))
                    {
                        ly.JlDtMoney = dr.GetDecimal(27);
                    }
                    if (!dr.IsDBNull(28))
                    {
                        ly.JlUser = dr.GetString(28);
                    }
                    if (!dr.IsDBNull(29))
                    {
                        ly.JlUrMoney = dr.GetDecimal(29);
                    }
                    if (!dr.IsDBNull(30))
                    {
                        ly.LiabilityUser = dr.GetString(30);
                    }
                    if (!dr.IsDBNull(31))
                    {
                        ly.CorrectUser = dr.GetString(31);
                    }
                    if (!dr.IsDBNull(32))
                    {
                        ly.FinanceUser = dr.GetString(32);
                    }
                    if (!dr.IsDBNull(33))
                    {
                        ly.CashierUser = dr.GetString(33);
                    }
                    result.Results.Add(ly);
                }
                dr.NextResult();
                while (dr.Read())
                {
                    result.TotalCount = dr.GetInt32(0);
                }
            }
            return result;
        }
 public static void UpdateLiability(Liability ly)
 {
     dal.UpdateLiability(ly);
 }
 public static void CreateLiability(Liability ly)
 {
     dal.CreateLiability(ly);
 }