public DataTable GetCokeSupplierByLoginName(string loginName) { DataTable dt = new DataTable(); try { objML_CokeSupplier = new ML_CokeSupplier(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@loginName", loginName) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeSupplierByLoginName.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog( } return(dt); }
private DataTable BindGridViewBySearch(ML_CokeSupplier objML_CokeSupplier) { DataTable dtCokeSupplier = new DataTable("GridSearch"); try { objBusinessClass = new BusinessLayer.BusinessClass(); dtCokeSupplier = objBusinessClass.GetCokeSupplierBySeacrh(objML_CokeSupplier); } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } return(dtCokeSupplier); }
private void FillGrid() { try { DataTable DtList = null; if (ViewState["grdCokeSupplier"] == null) { ML_CokeSupplier objML_CokeSupplierh = new ML_CokeSupplier(); objML_CokeSupplierh.CokeSupplier = ML_Common.clean(txtCokeSupplierSearch.Text); objBusinessClass = new BusinessLayer.BusinessClass(); DtList = objBusinessClass.GetCokeSupplierBySeacrh(objML_CokeSupplierh); ViewState["grdCokeSupplier"] = DtList; } else { DtList = (DataTable)ViewState["grdCokeSupplier"]; } if (DtList != null) { // DtList = (DataTable)ViewState["grdPitchType"]; if (DtList.Rows.Count > 0) { grdCokeSupplier.DataSource = DtList; grdCokeSupplier.DataBind(); } else { DtList.Rows.Add(DtList.NewRow()); grdCokeSupplier.DataSource = DtList; grdCokeSupplier.DataBind(); int TotalColumns = grdCokeSupplier.Rows[0].Cells.Count; grdCokeSupplier.Rows[0].Cells.Clear(); grdCokeSupplier.Rows[0].Cells.Add(new TableCell()); grdCokeSupplier.Rows[0].Cells[0].ColumnSpan = TotalColumns; grdCokeSupplier.Rows[0].Cells[0].Text = "No Record Found"; } UpdatePanelGrid.Update(); } } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } }
public ML_CokeSupplier GetCokeSupplierByCokeSupplierId(int CokeSupplierId) { DataTable dt = new DataTable(); try { objML_CokeSupplier = new ML_CokeSupplier(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@CokeSupplierId", CokeSupplierId) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeSupplierByCokeSupplierId.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; objML_CokeSupplier.Id = ML_Common.string2int32(ML_Common.clean(dr["Id"].ToString())); objML_CokeSupplier.CokeSupplierId = ML_Common.string2int32(ML_Common.clean(dr["CokeSupplierId"].ToString())); objML_CokeSupplier.CokeSupplier = ML_Common.clean(dr["CokeSupplier"].ToString()); objML_CokeSupplier.Address1 = ML_Common.clean(dr["Address1"].ToString()); objML_CokeSupplier.Address2 = ML_Common.clean(dr["Address2"].ToString()); objML_CokeSupplier.Address3 = ML_Common.clean(dr["Address3"].ToString()); objML_CokeSupplier.CityName = ML_Common.clean(dr["CityName"].ToString()); objML_CokeSupplier.StateName = ML_Common.clean(dr["StateName"].ToString()); objML_CokeSupplier.PinCode = ML_Common.clean(dr["PinCode"].ToString()); objML_CokeSupplier.Title = ML_Common.clean(dr["Title"].ToString()); objML_CokeSupplier.CountryName = ML_Common.clean(dr["CountryName"].ToString()); objML_CokeSupplier.ContactPerson = ML_Common.clean(dr["ContactPerson"].ToString()); objML_CokeSupplier.MobNo = ML_Common.clean(dr["MobNo"].ToString()); objML_CokeSupplier.WebSite = ML_Common.clean(dr["WebSite"].ToString()); objML_CokeSupplier.Email = ML_Common.clean(dr["Email"].ToString()); objML_CokeSupplier.Remarks = ML_Common.clean(dr["Remarks"].ToString()); objML_CokeSupplier.IsActive = ML_Common.clean(dr["IsActive"].ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(dr["IsArchive"].ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString())); objML_CokeSupplier.CreatedBy = ML_Common.clean(dr["CreatedBy"].ToString()); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString())); objML_CokeSupplier.ModifiedBy = ML_Common.clean(dr["ModifiedBy"].ToString()); objML_CokeSupplier.CreatedByUserNameId = ML_Common.string2int(ML_Common.clean(dr["CreatedByUserNameId"].ToString())); } } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog( } return(objML_CokeSupplier); }
public int Add(ML_CokeSupplier objML_CokeSupplier) { int results = 0; try { SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output); ReturnObj.Direction = ParameterDirection.Output; SqlParameter[] parameters = { #region Add Properties //new SqlParameter("@Id", objML_CokeSupplier.Id), //new SqlParameter("@CokeSupplierId", objML_CokeSupplier.CokeSupplierId), new SqlParameter("@CokeSupplier", objML_CokeSupplier.CokeSupplier), new SqlParameter("@Address1", objML_CokeSupplier.Address1), new SqlParameter("@Address2", objML_CokeSupplier.Address2), new SqlParameter("@Address3", objML_CokeSupplier.Address3), new SqlParameter("@CityName", objML_CokeSupplier.CityName), new SqlParameter("@StateName", objML_CokeSupplier.StateName), new SqlParameter("@PinCode", objML_CokeSupplier.PinCode), new SqlParameter("@Title", objML_CokeSupplier.Title), new SqlParameter("@CountryName", objML_CokeSupplier.CountryName), new SqlParameter("@ContactPerson", objML_CokeSupplier.ContactPerson), new SqlParameter("@MobNo", objML_CokeSupplier.MobNo), new SqlParameter("@WebSite", objML_CokeSupplier.WebSite), new SqlParameter("@Email", objML_CokeSupplier.Email), new SqlParameter("@Remarks", objML_CokeSupplier.Remarks), new SqlParameter("@IsActive", objML_CokeSupplier.IsActive), new SqlParameter("@IsArchive", objML_CokeSupplier.IsArchive), //new SqlParameter("@CreatedDate", objML_CokeSupplier.CreatedDate), new SqlParameter("@CreatedBy", objML_CokeSupplier.CreatedBy), //new SqlParameter("@ModifiedDate", objML_CokeSupplier.ModifiedDate), //new SqlParameter("@ModifiedBy", objML_CokeSupplier.ModifiedBy), new SqlParameter("@CreatedByUserNameId", objML_CokeSupplier.CreatedByUserNameId), ReturnObj #endregion }; this.Parameters = parameters; SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_SaveCokeSupplier.ToString(), this.Parameters); if (ReturnObj.Value != null) { results = ML_Common.string2int32(ReturnObj.Value.ToString()); } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; throw; } catch (Exception ex) { results = 0; Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog( } return(results); }
public DataTable GetCokeSupplierBySeacrh(ML_CokeSupplier objML_CokeSupplier) { DataTable dt = new DataTable(); try { DateTime?dtFromdate = null; DateTime objFromdate; if (DateTime.TryParse(objML_CokeSupplier.FromDate.ToString(), out objFromdate)) { if (objFromdate.ToString() != "1/1/1900 12:00:00 AM") { dtFromdate = objFromdate; } } DateTime?dtTodate = null; DateTime objdtTodate; if (DateTime.TryParse(objML_CokeSupplier.ToDate.ToString(), out objdtTodate)) { if (objdtTodate.ToString() != "1/1/1900 12:00:00 AM") { dtTodate = objdtTodate; } } SqlParameter[] parameters = { #region Search Properties //new SqlParameter("@Id", objML_CokeSupplier.Id), // new SqlParameter("@CokeSupplierId", objML_CokeSupplier.CokeSupplierId), new SqlParameter("@CokeSupplier", objML_CokeSupplier.CokeSupplier), //new SqlParameter("@Address1", objML_CokeSupplier.Address1), //new SqlParameter("@Address2", objML_CokeSupplier.Address2), //new SqlParameter("@Address3", objML_CokeSupplier.Address3), //new SqlParameter("@CityName", objML_CokeSupplier.CityName), //new SqlParameter("@StateName", objML_CokeSupplier.StateName), //new SqlParameter("@PinCode", objML_CokeSupplier.PinCode), //new SqlParameter("@Title", objML_CokeSupplier.Title), //new SqlParameter("@CountryName", objML_CokeSupplier.CountryName), //new SqlParameter("@ContactPerson", objML_CokeSupplier.ContactPerson), //new SqlParameter("@MobNo", objML_CokeSupplier.MobNo), //new SqlParameter("@WebSite", objML_CokeSupplier.WebSite), //new SqlParameter("@Email", objML_CokeSupplier.Email), //new SqlParameter("@Remarks", objML_CokeSupplier.Remarks), //new SqlParameter("@IsActive", objML_CokeSupplier.IsActive), //new SqlParameter("@IsArchive", objML_CokeSupplier.IsArchive), //new SqlParameter("@CreatedDate", objML_CokeSupplier.CreatedDate), //new SqlParameter("@CreatedBy", objML_CokeSupplier.CreatedBy), //new SqlParameter("@ModifiedDate", objML_CokeSupplier.ModifiedDate), //new SqlParameter("@ModifiedBy", objML_CokeSupplier.ModifiedBy), //new SqlParameter("@CreatedByUserNameId", objML_CokeSupplier.CreatedByUserNameId), new SqlParameter("@FromDate", dtFromdate), new SqlParameter("@ToDate", dtTodate) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeSupplierBySearch.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); } } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); throw; } finally { //LogManager.LogManager.WriteTraceLog( } return(dt); }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeSupplier = new ML_CokeSupplier(); objML_CokeSupplier.CokeSupplier = ML_Common.string2string(txtCokeSupplier.Text); objML_CokeSupplier.Address1 = ML_Common.clean(txtAddress1.Text); objML_CokeSupplier.Address2 = ML_Common.clean(txtAddress2.Text); objML_CokeSupplier.Address3 = ML_Common.clean(txtAddress3.Text); objML_CokeSupplier.CityName = string.Empty; // ML_Common.clean(txtCityName.Text); objML_CokeSupplier.StateName = string.Empty; // ML_Common.clean(txtStateName.Text); objML_CokeSupplier.PinCode = string.Empty; // ML_Common.clean(txtPinCode.Text); objML_CokeSupplier.Title = string.Empty; //ML_Common.clean(txtTitle.Text); objML_CokeSupplier.CountryName = string.Empty; //ML_Common.clean(txtCountryName.Text); objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPerson.Text); objML_CokeSupplier.MobNo = ML_Common.clean(txtMobNo.Text); objML_CokeSupplier.WebSite = string.Empty;// ML_Common.clean(txtWebSite.Text); objML_CokeSupplier.Email = ML_Common.clean(txtEmail.Text); objML_CokeSupplier.Remarks = ML_Common.clean(txtRemarks.Text); objML_CokeSupplier.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.CreatedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.ModifiedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameId.Text)); int obhReturn = objBusinessClass.AddCokeSupplier(objML_CokeSupplier); if (obhReturn == 1) { lblMsg.Text = "Record Saved Successfully"; FormFieldsClear(); } else { lblMsg.Text = "Record Already Exists!"; FormFieldsClear(); } } catch (SqlException sqlExc) { lblMsg.Text = "Record Already Exists!"; SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; if (IsValid) { //errNumber = -1; BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = Convert.ToInt32(ViewState["grdCokeSupplierId"]); ML_CokeSupplier objML_CokeSupplier = objBusinessClass.GetCokeSupplierById(lngId); try { if (objML_CokeSupplier != null) { // objML_CokeSupplier.Id = ML_Common.string2int32(ML_Common.clean(txtIdEdit.Text)); // objML_CokeSupplier.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierEdit, true)); objML_CokeSupplier.CokeSupplier = ML_Common.string2string(txtCokeSupplierEdit.Text); objML_CokeSupplier.Address1 = ML_Common.clean(txtAddress1Edit.Text); objML_CokeSupplier.Address2 = ML_Common.clean(txtAddress2Edit.Text); objML_CokeSupplier.Address3 = ML_Common.clean(txtAddress3Edit.Text); objML_CokeSupplier.CityName = string.Empty; //ML_Common.clean(txtCityNameEdit.Text); objML_CokeSupplier.StateName = string.Empty; // ML_Common.clean(txtStateNameEdit.Text); objML_CokeSupplier.PinCode = string.Empty; //ML_Common.clean(txtPinCodeEdit.Text); objML_CokeSupplier.Title = string.Empty; // ML_Common.clean(txtTitleEdit.Text); objML_CokeSupplier.CountryName = string.Empty; // ML_Common.clean(txtCountryNameEdit.Text); objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPersonEdit.Text); objML_CokeSupplier.MobNo = ML_Common.clean(txtMobNoEdit.Text); objML_CokeSupplier.WebSite = string.Empty;// ML_Common.clean(txtWebSiteEdit.Text); objML_CokeSupplier.Email = ML_Common.clean(txtEmailEdit.Text); objML_CokeSupplier.Remarks = ML_Common.clean(txtRemarksEdit.Text); objML_CokeSupplier.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.CreatedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.ModifiedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameIdEdit.Text)); // int obhReturn = objBusinessClass.UpdateUniqueCokeSupplier(objML_CokeSupplier); int obhReturn = objBusinessClass.UpdateCokeSupplier(objML_CokeSupplier); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; ModalPopupExtenderEdit.Hide(); lblMsgEdit.Text = string.Empty; } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsgEdit.Text = "Record Already Exists!"; lblMsg.Visible = true; ModalPopupExtenderEdit.Hide(); } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsgEdit.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } FillGrid(); } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
private void FillObjectToForm(int lngId, bool IsEditFlag = true) { objBusinessClass = new BusinessLayer.BusinessClass(); ML_CokeSupplier objML_CokeSupplier = objBusinessClass.GetCokeSupplierById(lngId); try { if (objML_CokeSupplier != null) { if (IsEditFlag) { //txtIdEdit.Text = ML_Common.clean(objML_CokeSupplier.Id); //txtCokeSupplierIdEdit.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplierId); txtCokeSupplierEdit.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplier); txtAddress1Edit.Text = ML_Common.clean(objML_CokeSupplier.Address1); txtAddress2Edit.Text = ML_Common.clean(objML_CokeSupplier.Address2); txtAddress3Edit.Text = ML_Common.clean(objML_CokeSupplier.Address3); //txtCityNameEdit.Text = ML_Common.clean(objML_CokeSupplier.CityName); //txtStateNameEdit.Text = ML_Common.clean(objML_CokeSupplier.StateName); //txtPinCodeEdit.Text = ML_Common.clean(objML_CokeSupplier.PinCode); //txtTitleEdit.Text = ML_Common.clean(objML_CokeSupplier.Title); //txtCountryNameEdit.Text = ML_Common.clean(objML_CokeSupplier.CountryName); txtContactPersonEdit.Text = ML_Common.clean(objML_CokeSupplier.ContactPerson); txtMobNoEdit.Text = ML_Common.clean(objML_CokeSupplier.MobNo); // txtWebSiteEdit.Text = ML_Common.clean(objML_CokeSupplier.WebSite); txtEmailEdit.Text = ML_Common.clean(objML_CokeSupplier.Email); txtRemarksEdit.Text = ML_Common.clean(objML_CokeSupplier.Remarks); //txtIsActiveEdit.Text = ML_Common.clean(objML_CokeSupplier.IsActive); //txtIsArchiveEdit.Text = ML_Common.clean(objML_CokeSupplier.IsArchive); //txtCreatedDateEdit.Text = ML_Common.clean(objML_CokeSupplier.CreatedDate); //txtCreatedByEdit.Text = ML_Common.clean(objML_CokeSupplier.CreatedBy); //txtModifiedDateEdit.Text = ML_Common.clean(objML_CokeSupplier.ModifiedDate); //txtModifiedByEdit.Text = ML_Common.clean(objML_CokeSupplier.ModifiedBy); //txtCreatedByUserNameIdEdit.Text = ML_Common.clean(objML_CokeSupplier.CreatedByUserNameId); } else { //lblId.Text = ML_Common.clean(objML_CokeSupplier.Id); //lblCokeSupplierId.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplierId); lblCokeSupplier.Text = ML_Common.clean(objML_CokeSupplier.CokeSupplier); lblAddress1.Text = ML_Common.clean(objML_CokeSupplier.Address1); lblAddress2.Text = ML_Common.clean(objML_CokeSupplier.Address2); lblAddress3.Text = ML_Common.clean(objML_CokeSupplier.Address3); //lblCityName.Text = ML_Common.clean(objML_CokeSupplier.CityName); //lblStateName.Text = ML_Common.clean(objML_CokeSupplier.StateName); //lblPinCode.Text = ML_Common.clean(objML_CokeSupplier.PinCode); //lblTitle.Text = ML_Common.clean(objML_CokeSupplier.Title); //lblCountryName.Text = ML_Common.clean(objML_CokeSupplier.CountryName); lblContactPerson.Text = ML_Common.clean(objML_CokeSupplier.ContactPerson); lblMobNo.Text = ML_Common.clean(objML_CokeSupplier.MobNo); lblWebSite.Text = ML_Common.clean(objML_CokeSupplier.WebSite); lblEmail.Text = ML_Common.clean(objML_CokeSupplier.Email); lblRemarks.Text = ML_Common.clean(objML_CokeSupplier.Remarks); //lblIsActive.Text = ML_Common.clean(objML_CokeSupplier.IsActive); //lblIsArchive.Text = ML_Common.clean(objML_CokeSupplier.IsArchive); //lblCreatedDate.Text = ML_Common.clean(objML_CokeSupplier.CreatedDate); //lblCreatedBy.Text = ML_Common.clean(objML_CokeSupplier.CreatedBy); //lblModifiedDate.Text = ML_Common.clean(objML_CokeSupplier.ModifiedDate); //lblModifiedBy.Text = ML_Common.clean(objML_CokeSupplier.ModifiedBy); //lblCreatedByUserNameId.Text = ML_Common.clean(objML_CokeSupplier.CreatedByUserNameId); } } } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } }