Пример #1
0
 public WeightCharge WeightChargeIDatareader(IDataReader dr)
 {
     WeightCharge obj = new WeightCharge();
     obj.ID = (dr["ID"] is DBNull) ? string.Empty : dr["ID"].ToString();
     obj.Name = (dr["Name"] is DBNull) ? string.Empty : dr["Name"].ToString();
     obj.Charge = (dr["Charge"] is DBNull) ? string.Empty : dr["Charge"].ToString();
     obj.Description = (dr["Description"] is DBNull) ? string.Empty : dr["Description"].ToString();
     return obj;
 }
Пример #2
0
 public List<WeightCharge> GetAllWeightCharge()
 {
     List<WeightCharge> list = new List<WeightCharge>();
     using (SqlCommand cmd = GetCommand("getAllWeightCharge", CommandType.StoredProcedure))
     {
         WeightCharge weightCharge = new WeightCharge();
         using (SqlDataReader dr = ExeDataReader(cmd))
         {
             if (dr.HasRows)
             {
                 while (dr.Read())
                 {
                     list.Add(weightCharge.WeightChargeIDatareader(dr));
                 }
             }
         }
         weightCharge = null;
     }
     return list;
 }
Пример #3
0
 public List<WeightCharge> GetWeightChargeByID(string id)
 {
     List<WeightCharge> list = new List<WeightCharge>();
     using (SqlCommand cmd = GetCommand("getWeightChargeByID", CommandType.StoredProcedure))
     {
         AddParameter(cmd, "@ID", Convert.ToInt32(id));
         WeightCharge weightCharge = new WeightCharge();
         using (SqlDataReader dr = ExeDataReader(cmd))
         {
             if (dr.HasRows)
             {
                 while (dr.Read())
                 {
                     list.Add(weightCharge.WeightChargeIDatareader(dr));
                 }
             }
         }
         weightCharge = null;
     }
     return list;
 }
 protected void btnCreate_Click(object sender, EventArgs e)
 {
     if (checkName() && checkChargeFormat() && Page.IsValid)
     {
         WeightCharge weightCharge = new WeightCharge();
         weightCharge.Name = txtName.Text;
         weightCharge.Charge = txtCharge.Text;
         weightCharge.Description = txtDescription.Text;
         bool result = WeightChargeBLL.InsertWeightCharge(weightCharge);
         if (result)
         {
             lblStatusCreate.Text = "Create Weight Charge successful!";
             Response.AddHeader("REFRESH", "2;URL=WeightManagement.aspx");
         }
         else
         {
             lblStatusCreate.Text = "Can not create new Weight Charge!";
             return;
         }
     }
 }
Пример #5
0
 public static bool UpdateWeightCharge(WeightCharge weightCharge)
 {
     return db.UpdateWeightCharge(weightCharge);
 }
Пример #6
0
 public static bool InsertWeightCharge(WeightCharge weightCharge)
 {
     return db.InsertWeightCharge(weightCharge);
 }
 private void LoadWeightCharge()
 {
     WeightCharge weightCharge = new WeightCharge();
     weightCharge = WeightChargeBLL.GetWeightChargeByID(WeightChargeID)[0];
     txtName.Text = weightCharge.Name;
     txtCharge.Text = Convert.ToDecimal(weightCharge.Charge).ToString("F");
     txtDescription.Text = weightCharge.Description;
 }
Пример #8
0
        public bool InsertWeightCharge(WeightCharge weightCharge)
        {
            using (SqlCommand cmd = GetCommand("insertWeightCharge", CommandType.StoredProcedure))
            {
                AddParameter(cmd, "@Name", weightCharge.Name);
                AddParameter(cmd, "@Charge", weightCharge.Charge);
                AddParameter(cmd, "@Description", weightCharge.Description);

                int result = ExeNonQuery(cmd);
                return result > 0;
            }
        }