private void ClearForm() { TBEmpCode.Text = string.Empty; TBFirstName.Text = string.Empty; TBMiddleName.Text = string.Empty; TBLastName.Text = string.Empty; TBSearchCode.Text = string.Empty; TBDOB.Text = string.Empty; DDLMaritalStatus.SelectedIndex = 0; DDLGender.SelectedIndex = 0; TBDOJ.Text = string.Empty; DDLBusinessLocation.ClearSelection(); DDLDepartment.ClearSelection(); DDLEmployeeDesignation.ClearSelection(); CBNotAnEmployee.Checked = false; DDLWorkingShift.ClearSelection(); TBAddressLine1.Text = string.Empty; TBAddressLine2.Text = string.Empty; TBCity.Text = string.Empty; TBState.Text = string.Empty; TBCountry.Text = string.Empty; TBPin.Text = string.Empty; TBPhoneNumber.Text = string.Empty; TBMobileNumber.Text = string.Empty; TBFaxNumber.Text = string.Empty; TBEmail.Text = string.Empty; TBWebsite.Text = string.Empty; btnSubmit.Text = "Submit"; }
private void ClearForm() { TBCustomerCode.Text = string.Empty; RBCompany.Checked = false; RBIndividual.Checked = false; DDLBusinessLocation.ClearSelection(); TBSearchCode.Text = string.Empty; TBFirstName.Text = string.Empty; TBLastName.Text = string.Empty; TBCompanyName.Text = string.Empty; TBDOB.Text = string.Empty; TBAnniversaryDate.Text = string.Empty; TBVATNumber.Text = string.Empty; TBCSTNumber.Text = string.Empty; TBTINNumber.Text = string.Empty; TBPANNumber.Text = string.Empty; CBIsActive.Checked = false; TBAddressLine1.Text = string.Empty; TBAddressLine2.Text = string.Empty; TBCity.Text = string.Empty; TBState.Text = string.Empty; TBCountry.Text = string.Empty; TBPinCode.Text = string.Empty; TBPhoneNumber.Text = string.Empty; TBMobileNumber.Text = string.Empty; TBFaxNumber.Text = string.Empty; TBEmailID.Text = string.Empty; TBWebsite.Text = string.Empty; btnSubmit.Text = "Submit"; }
private void ShowEmployeeDetails(int recordId) { string Query = "SELECT * FROM View_EmployeeDetails WHERE ID='" + recordId + "'"; DataSet DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, Query); DataTable DTRecords = DSRecords.Tables[0]; if (DTRecords.Rows.Count > 0) { MVEmployee.ActiveViewIndex = 1; ImgLogo.ImageUrl = DTRecords.Rows[0]["Image"].ToString(); TBEmpCode.Text = DTRecords.Rows[0]["EmployeeCode"].ToString(); TBFirstName.Text = DTRecords.Rows[0]["FirstName"].ToString(); TBMiddleName.Text = DTRecords.Rows[0]["MiddleName"].ToString(); TBLastName.Text = DTRecords.Rows[0]["LastName"].ToString(); TBSearchCode.Text = DTRecords.Rows[0]["SearchCode"].ToString(); TBDOB.Text = DTRecords.Rows[0]["DateOfBirth"].ToString(); DDLMaritalStatus.ClearSelection(); DDLMaritalStatus.Items.FindByText(DTRecords.Rows[0]["MartialStatus"].ToString()).Selected = true; DDLGender.ClearSelection(); DDLGender.Items.FindByText(DTRecords.Rows[0]["Gender"].ToString()).Selected = true; TBDOJ.Text = DTRecords.Rows[0]["DateOfJoining"].ToString(); BindDDLBusinessLocation(); DDLBusinessLocation.ClearSelection(); DDLBusinessLocation.Items.FindByValue(DTRecords.Rows[0]["BusinessLocation"].ToString()).Selected = true; BindDDLDepartment(); DDLDepartment.ClearSelection(); DDLDepartment.Items.FindByValue(DTRecords.Rows[0]["Department"].ToString()).Selected = true; BindDDLDesignation(); DDLEmployeeDesignation.ClearSelection(); DDLEmployeeDesignation.Items.FindByValue(DTRecords.Rows[0]["Designation"].ToString()).Selected = true; //CBCanRequestReportViaSMS.Checked = Convert.ToBoolean(DTRecords.Rows[0]["EmployeeCode"].ToString()); CBNotAnEmployee.Checked = Convert.ToBoolean(DTRecords.Rows[0]["NotAnEmployee"].ToString()); BindDDLWorkShift(); DDLWorkingShift.ClearSelection(); DDLWorkingShift.Items.FindByValue(DTRecords.Rows[0]["WorkingShift"].ToString()).Selected = true; TBAddressLine1.Text = DTRecords.Rows[0]["Address1"].ToString(); TBAddressLine2.Text = DTRecords.Rows[0]["Address2"].ToString(); TBCity.Text = DTRecords.Rows[0]["City"].ToString(); TBState.Text = DTRecords.Rows[0]["State"].ToString(); TBCountry.Text = DTRecords.Rows[0]["Country"].ToString(); TBPin.Text = DTRecords.Rows[0]["ZipCode"].ToString(); TBPhoneNumber.Text = DTRecords.Rows[0]["TelephoneNumber"].ToString(); TBMobileNumber.Text = DTRecords.Rows[0]["MobileNumber"].ToString(); TBFaxNumber.Text = DTRecords.Rows[0]["FaxNumber"].ToString(); TBEmail.Text = DTRecords.Rows[0]["Email"].ToString(); TBWebsite.Text = DTRecords.Rows[0]["Website"].ToString(); btnSubmit.Text = "Update"; } }
private void BindDDLBusinessLocation() { SqlParameter[] arrparm = new SqlParameter[2]; arrparm[0] = new SqlParameter("@Action", "SELECT_ByStatus"); arrparm[1] = new SqlParameter("@Status", true); DataSet DSRecordBusinessLocation = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_BusinessLocation_CRUD", arrparm); if (DSRecordBusinessLocation.Tables[0].Rows.Count > 0) { DDLBusinessLocation.DataSource = DSRecordBusinessLocation.Tables[0]; DDLBusinessLocation.DataTextField = "BusinessLocationName"; DDLBusinessLocation.DataValueField = "ID"; DDLBusinessLocation.DataBind(); DDLBusinessLocation.Items.Insert(0, new ListItem("Select", "0")); } }
private void BindBL() { try { SqlParameter[] arrParam = new SqlParameter[1]; arrParam[0] = new SqlParameter("@Action", "SELECT"); DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_BusinessLocation_CRUD", arrParam); if (DSRecords.Tables[0].Rows.Count > 0) { DDLBusinessLocation.DataSource = DSRecords.Tables[0]; DDLBusinessLocation.DataTextField = "BusinessLocationName"; DDLBusinessLocation.DataValueField = "ID"; DDLBusinessLocation.DataBind(); DDLBusinessLocation.Items.Insert(0, new System.Web.UI.WebControls.ListItem("-Select-", "0")); } } catch (Exception ex) { ShowMessage(ex.Message, MessageType.Error); } }
private void BindDDLBusinessLocation() { SqlParameter[] arrparm = new SqlParameter[1]; arrparm[0] = new SqlParameter("@Action", "SELECT"); DataSet DSRecord = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_BusinessLocation_CRUD", arrparm); if (DSRecord.Tables[0].Rows.Count > 0) { DDLBusinessLocation.DataSource = DSRecord.Tables[0]; DDLBusinessLocation.DataTextField = "BusinessLocationName"; DDLBusinessLocation.DataValueField = "ID"; DDLBusinessLocation.DataBind(); } string qury = "Select DocumentPrefix From BusinessLocation Where ID= '" + DDLBusinessLocation.SelectedValue + "'"; DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, qury); if (ds.Tables[0].Rows.Count > 0) { LBLBusinessLocationPrefix.Text = ds.Tables[0].Rows[0]["DocumentPrefix"].ToString(); } }
protected void GVCustomer_RowCommand(object sender, GridViewCommandEventArgs e) { int MRecordID = Convert.ToInt32(e.CommandArgument); Session["MRecordID"] = MRecordID; #region For Command EditRecord if (e.CommandName == "EditRecord") { MVCustomers.ActiveViewIndex = 1; SqlParameter[] arrParam = new SqlParameter[2]; arrParam[0] = new SqlParameter("@Action", "SELECT_ByID"); arrParam[1] = new SqlParameter("@ID", MRecordID); DataSet DSRecords1 = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Customer_CRUD", arrParam); if (DSRecords1.Tables[0].Rows.Count > 0) { ImgLogo.ImageUrl = DSRecords1.Tables[0].Rows[0]["Image"].ToString(); TBCustomerCode.Text = DSRecords1.Tables[0].Rows[0]["CustomerCode"].ToString(); TBCustomerCode.Enabled = false; if (DSRecords1.Tables[0].Rows[0]["CustomerType"].ToString() == "Individual") { RBIndividual.Checked = true; } if (DSRecords1.Tables[0].Rows[0]["CustomerType"].ToString() == "Company") { RBCompany.Checked = true; } TBFirstName.Text = DSRecords1.Tables[0].Rows[0]["FirstName"].ToString(); TBLastName.Text = DSRecords1.Tables[0].Rows[0]["LastName"].ToString(); TBCompanyName.Text = DSRecords1.Tables[0].Rows[0]["CompanyName"].ToString(); TBAddressLine1.Text = DSRecords1.Tables[0].Rows[0]["AddressLine1"].ToString(); TBAddressLine2.Text = DSRecords1.Tables[0].Rows[0]["AddressLine2"].ToString(); TBCity.Text = DSRecords1.Tables[0].Rows[0]["City"].ToString(); TBState.Text = DSRecords1.Tables[0].Rows[0]["State"].ToString(); TBCountry.Text = DSRecords1.Tables[0].Rows[0]["Country"].ToString(); TBPinCode.Text = DSRecords1.Tables[0].Rows[0]["PinCode"].ToString(); TBPhoneNumber.Text = DSRecords1.Tables[0].Rows[0]["PhoneNumber"].ToString(); TBMobileNumber.Text = DSRecords1.Tables[0].Rows[0]["MobileNumber"].ToString(); TBFaxNumber.Text = DSRecords1.Tables[0].Rows[0]["FaxNumber"].ToString(); TBEmailID.Text = DSRecords1.Tables[0].Rows[0]["EmailID"].ToString(); TBWebsite.Text = DSRecords1.Tables[0].Rows[0]["Website"].ToString(); TBVATNumber.Text = DSRecords1.Tables[0].Rows[0]["VATNumber"].ToString(); TBCSTNumber.Text = DSRecords1.Tables[0].Rows[0]["CSTNumber"].ToString(); TBTINNumber.Text = DSRecords1.Tables[0].Rows[0]["TINNumber"].ToString(); TBPANNumber.Text = DSRecords1.Tables[0].Rows[0]["PANNumber"].ToString(); TBSearchCode.Text = DSRecords1.Tables[0].Rows[0]["SearchCode"].ToString(); BindBusinessLocation(); DDLBusinessLocation.ClearSelection(); DDLBusinessLocation.Items.FindByValue(DSRecords1.Tables[0].Rows[0]["BusinessLocation"].ToString()).Selected = true; TBDOB.Text = DSRecords1.Tables[0].Rows[0]["BirthDate"].ToString(); TBAnniversaryDate.Text = DSRecords1.Tables[0].Rows[0]["AnniversaryDate"].ToString(); CBIsActive.Checked = Convert.ToBoolean(DSRecords1.Tables[0].Rows[0]["IsActive"].ToString()); } SqlParameter[] arrParam2 = new SqlParameter[2]; arrParam2[0] = new SqlParameter("@Action", "SELECT_ByMasterID"); arrParam2[1] = new SqlParameter("@CustomerID", MRecordID); DataSet DSRecords2 = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_CustomerContacts_CRUD", arrParam2); // Bind Table CreateDTTable(); TempDT = ViewState["DTTable"] as DataTable; for (int i = 0; i < DSRecords2.Tables[0].Rows.Count; i++) { TempDT.Rows.Add(null, DSRecords2.Tables[0].Rows[i]["Title"].ToString(), DSRecords2.Tables[0].Rows[i]["ContactName"].ToString(), DSRecords2.Tables[0].Rows[i]["Position"].ToString(), DSRecords2.Tables[0].Rows[i]["EmailID"].ToString(), DSRecords2.Tables[0].Rows[i]["PhoneNumber"].ToString(), DSRecords2.Tables[0].Rows[i]["MobileNumber"].ToString(), DSRecords2.Tables[0].Rows[i]["Note"].ToString(), DSRecords2.Tables[0].Rows[i]["AddressType"].ToString(), DSRecords2.Tables[0].Rows[i]["AddressLine1"].ToString(), DSRecords2.Tables[0].Rows[i]["AddressLine2"].ToString(), DSRecords2.Tables[0].Rows[i]["City"].ToString(), DSRecords2.Tables[0].Rows[i]["State"].ToString(), DSRecords2.Tables[0].Rows[i]["Country"].ToString(), DSRecords2.Tables[0].Rows[i]["PinCode"].ToString()); } RepeaterAddressDetails.DataSource = TempDT; RepeaterAddressDetails.DataBind(); ViewState["DTTable"] = TempDT; btnSubmit.Text = "Update"; } #endregion #region For Command DeleteRecord if (e.CommandName == "DeleteRecord") { SqlParameter[] arrParam = new SqlParameter[2]; arrParam[0] = new SqlParameter("@Action", "DELETE_ByMasterID"); arrParam[1] = new SqlParameter("@POID", MRecordID); int result = SqlHelper.ExecuteNonQuery(Connection.connect(), CommandType.StoredProcedure, "SP_CustomerContacts_CRUD", arrParam); SqlParameter[] arrParam1 = new SqlParameter[2]; arrParam1[0] = new SqlParameter("@Action", "DELETE"); arrParam1[1] = new SqlParameter("@ID", MRecordID); int result1 = SqlHelper.ExecuteNonQuery(Connection.connect(), CommandType.StoredProcedure, "SP_Customer_CRUD", arrParam1); BindGVCustomer(); } #endregion #region For Command ChangeStatus if (e.CommandName == "ChangeStatus") { SqlParameter[] arrParam = new SqlParameter[2]; arrParam[0] = new SqlParameter("@Action", "SELECT_ByID"); arrParam[1] = new SqlParameter("@ID", MRecordID); DataSet DSRecords = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Customer_CRUD", arrParam); DataTable DTRecords = DSRecords.Tables[0]; if (DTRecords.Rows.Count > 0) { #region Change Status True To False if (DTRecords.Rows[0]["Status"].ToString() == "True") { SqlParameter[] arrParam2 = new SqlParameter[3]; arrParam2[0] = new SqlParameter("@Action", "UPDATE_Status"); arrParam2[1] = new SqlParameter("@Status", false); arrParam2[2] = new SqlParameter("@ID", MRecordID); int Result = SqlHelper.ExecuteNonQuery(Connection.connect(), CommandType.StoredProcedure, "SP_Customer_CRUD", arrParam2); } #endregion #region Change Status False TO True if (DTRecords.Rows[0]["Status"].ToString() == "False") { SqlParameter[] arrParam2 = new SqlParameter[3]; arrParam2[0] = new SqlParameter("@Action", "UPDATE_Status"); arrParam2[1] = new SqlParameter("@Status", true); arrParam2[2] = new SqlParameter("@ID", MRecordID); int Result = SqlHelper.ExecuteNonQuery(Connection.connect(), CommandType.StoredProcedure, "SP_Customer_CRUD", arrParam2); } #endregion } BindGVCustomer(); } #endregion }