protected void grdCustDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { bool _objct = new CustomerToTransport().isDelete("customer", (((Label)grdCustDetails.Rows[e.RowIndex].FindControl("lblCustID")).Text)); if (_objct) { Customer_cs _objCM = new Customer_cs(); _objCM.CustID = Convert.ToInt32(((Label)grdCustDetails.Rows[e.RowIndex].FindControl("lblCustID")).Text); _objCM.CustCode = ((Label)grdCustDetails.Rows[e.RowIndex].FindControl("lblCustCode")).Text; _objCM.CustName = ((Label)grdCustDetails.Rows[e.RowIndex].FindControl("lblCustName")).Text; _objCM.IsActive = Convert.ToBoolean(false); _objCM.IsDeleted = Convert.ToBoolean(true); _objCM.IsDeleted1 = Convert.ToBoolean(true); try { _objCM.Update(); MessageBox("Your record is Deleted"); PnlDetails.Visible = true; PnlAdd.Visible = false; } catch { } } else { MessageBox("You Can not Delete This Customer"); } }
// Save the Customer transport Details. void CustomerTransportSave() { try { CustomerToTransport _objCST = new CustomerToTransport(); _objCST.CustTransportID = 0; _objCST.CustCode = txtcustomer.Text.Trim(); _objCST.TransportID = Convert.ToInt32(DDlTransport.SelectedItem.Value.ToString()); _objCST.IsActive = true; _objCST.Save(); txtcustomer.Text = ""; DDlTransport.SelectedValue = null; lblCustName.Text = ""; } catch { } }
protected void btn_Save_Click(object sender, EventArgs e) { try { CustomerToTransport _objCST = new CustomerToTransport(); _objCST.CustTransportID = 0; _objCST.CustCode = txtcustomer.Text.Trim(); _objCST.TransportID = Convert.ToInt32(DDlTransport.SelectedItem.Value.ToString()); _objCST.IsActive = true; _objCST.Save(); MessageBox("Record saved successfully"); txtcustomer.Text = ""; DDlTransport.SelectedValue = null; lblCustName.Text = ""; } catch { } }
// Bindig Grid With Customer Transport Details. public DataTable BindgrdTransportDetails() { DataTable dt = CustomerToTransport.GetCustomerandTransporter1(); return(dt); }