public int SaveCustomerAddress(Entity.Customer.CustomerAddress ObjElCustomerAddress) { int rowsAffacted = 0; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "usp_Customer_CustomerAddress_Save"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CustomerAddressId", ObjElCustomerAddress.CustomerAddressId); cmd.Parameters.AddWithValue("@tAddress", ObjElCustomerAddress.TAddress); cmd.Parameters.AddWithValue("@tStreet", ObjElCustomerAddress.TStreet); cmd.Parameters.AddWithValue("@CustomerMasterId_FK", ObjElCustomerAddress.CustomerMasterId_FK); cmd.Parameters.AddWithValue("UserId", ObjElCustomerAddress.UserId); cmd.Parameters.AddWithValue("CompanyMasterId_FK", ObjElCustomerAddress.CompanyMasterId_FK); if (con.State == ConnectionState.Closed) { con.Open(); } rowsAffacted = cmd.ExecuteNonQuery(); con.Close(); } } return(rowsAffacted); }
public DataTable FetchCustomerAddressDetailsById(Entity.Customer.CustomerAddress ObjElCustomerAddress) { using (DataTable dt = new DataTable()) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_Customer_CustomerAddress_GeyById"; cmd.Parameters.AddWithValue("@CustomerAddressId", ObjElCustomerAddress.CustomerAddressId); //cmd.Parameters.AddWithValue("CompanyMasterId_FK", ObjElCustomerAddress.CompanyMasterId_FK); if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } con.Close(); } } return(dt); } }
private void FetchCustomerAddressDetailsById(long Id) { Business.Customer.CustomerAddress objCustomerAddress = new Business.Customer.CustomerAddress(); Entity.Customer.CustomerAddress customerAddress = new Entity.Customer.CustomerAddress(); customerAddress.CustomerAddressId = Id; DataTable dr = objCustomerAddress.FetchCustomerAddressDetailsById(customerAddress); if (dr.Rows.Count > 0) { txttAddress.Text = dr.Rows[0]["tAddress"].ToString(); txtStreet.Text = dr.Rows[0]["tStreet"].ToString(); CustomerAddressId = Convert.ToInt64(dr.Rows[0]["CustomerAddressId"].ToString()); } }
protected void gvCustomerAddressList_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "E") { CustomerAddressId = Convert.ToInt64(e.CommandArgument.ToString()); FetchCustomerAddressDetailsById(Convert.ToInt64(e.CommandArgument.ToString())); TabContainer2.ActiveTab = AddAddress; ModalPopupExtender2.Show(); } else if (e.CommandName == "D") { CustomerAddressId = Convert.ToInt64(e.CommandArgument.ToString()); int i = 0; Business.Customer.CustomerAddress ObjBelCustomerAddress = new Business.Customer.CustomerAddress(); Entity.Customer.CustomerAddress ObjElCustomerAddress = new Entity.Customer.CustomerAddress(); // ObjElCustomerAddress.CustomerAddressId = Id; ObjElCustomerAddress.CustomerAddressId = CustomerAddressId; i = ObjBelCustomerAddress.DeleteCustomerAddressById(ObjElCustomerAddress); if (i > 0) { CleartextBoxes(this); ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Data Delete Succesfully....');", true); CustomerContactDetailsId = 0; } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Data Can not Delete!!!....');", true); } //ModalPopupExtender1.Show(); CustomerContactDetailsId = 0; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private void GetAllAddress(long Id) { Business.Customer.CustomerAddress objCustomerAddress = new Business.Customer.CustomerAddress(); Entity.Customer.CustomerAddress customerAddress = new Entity.Customer.CustomerAddress(); customerAddress.CompanyMasterId_FK = 1; customerAddress.CustomerMasterId_FK = Id; DataTable dt = objCustomerAddress.GetAllAddress(customerAddress); if (dt.Rows.Count > 0) { gvCustomerAddressList.DataSource = dt; gvCustomerAddressList.DataBind(); } else { gvCustomerAddressList.DataSource = null; gvCustomerAddressList.DataBind(); } }
protected void btnSaveAddressDetails_Click(object sender, EventArgs e) { try { Business.Customer.CustomerAddress objCustomerAddress = new Business.Customer.CustomerAddress(); Entity.Customer.CustomerAddress customerAddress = new Entity.Customer.CustomerAddress(); customerAddress.CustomerAddressId = CustomerAddressId; customerAddress.TAddress = txttAddress.Text; customerAddress.TStreet = txtStreet.Text; customerAddress.CompanyMasterId_FK = 1; customerAddress.UserId = 1; customerAddress.CustomerMasterId_FK = CustomerId; int i = 0; i = objCustomerAddress.SaveCustomerAddress(customerAddress); if (i > 0) { CleartextBoxes(this); ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Data save succesfully....');", true); GetAllAddress(CustomerId); CustomerAddressId = 0; TabContainer2.ActiveTab = AddressList; ModalPopupExtender2.Show(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Data Ccn not save!!!....');", true); //Message.IsSuccess = false; //Message.Text = "Can not save!!!"; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
public DataTable GetAllAddress(Entity.Customer.CustomerAddress ObjElCustomerAddress) { using (DataTable dt = new DataTable()) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_Customer_CustomerAddress_GetAll"; cmd.Parameters.AddWithValue("@CustomerMasterId_FK", ObjElCustomerAddress.CustomerMasterId_FK); cmd.Parameters.AddWithValue("CompanyMasterId_FK", ObjElCustomerAddress.CompanyMasterId_FK); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } con.Close(); } } return(dt); } }
public int DeleteCustomerAddressById(Entity.Customer.CustomerAddress ObjElCustomerAddress) { return(ObjBelCustomerAddress.DeleteCustomerAddressById(ObjElCustomerAddress)); }
public DataTable FetchCustomerAddressDetailsById(Entity.Customer.CustomerAddress ObjElCustomerAddress) { return(ObjBelCustomerAddress.FetchCustomerAddressDetailsById(ObjElCustomerAddress)); }
public System.Data.DataTable GetAllAddress(Entity.Customer.CustomerAddress ObjElCustomerAddress) { return(ObjBelCustomerAddress.GetAllAddress(ObjElCustomerAddress)); }
public int SaveCustomerAddress(Entity.Customer.CustomerAddress ObjElCustomerAddress) { return(ObjBelCustomerAddress.SaveCustomerAddress(ObjElCustomerAddress)); }