Esempio n. 1
0
 public PaginationQueryResult<CarrierArea> GetCarrierArea(PaginationQueryCondition condition)
 {
     PaginationQueryResult<CarrierArea> result = new PaginationQueryResult<CarrierArea>();
     string sql = "SELECT TOP " + condition.PageSize + " id, carrier_id, name , encode FROM carrier_area ";
     if (condition.CurrentPage > 1)
     {
         sql += " WHERE id > (SELECT MAX(id) FROM (SELECT TOP " + condition.PageSize*(condition.CurrentPage-1) + " id FROM carrier_area ORDER BY encode ASC) AS C)";
     }
     sql += " ORDER BY encode ASC; SELECT COUNT(*) FROM carrier_area ";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, null))
     {
         while (dr.Read())
         {
             CarrierArea ca = new CarrierArea();
             ca.Id = dr.GetInt32(0);
             Carrier carrier = new CarrierDAL().GetCarrierById(dr.GetInt32(1));
             ca.Carrier = carrier;
             ca.Name = dr.GetString(2);
             ca.Encode = dr.GetString(3);
             result.Results.Add(ca);
         }
         dr.NextResult();
         while (dr.Read())
         {
             result.TotalCount = dr.GetInt32(0);
         }
     }
     return result;
 }
Esempio n. 2
0
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        string name = Request.Form[txtName.ID].Trim();

        if (string.IsNullOrEmpty(name) || Validator.IsMatchLessThanChineseCharacter(name, NAME_LENGTH))
        {
            lblMsg.Text = "分区名称不能为空,并且长度不能超过 " + NAME_LENGTH + " 个字符!";
            return;
        }

        CarrierArea ca = new CarrierArea();
        ca.Name = name;

        if (carrier == null)
        {
            carrier = CarrierOperation.GetCarrierById(int.Parse(ddlCarrier.SelectedItem.Value));
        }
        ca.Carrier = carrier;
        ca.Encode = CarrierAreaOperation.GetNextEncode();

        if (CarrierAreaOperation.CreateCarrierArea(ca))
        {
            lblMsg.Text = "添加成功!";
            return;
        }
        else
        {
            lblMsg.Text = "此分区名称已经存在!";
            return;
        }
    }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int id = 0;
     if (int.TryParse(Request.QueryString["id"], out id))
     {
         ca = CarrierAreaOperation.GetCarrierAreaById(id);
     }
     FormDataBind();
 }
Esempio n. 4
0
 public static bool CreateCarrierArea(CarrierArea ca)
 {
     if (dal.GetCarrierAreaByName(ca.Name, ca.Carrier.Id) != null)
     {
         return false;
     }
     dal.CreateCarrierArea(ca);
     return true;
 }
Esempio n. 5
0
 public void CreateCarrierArea(CarrierArea ca)
 {
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputNVarcharParameter("@name", 50, ca.Name),
         SqlUtilities.GenerateInputNVarcharParameter("@Encode", 50, ca.Encode),
         SqlUtilities.GenerateInputIntParameter("@carrier_id", ca.Carrier.Id)
     };
     string sql = "INSERT INTO carrier_area(name, encode, carrier_id) VALUES(@name, @encode, @carrier_id)";
     SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param);
 }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = 0;
        if (int.TryParse(Request.QueryString["id"], out id))
        {
            ca = CarrierAreaOperation.GetCarrierAreaById(id);
            lblCarrier.Text = ca.Carrier.Name;
            lblCarrierArea.Text = ca.Name;

            rpAreaCountry.DataSource = AreaCountryOperation.GetAreaCountryByCarrierAreaId(id);
            rpAreaCountry.DataBind();
        }
    }
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(Request.QueryString["id"], out id))
     {
         return;
     }
     ca = CarrierAreaOperation.GetCarrierAreaById(id);
     lblCarrier.Text = ca.Carrier.Name;
     lblCarrierArea.Text = ca.Name;
     if (!IsPostBack)
     {
         RpCountryDataBind();
     }
 }
Esempio n. 8
0
 public List<CarrierArea> GetCarrierAreaByCarrierId(int id)
 {
     List<CarrierArea> result = new List<CarrierArea>();
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@carrier_id", id)
     };
     string sql = "SELECT id, carrier_id, name, encode FROM carrier_area WHERE carrier_id = @carrier_id";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
     {
         while (dr.Read())
         {
             CarrierArea ca = new CarrierArea();
             ca.Id = dr.GetInt32(0);
             Carrier carrier = new CarrierDAL().GetCarrierById(dr.GetInt32(1));
             ca.Carrier = carrier;
             ca.Name = dr.GetString(2);
             ca.Encode = dr.GetString(3);
             result.Add(ca);
         }
     }
     return result;
 }
Esempio n. 9
0
 public void UpdateCarrierArea(CarrierArea ca)
 {
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@id", ca.Id),
         SqlUtilities.GenerateInputNVarcharParameter("@name", 50, ca.Name),
         SqlUtilities.GenerateInputNVarcharParameter("@Encode", 50, ca.Encode),
         SqlUtilities.GenerateInputIntParameter("@carrier_id", ca.Carrier.Id)
     };
     string sql = "UPDATE carrier_area SET name = @name, carrier_id = @carrier_id WHERE id = @id";
     SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param);
 }
Esempio n. 10
0
 public CarrierArea GetCarrierAreaByName(string name, int carrierId)
 {
     CarrierArea ca = null;
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputNVarcharParameter("@name", 50, name),
         SqlUtilities.GenerateInputIntParameter("@carrier_id", carrierId)
     };
     string sql = "SELECT id FROM carrier_area WHERE name = @name AND carrier_id = @carrier_id";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
     {
         while(dr.Read())
         {
             ca = new CarrierArea();
             ca.Id = dr.GetInt32(0);
         }
     }
     return ca;
 }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = 0;
        if (int.TryParse(Request.QueryString["id"], out id))
        {
            ca = CarrierAreaOperation.GetCarrierAreaById(id);
            carrier = CarrierOperation.GetCarrierById(ca.Carrier.Id);

            lblCarrier.Text = carrier.Name;
            lblCarrierArea.Text = ca.Name;
        }
        if (!decimal.TryParse(Request.QueryString["cd"], out clientDiscount) || !decimal.TryParse(Request.QueryString["ad"], out angencyDiscount))
        {
            return;
        }
        if (!IsPostBack)
        {
            RpChargeStandardDataBind();
        }
    }
Esempio n. 12
0
 public static void UpdateCarrierArea(CarrierArea ca)
 {
     dal.UpdateCarrierArea(ca);
 }