public DataTable GetCokeTypeByLoginName(string loginName) { DataTable dt = new DataTable(); try { objML_CokeType = new ML_CokeType(); 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_GetCokeTypeByLoginName.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); }
public int Update(ML_CokeType objML_CokeType) { int results = 0; try { SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output); ReturnObj.Direction = ParameterDirection.Output; SqlParameter[] parameters = { #region Update Properties new SqlParameter("@Id", objML_CokeType.Id), new SqlParameter("@CokeTypeId", objML_CokeType.CokeTypeId), new SqlParameter("@CokeType", objML_CokeType.CokeType), new SqlParameter("@Remarks", objML_CokeType.Remarks), new SqlParameter("@IsActive", objML_CokeType.IsActive), new SqlParameter("@IsArchive", objML_CokeType.IsArchive), //new SqlParameter("@CreatedDate", objML_CokeType.CreatedDate), //new SqlParameter("@CreatedBy", objML_CokeType.CreatedBy), //new SqlParameter("@ModifiedDate", objML_CokeType.ModifiedDate), new SqlParameter("@ModifiedBy", objML_CokeType.ModifiedBy), new SqlParameter("@CreatedByUserNameId", objML_CokeType.CreatedByUserNameId), ReturnObj #endregion }; this.Parameters = parameters; SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_UpdateCokeType.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); }
protected void grdCanteenMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("ADD")) { TextBox txtNewCanteenTypeName = (TextBox)grdCanteenMaster.FooterRow.FindControl("txtNewCanteenTypeName"); CheckBox txtNewRemarks = (CheckBox)grdCanteenMaster.FooterRow.FindControl("txtNewRemarks"); if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_CokeType = new ML_CokeType(); objML_CokeType.CokeType = ML_Common.clean(txtNewCanteenTypeName.Text); objML_CokeType.Remarks = ML_Common.clean(txtNewRemarks.Text); objML_CokeType.IsActive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeType.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeType.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeType.CreatedBy = Session["UserName"].ToString(); objML_CokeType.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeType.ModifiedBy = ML_Common.clean(string.Empty); int obhReturn = objBusinessClass.AddCokeType(objML_CokeType); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; FillGrid(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { // LogManager.LogManager.WriteErrorLog(sqlExc); SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex); } } } }
protected void grdCanteenMaster_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox txtCanteenTypeNameEdit = (TextBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtCanteenTypeNameEdit"); //TextBox txtRemarksEdit = (TextBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtRemarksEdit"); CheckBox txtRemarksEdit = (CheckBox)grdCanteenMaster.Rows[e.RowIndex].FindControl("txtRemarksEdit"); if (IsValid) { //errNumber = -1; BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = ML_Common.string2int(grdCanteenMaster.DataKeys[e.RowIndex].Values[0].ToString()); ML_CokeType objML_CokeType = objBusinessClass.GetCokeTypeById(lngId); try { if (objML_CokeType != null) { objML_CokeType.CokeType = ML_Common.clean(txtCanteenTypeNameEdit.Text); objML_CokeType.Remarks = ML_Common.clean(txtRemarksEdit.Text); int obhReturn = objBusinessClass.UpdateCokeType(objML_CokeType); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Update Successfully"; } else if (obhReturn == 2) { lblMsg.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } grdCanteenMaster.EditIndex = -1; FillGrid(); } } catch (SqlException sqlExc) { SqlException sqlEt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } } }
public ML_CokeType GetCokeTypeByCokeTypeId(int CokeTypeId) { DataTable dt = new DataTable(); try { objML_CokeType = new ML_CokeType(); SqlParameter[] parameters = { #region Get Properties new SqlParameter("@CokeTypeId", CokeTypeId) #endregion }; this.Parameters = parameters; SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeTypeByCokeTypeId.ToString(), this.Parameters); if (sdr.HasRows) { dt.Load(sdr); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; objML_CokeType.Id = ML_Common.string2int32(ML_Common.clean(dr["Id"].ToString())); objML_CokeType.CokeTypeId = ML_Common.string2int32(ML_Common.clean(dr["CokeTypeId"].ToString())); objML_CokeType.CokeType = ML_Common.clean(dr["CokeType"].ToString()); objML_CokeType.Remarks = ML_Common.clean(dr["Remarks"].ToString()); objML_CokeType.IsActive = ML_Common.clean(dr["IsActive"].ToString()); objML_CokeType.IsArchive = ML_Common.clean(dr["IsArchive"].ToString()); objML_CokeType.CreatedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString())); objML_CokeType.CreatedBy = ML_Common.clean(dr["CreatedBy"].ToString()); objML_CokeType.ModifiedDate = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString())); objML_CokeType.ModifiedBy = ML_Common.clean(dr["ModifiedBy"].ToString()); objML_CokeType.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_CokeType); }
public DataTable GetCokeTypeBySeacrh(ML_CokeType objML_CokeType) { DataTable dt = new DataTable(); try { DateTime?dtFromdate = null; DateTime objFromdate; if (DateTime.TryParse(objML_CokeType.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_CokeType.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_CokeType.Id), //new SqlParameter("@CokeTypeId", objML_CokeType.CokeTypeId), new SqlParameter("@CokeType", objML_CokeType.CokeType), //new SqlParameter("@Remarks", objML_CokeType.Remarks), //new SqlParameter("@IsActive", objML_CokeType.IsActive), //new SqlParameter("@IsArchive", objML_CokeType.IsArchive), //new SqlParameter("@CreatedDate", objML_CokeType.CreatedDate), //new SqlParameter("@CreatedBy", objML_CokeType.CreatedBy), //new SqlParameter("@ModifiedDate", objML_CokeType.ModifiedDate), //new SqlParameter("@ModifiedBy", objML_CokeType.ModifiedBy), //new SqlParameter("@CreatedByUserNameId", objML_CokeType.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_GetCokeTypeBySearch.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); }