public int Update(ML_CanteenMaster objML_CanteenMaster)
        {
            int results = 0;

            try
            {
                sbTraceInformation = new StringBuilder();
                sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:Update(ML_CanteenMaster");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Update Properties
                    new SqlParameter("@CanteenCode",    objML_CanteenMaster.CanteenCode),
                    new SqlParameter("@CanteenName",    objML_CanteenMaster.CanteenName),
                    new SqlParameter("@CanteenAddress", objML_CanteenMaster.CanteenAddress),
                    new SqlParameter("@CanteenActive",  objML_CanteenMaster.CanteenActive),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_UpdateCanteenMaster.ToString(), this.Parameters);

                sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:Update(ML_CanteenMaster");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                if (ReturnObj.Value != null)
                {
                    results = ML_Common.string2int32(ReturnObj.Value.ToString());
                }
            }
            catch (SqlException sqlExc)
            {
                int errNumber = int.MinValue;
                //LogManager.LogManager.WriteErrorLog(sqlExc);
                foreach (SqlError error in sqlExc.Errors)
                {
                    errNumber = error.Number;
                }
                if (errNumber == 50000)
                {
                    results = 999;
                    throw;
                }
            }
            catch (Exception ex)
            {
                results = 0;
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString());
            }
            return(results);
        }
Beispiel #2
0
        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);
        }
        public DataTable GetUserTypeByLoginName(string loginName)
        {
            DataTable dt = new DataTable();

            try
            {
                objML_UserType = new ML_UserType();
                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_GetUserTypeByLoginName.ToString(), this.Parameters);

                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(dt);
        }
        public DataSet GetCanteenMasterByLoginName(string loginName)
        {
            DataSet ds = null;

            try
            {
                sbTraceInformation = new StringBuilder();
                sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:GetCanteenMasterByLoginName(string loginName)");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                objML_CanteenMaster = new ML_CanteenMaster();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@loginName", loginName)
                    #endregion
                };

                this.Parameters = parameters;
                ds = SqlHelper.ExecuteDataset(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCanteenMasterByLoginName.ToString(), this.Parameters);

                sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:GetCanteenMasterByLoginName(string loginName)");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);
            }
            catch (Exception ex)
            {
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString());
            }
            return(ds);
        }
Beispiel #5
0
        public DataTable GetCokeSupplier()
        {
            DataTable dt = new DataTable();

            try
            {
                SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeSupplier.ToString());


                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 DataTable GetUserTypeBySeacrh(ML_UserType objML_UserType)
        {
            DataTable dt = new DataTable();

            try
            {
                DateTime?dtFromdate = null;
                DateTime objFromdate;
                if (DateTime.TryParse(objML_UserType.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_UserType.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_UserType.Id),
                    new SqlParameter("@UserTypeId", objML_UserType.UserTypeId),
                    new SqlParameter("@UserType",   objML_UserType.UserType),
                    //new SqlParameter("@IsActive", objML_UserType.IsActive),
                    //new SqlParameter("@IsArchive", objML_UserType.IsArchive),
                    //new SqlParameter("@CreatedDate", objML_UserType.CreatedDate),
                    //new SqlParameter("@CreatedBy", objML_UserType.CreatedBy),
                    //new SqlParameter("@ModifiedDate", objML_UserType.ModifiedDate),
                    //new SqlParameter("@ModifiedBy", objML_UserType.ModifiedBy),
                    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_GetUserTypeBySearch.ToString(), this.Parameters);

                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(dt);
        }
        public DataSet GetCokeType()
        {
            DataSet ds = null;

            try
            {
                //sbTraceInformation = new StringBuilder();
                //sbTraceInformation.Append("Entered:-Inside BusinessClasses-DailyLogs:GetDailyLogs");
                //sbTraceInformation.Remove(0, sbTraceInformation.Length);
                ds = SqlHelper.ExecuteDataset(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCokeType.ToString());

                //sbTraceInformation.Append("Exit:-From BusinessClasses-DailyLogs:GetDailyLogs");
                //sbTraceInformation.Remove(0, sbTraceInformation.Length);
            }
            catch (Exception ex)
            {
                ds = new DataSet();
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(
            }
            return(ds);
        }
        public DataSet GetCanteenMasterBySeacrh(ML_CanteenMaster objML_CanteenMaster)
        {
            DataSet ds = null;

            try
            {
                sbTraceInformation = new StringBuilder();
                sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:GetCanteenMasterBySeacrh(ML_CanteenMaster objML_CanteenMaster");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                DateTime?dtFromdate = null;
                DateTime objFromdate;
                if (DateTime.TryParse(objML_CanteenMaster.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_CanteenMaster.ToDate.ToString(), out objdtTodate))
                {
                    if (objdtTodate.ToString() != "1/1/1900 12:00:00 AM")
                    {
                        dtTodate = objdtTodate;
                    }
                }

                SqlParameter[] parameters =
                {
                    #region Search Properties
                    new SqlParameter("@CanteenCode",    objML_CanteenMaster.CanteenCode),
                    new SqlParameter("@CanteenName",    objML_CanteenMaster.CanteenName),
                    new SqlParameter("@CanteenAddress", objML_CanteenMaster.CanteenAddress),
                    new SqlParameter("@CanteenActive",  objML_CanteenMaster.CanteenActive),
                    new SqlParameter("@FromDate",       dtFromdate),
                    new SqlParameter("@ToDate",         dtTodate)
                    #endregion
                };
                this.Parameters = parameters;
                ds = SqlHelper.ExecuteDataset(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCanteenMasterBySearch.ToString(), this.Parameters);
                sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:GetCanteenMasterBySeacrh(ML_CanteenMaster objML_CanteenMaster");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);
            }
            catch (Exception ex)
            {
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString());
            }
            return(ds);
        }
        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);
        }
        public int Add(ML_UserType objML_UserType)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Add Properties
                    //new SqlParameter("@Id", objML_UserType.Id),
                    //new SqlParameter("@UserTypeId", objML_UserType.UserTypeId),
                    new SqlParameter("@UserType",            objML_UserType.UserType),
                    new SqlParameter("@IsActive",            objML_UserType.IsActive),
                    new SqlParameter("@IsArchive",           objML_UserType.IsArchive),
                    //new SqlParameter("@CreatedDate", objML_UserType.CreatedDate),
                    new SqlParameter("@CreatedBy",           objML_UserType.CreatedBy),
                    new SqlParameter("@CreatedByUserNameId", objML_UserType.CreatedByUserNameId),
                    //new SqlParameter("@ModifiedDate", objML_UserType.ModifiedDate),
                    //new SqlParameter("@ModifiedBy", objML_UserType.ModifiedBy),
                    ReturnObj
                    #endregion
                };
                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_SaveUserType.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 exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(results);
        }
        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 ML_UserType GetUserTypeByUserType(string UserType)
        {
            DataTable dt = new DataTable();

            try
            {
                objML_UserType = new ML_UserType();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@UserType", UserType)
                    #endregion
                };

                this.Parameters = parameters;
                SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetUserTypeByUserType.ToString(), this.Parameters);



                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        objML_UserType.Id                  = ML_Common.string2Int32(ML_Common.clean(dr["Id"].ToString()));
                        objML_UserType.UserTypeId          = ML_Common.string2Int32(ML_Common.clean(dr["UserTypeId"].ToString()));
                        objML_UserType.UserType            = ML_Common.clean(dr["UserType"].ToString());
                        objML_UserType.IsActive            = ML_Common.clean(dr["IsActive"].ToString());
                        objML_UserType.IsArchive           = ML_Common.clean(dr["IsArchive"].ToString());
                        objML_UserType.CreatedDate         = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["CreatedDate"].ToString()));
                        objML_UserType.CreatedBy           = ML_Common.clean(dr["CreatedBy"].ToString());
                        objML_UserType.ModifiedDate        = ML_Common.ToDateTimeSafe(ML_Common.clean(dr["ModifiedDate"].ToString()));
                        objML_UserType.ModifiedBy          = ML_Common.clean(dr["ModifiedBy"].ToString());
                        objML_UserType.CreatedByUserNameId = ML_Common.string2Int32(dr["CreatedByUserNameId"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(objML_UserType);
        }
        public ML_CanteenMaster GetCanteenMasterByCanteenActive(long CanteenActive)
        {
            try
            {
                sbTraceInformation = new StringBuilder();
                sbTraceInformation.Append("Entered:-Inside BusinessClasses-CanteenMaster:GetCanteenMasterById(long Id)");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                objML_CanteenMaster = new ML_CanteenMaster();
                SqlParameter[] parameters =
                {
                    #region Get Properties
                    new SqlParameter("@CanteenActive", CanteenActive)
                    #endregion
                };

                this.Parameters = parameters;
                DataSet ds = SqlHelper.ExecuteDataset(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetCanteenMasterByCanteenActive.ToString(), this.Parameters);

                sbTraceInformation.Append("Exit:-From BusinessClasses-CanteenMaster:GetCanteenMasterById(long Id)");
                sbTraceInformation.Remove(0, sbTraceInformation.Length);

                if (ds.Tables.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        objML_CanteenMaster.CanteenCode    = ML_Common.string2int32(ML_Common.clean(dr["CanteenCode"].ToString()));
                        objML_CanteenMaster.CanteenName    = ML_Common.clean(dr["CanteenName"].ToString());
                        objML_CanteenMaster.CanteenAddress = ML_Common.clean(dr["CanteenAddress"].ToString());
                        objML_CanteenMaster.CanteenActive  = ML_Common.string2int32(ML_Common.clean(dr["CanteenActive"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;// Exception exc=ex;// LogManager.LogManager.WriteErrorLog(ex);
                throw;
            }
            finally
            {
                //LogManager.LogManager.WriteTraceLog(sbTraceInformation.ToString());
            }
            return(objML_CanteenMaster);
        }
        public int DeleteUserTypeByUserType(string UserType)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Delete Properties
                    new SqlParameter("@UserType", UserType),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_DeleteUserTypeByUserType.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 exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(results);
        }
Beispiel #15
0
        public int DeleteCokeSupplierByCokeSupplierId(int CokeSupplierId)
        {
            int results = 0;

            try
            {
                SqlParameter ReturnObj = new SqlParameter("@ReturnObj", ParameterDirection.Output);
                ReturnObj.Direction = ParameterDirection.Output;
                SqlParameter[] parameters =
                {
                    #region Delete Properties
                    new SqlParameter("@CokeSupplierId", CokeSupplierId),
                    ReturnObj
                    #endregion
                };

                this.Parameters = parameters;
                SqlHelper.ExecuteNonQuery(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_DeleteCokeSupplierByCokeSupplierId.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 GetUserType()
        {
            DataTable dt = new DataTable();

            try
            {
                SqlDataReader sdr = SqlHelper.ExecuteReader(ML_Connection.CreateConnection().ToString(), CommandType.StoredProcedure, StoredProcedure.Name.usp_GetUserType.ToString());

                if (sdr.HasRows)
                {
                    dt.Load(sdr);
                }
            }
            catch (Exception ex)
            {
                Exception exx = ex;
                throw;
            }
            finally
            {
                //
            }
            return(dt);
        }
Beispiel #17
0
        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);
        }
Beispiel #18
0
        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);
        }
Beispiel #19
0
        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);
        }