Exemplo n.º 1
0
        private PayDepartmentDC FillObject(DataRow row)
        {
            PayDepartmentDC objPayDesignation = null;

            objPayDesignation             = new PayDepartmentDC();
            objPayDesignation.Code        = row["Code"].ToString();
            objPayDesignation.Name        = row["Name"].ToString();
            objPayDesignation.Description = row["Description"].ToString();
            if (row["Status"] != DBNull.Value)
            {
                objPayDesignation.Status = Convert.ToBoolean(row["Status"]);
            }
            if (row["IsSync"] != DBNull.Value)
            {
                objPayDesignation.IsSync = Convert.ToBoolean(row["IsSync"]);
            }
            objPayDesignation.RowState  = row["RowState"] == DBNull.Value ? null : Convert.ToString(row["RowState"]);
            objPayDesignation.AddOn     = row["AddOn"] == DBNull.Value ? null : (DateTime?)row["AddOn"];
            objPayDesignation.AddBy     = Convert.ToString(row["AddBy"]);
            objPayDesignation.EditOn    = row["EditOn"] == DBNull.Value ? null : (DateTime?)row["EditOn"];
            objPayDesignation.EditBy    = Convert.ToString(row["EditBy"]);
            objPayDesignation.SyncDate  = row["SyncDate"] == DBNull.Value ? null : (DateTime?)row["SyncDate"];
            objPayDesignation.CompanyID = row["CompanyID"] == DBNull.Value ? null : (int?)row["CompanyID"];

            return(objPayDesignation);
        }
Exemplo n.º 2
0
        public PayDepartmentDC LoadByPrimaryKey(DBConnection Connection, string Code)
        {
            PayDepartmentDC objPayDesignation = new PayDepartmentDC();
            StringBuilder   sql = new StringBuilder();

            sql.Append("proc_PayDesignationsLoadByPrimaryKey");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);

            dbCommandWrapper.AddInParameter("p_Code", DbType.String, Code);


            IDataReader reader = null;

            if (Connection.Transaction != null)
            {
                reader = Connection.dataBase.ExecuteReader(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                reader = Connection.dataBase.ExecuteReader(dbCommandWrapper.DBCommand);
            }

            objPayDesignation = FillObject(reader);
            return(objPayDesignation);
        }
Exemplo n.º 3
0
        private PayDepartmentDC FillObject(IDataReader reader)
        {
            PayDepartmentDC objPayDesignation = null;

            if (reader != null && reader.Read())
            {
                objPayDesignation             = new PayDepartmentDC();
                objPayDesignation.Code        = reader["Code"].ToString();
                objPayDesignation.Name        = reader["Name"].ToString();
                objPayDesignation.Description = reader["Description"].ToString();
                //objPayDesignation.SortOrder = reader["SortOrder"] == DBNull.Value ? null : (int?)reader["SortOrder"];
                objPayDesignation.IsSync    = Convert.ToBoolean(reader["IsSync"]);
                objPayDesignation.RowState  = Convert.ToString(reader["RowState"]);
                objPayDesignation.AddOn     = reader["AddOn"] == DBNull.Value ? null : (DateTime?)reader["AddOn"];
                objPayDesignation.AddBy     = Convert.ToString(reader["AddBy"]);
                objPayDesignation.EditOn    = reader["EditOn"] == DBNull.Value ? null : (DateTime?)reader["EditOn"];
                objPayDesignation.EditBy    = Convert.ToString(reader["EditBy"]);
                objPayDesignation.SyncDate  = reader["SyncDate"] == DBNull.Value ? null : (DateTime?)reader["SyncDate"];
                objPayDesignation.CompanyID = reader["CompanyID"] == DBNull.Value ? null : (int?)reader["CompanyID"];

                reader.Close();
                reader.Dispose();
            }
            return(objPayDesignation);
        }
Exemplo n.º 4
0
        public IHttpActionResult Delete([FromBody] PayDepartmentDC objUsers)
        {
            PayDepartmentBL        objUser      = new PayDepartmentBL();
            List <EXCEPTIONDC>     lstException = new List <EXCEPTIONDC>();
            List <PayDepartmentDC> list         = new List <PayDepartmentDC>();

            list.Add(objUsers);
            try
            {
                int IsDeleted = objUser.Delete(list);
                return(Ok(IsDeleted));
            }
            catch (Exception ex)
            {
                return(new TextResult(lstException, Request, "Following PayDesignations cannot be deleted as: ", "All the other records deleted successfully.", true));
            }
        }
Exemplo n.º 5
0
        private int Update(DBConnection Connection, PayDepartmentDC objPayDesignation)
        {
            int updateCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_PayDepartmentsUpdate");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);


            dbCommandWrapper.AddInParameter("p_Code", DbType.String, objPayDesignation.Code);
            dbCommandWrapper.AddInParameter("p_Name", DbType.String, objPayDesignation.Name);
            dbCommandWrapper.AddInParameter("p_Description", DbType.String, objPayDesignation.Description);
            dbCommandWrapper.AddInParameter("p_Status", DbType.String, objPayDesignation.Status);
            dbCommandWrapper.AddInParameter("p_IsSync", DbType.Boolean, objPayDesignation.IsSync);
            dbCommandWrapper.AddInParameter("p_RowState", DbType.String, objPayDesignation.RowState);
            dbCommandWrapper.AddInParameter("p_AddOn", DbType.DateTime, objPayDesignation.AddOn);
            dbCommandWrapper.AddInParameter("p_AddBy", DbType.String, objPayDesignation.AddBy);
            dbCommandWrapper.AddInParameter("p_EditOn", DbType.DateTime, objPayDesignation.EditOn);
            dbCommandWrapper.AddInParameter("p_EditBy", DbType.String, objPayDesignation.EditBy);
            dbCommandWrapper.AddInParameter("p_SyncDate", DbType.DateTime, objPayDesignation.SyncDate);
            dbCommandWrapper.AddInParameter("p_CompanyID", DbType.Int32, objPayDesignation.CompanyID);


            if (Connection.Transaction != null)
            {
                updateCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                updateCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand);
            }

            if (updateCount == 0)
            {
                objPayDesignation.IsDirty = IsDirty = true;
            }

            return(updateCount);
        }
Exemplo n.º 6
0
        public PayDepartmentDC LoadByPrimaryKey(string Code)
        {
            DBConnection    objConnection      = new DBConnection();
            PayDepartmentDA objPayDepartmentDA = new PayDepartmentDA();
            PayDepartmentDC objPayDepartmentDC = null;

            try
            {
                objConnection.Open(false);
                objPayDepartmentDC = objPayDepartmentDA.LoadByPrimaryKey(objConnection, Code);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objConnection.Close();
            }
            return(objPayDepartmentDC);
        }
Exemplo n.º 7
0
        private int Delete(DBConnection Connection, PayDepartmentDC objPayDesignation)
        {
            int deleteCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_PayDepartmentDelete");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);

            dbCommandWrapper.AddInParameter("p_Code", DbType.String, objPayDesignation.Code);

            if (Connection.Transaction != null)
            {
                deleteCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                deleteCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand);
            }

            return(deleteCount);
        }
Exemplo n.º 8
0
        public IHttpActionResult postDepartment([FromBody] PayDepartmentDC payDepartment)
        {
            //List<EXCEPTIONDC> lstException = new List<EXCEPTIONDC>();
            try
            {
                var bl = new PayDepartmentBL();

                PayDepartmentBL objUser = new PayDepartmentBL();
                PayDepartmentDC oldObj  = new PayDepartmentDC();
                //get Object before saving
                //oldObj = objUser.LoadByPrimaryKey(PayDepartmentDC.Code);

                List <PayDepartmentDC> list = new List <PayDepartmentDC>();
                list.Add(payDepartment);
                int UpdatedCount = 0;
                if (payDepartment.Code != null && payDepartment.Code.Length > 0)
                {
                    UpdatedCount = bl.Update(list);
                }
                else
                {
                    UpdatedCount = bl.Insert(list);
                }

                if (UpdatedCount > 0)
                {
                    return(Ok(true));
                }
                return(Ok(false));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
                //return new TextResult(lstException, Request);
            }
        }