Ejemplo n.º 1
0
    protected void btnCheckThrough_Click(object sender, EventArgs e)
    {
        order.Status = OrderStatus.FINISHED;
        order.Reason = "";
        Client client = order.Client;
        order.CheckUserId = user.Id;
        order.CheckTime = DateTime.Now;
        OrderOperation.UpdateOrderStatus(order);
        OrderOperation.UpdateOrderCheckInfo(order);
        OrderOperation.UpdateOrderReason(order);

        string encode = StringHelper.GetEncodeNumber("YF");
        foreach (OrderDetail od in result)
        {
            ShouldPay sp = new ShouldPay();
            sp.OrderEncode = order.Encode;
            sp.OrderDetail = od;
            sp.CreateTime = DateTime.Now;
            sp.Encode = encode;
            sp.UserId = user.Id;
            sp.CompanyId = user.CompanyId;
            Carrier carrier = new Carrier();
            carrier.Id = CarrierOperation.GetCarrierByEncode(od.CarrierEncode).Id;
            sp.Carrier = carrier;
            sp.Type = "营业应付";
            ShouldPayOperation.CreateShouldPay(sp);
        }
        string msg = "";

        Company company = CompanyOperation.GetCompanyById(order.CompanyId);
        EmailHelper.SendMailForConsign(company, order.Client, order, out msg);
        Response.Write("<script language='javascript' type='text/javascript'>alert('" + msg + "');location.href='CheckOrderList.aspx';</script>");
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int id = 0;
     if (int.TryParse(Request.QueryString["id"], out id))
     {
         sp = ShouldPayOperation.GetShouldPayById(id);
     }
     FormDataBind();
 }
Ejemplo n.º 3
0
        public void CreateShouldPay(ShouldPay sp)
        {
            SqlParameter[] param = new SqlParameter[] {
                SqlUtilities.GenerateInputNVarcharParameter("@order_encode", 50, sp.OrderEncode),
                SqlUtilities.GenerateInputIntParameter("@order_detail_id", sp.OrderDetail.Id),
                SqlUtilities.GenerateInputIntParameter("@carrier_id", sp.Carrier.Id),
                SqlUtilities.GenerateInputNVarcharParameter("@type", 50, sp.Type),
                SqlUtilities.GenerateInputIntParameter("@user_id", sp.UserId),
                SqlUtilities.GenerateInputIntParameter("@company_id", sp.CompanyId),
                SqlUtilities.GenerateInputDateTimeParameter("@create_time", sp.CreateTime),
                SqlUtilities.GenerateInputNVarcharParameter("@encode", 50, sp.Encode)
            };

            string sql = "INSERT INTO should_pay(order_encode, order_detail_id, carrier_id, type, user_id, company_id, create_time, encode) VALUES(     @order_encode, @order_detail_id, @carrier_id, @type, @user_id, @company_id, @create_time, @encode)";
            SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param);
        }
Ejemplo n.º 4
0
 public PaginationQueryResult<ShouldPay> GetShouldPayByCompanyId(PaginationQueryCondition condition, int compId)
 {
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@company_id", compId)
     };
     PaginationQueryResult<ShouldPay> result = new PaginationQueryResult<ShouldPay>();
     string sql = "SELECT TOP " + condition.PageSize + " id, order_encode, order_detail_id, carrier_id, type, user_id, company_id, create_time, encode FROM should_pay WHERE is_delete = 0 AND is_paid = 0 AND company_id = @company_id";
     if (condition.CurrentPage > 1)
     {
         sql += " AND id< (SELECT MIN(id) FROM (SELECT TOP " + condition.PageSize * (condition.CurrentPage - 1) + " id FROM should_pay ORDER BY id DESC) AS R )";
     }
     sql += " ORDER BY id DESC; SELECT COUNT(*) FROM should_pay WHERE is_delete = 0 AND company_id = @company_id ";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
     {
         while (dr.Read())
         {
             ShouldPay sp = new ShouldPay();
             sp.Id = dr.GetInt32(0);
             sp.OrderEncode = dr.GetString(1);
             sp.OrderDetail = new OrderDetailDAL().GetOrderDetailById(dr.GetInt32(2));
             sp.Carrier = new CarrierDAL().GetCarrierById(dr.GetInt32(3));
             sp.Type = dr.GetString(4);
             sp.UserId = dr.GetInt32(5);
             sp.CompanyId = dr.GetInt32(6);
             sp.CreateTime = dr.GetDateTime(7);
             sp.Encode = dr.GetString(8);
             result.Results.Add(sp);
         }
         dr.NextResult();
         while (dr.Read())
         {
             result.TotalCount = dr.GetInt32(0);
         }
     }
     return result;
 }
Ejemplo n.º 5
0
 public static void CreateShouldPay(ShouldPay sp)
 {
     dal.CreateShouldPay(sp);
 }
Ejemplo n.º 6
0
 public ShouldPay GetShouldPayById(int id)
 {
     ShouldPay sp = null;
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@id", id)
     };
     string sql = "SELECT id, order_encode, order_detail_id, carrier_id, type, user_id, company_id, create_time, encode FROM should_pay WHERE id = @id";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
     {
         while (dr.Read())
         {
             sp = new ShouldPay();
             sp.Id = dr.GetInt32(0);
             sp.OrderEncode = dr.GetString(1);
             sp.OrderDetail = new OrderDetailDAL().GetOrderDetailById(dr.GetInt32(2));
             sp.Carrier = new CarrierDAL().GetCarrierById(dr.GetInt32(3));
             sp.Type = dr.GetString(4);
             sp.UserId = dr.GetInt32(5);
             sp.CompanyId = dr.GetInt32(6);
             sp.CreateTime = dr.GetDateTime(7);
             sp.Encode = dr.GetString(8);
         }
     }
     return sp;
 }
Ejemplo n.º 7
0
        public List<ShouldPay> GetShouldPayByParameters(int compId, DateTime startDate, DateTime endDate, int carrierId)
        {
            DateTime minTime = new DateTime(1999, 1, 1);
            string sqlParam = "";
            if (startDate > minTime && endDate > minTime)
            {
                sqlParam += " AND create_time BETWEEN @start_date AND @end_date";
            }

            if (carrierId > 0)
            {
                sqlParam += " AND carrier_id = @carrier_id";
            }
            SqlParameter[] param = new SqlParameter[] {
                SqlUtilities.GenerateInputIntParameter("@company_id", compId),
                SqlUtilities.GenerateInputDateTimeParameter("@start_date", startDate),
                SqlUtilities.GenerateInputDateTimeParameter("@end_date", endDate),
                SqlUtilities.GenerateInputIntParameter("@carrier_id", carrierId)
            };

            List<ShouldPay> result = new List<ShouldPay>();
            string sql = "SELECT id, order_encode, order_detail_id, carrier_id, type, user_id, company_id, create_time, encode FROM should_pay WHERE is_delete = 0 AND is_paid = 0 AND company_id = @company_id" + sqlParam;
            using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
            {
                while (dr.Read())
                {
                    ShouldPay sp = new ShouldPay();
                    sp.Id = dr.GetInt32(0);
                    sp.OrderEncode = dr.GetString(1);
                    sp.OrderDetail = new OrderDetailDAL().GetOrderDetailById(dr.GetInt32(2));
                    sp.Carrier = new CarrierDAL().GetCarrierById(dr.GetInt32(3));
                    sp.Type = dr.GetString(4);
                    sp.UserId = dr.GetInt32(5);
                    sp.CompanyId = dr.GetInt32(6);
                    sp.CreateTime = dr.GetDateTime(7);
                    sp.Encode = dr.GetString(8);
                    result.Add(sp);
                }
            }
            return result;
        }