private void LoadData() { ServiceCharge service = new ServiceCharge(); service = ServiceChargeBLL.GetServiceChargeByID(Request.QueryString["ServiceID"].ToString())[0]; lblServiceName.Text = service.Name; ltrDescription.Text = service.Description; }
public ServiceCharge ServiceChargeIDatareader(IDataReader dr) { ServiceCharge obj = new ServiceCharge(); 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; }
public List<ServiceCharge> GetAllServiceCharge() { List<ServiceCharge> list = new List<ServiceCharge>(); using (SqlCommand cmd = GetCommand("getAllServiceCharge", CommandType.StoredProcedure)) { ServiceCharge serviceCharge = new ServiceCharge(); using (SqlDataReader dr = ExeDataReader(cmd)) { if (dr.HasRows) { while (dr.Read()) { list.Add(serviceCharge.ServiceChargeIDatareader(dr)); } } } serviceCharge = null; } return list; }
public List<ServiceCharge> GetServiceChargeByID(string id) { List<ServiceCharge> list = new List<ServiceCharge>(); using (SqlCommand cmd = GetCommand("getServiceChargeByID", CommandType.StoredProcedure)) { AddParameter(cmd, "@ID", Convert.ToInt32(id)); ServiceCharge serviceCharge = new ServiceCharge(); using (SqlDataReader dr = ExeDataReader(cmd)) { if (dr.HasRows) { while (dr.Read()) { list.Add(serviceCharge.ServiceChargeIDatareader(dr)); } } } serviceCharge = null; } return list; }
protected void btnCreate_Click(object sender, EventArgs e) { if (checkName() && checkChargeFormat() && Page.IsValid) { ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge.Name = txtName.Text; serviceCharge.Charge = txtCharge.Text; serviceCharge.Description = txtDescription.Text; bool result = ServiceChargeBLL.InsertServiceCharge(serviceCharge); if (result) { lblStatusCreate.Text = "Create Service successful!"; Response.AddHeader("REFRESH", "2;URL=ServiceManagement.aspx"); } else { lblStatusCreate.Text = "Can not create new Service!"; return; } } }
public static bool UpdateServiceCharge(ServiceCharge serviceCharge) { return db.UpdateServiceCharge(serviceCharge); }
public static bool InsertServiceCharge(ServiceCharge serviceCharge) { return db.InsertServiceCharge(serviceCharge); }
public bool InsertServiceCharge(ServiceCharge serviceCharge) { using (SqlCommand cmd = GetCommand("insertServiceCharge", CommandType.StoredProcedure)) { AddParameter(cmd, "@Name", serviceCharge.Name); AddParameter(cmd, "@Charge", serviceCharge.Charge); AddParameter(cmd, "@Description", serviceCharge.Description); int result = ExeNonQuery(cmd); return result > 0; } }
private void LoadService() { ServiceCharge serviceCharge = new ServiceCharge(); serviceCharge = ServiceChargeBLL.GetServiceChargeByID(serviceChargeID)[0]; txtName.Text = serviceCharge.Name; txtCharge.Text = Convert.ToDecimal(serviceCharge.Charge).ToString("F"); txtDescription.Text = serviceCharge.Description; }