Пример #1
0
        private PayLeavesDC FillObject(IDataReader reader)
        {
            PayLeavesDC objPayDesignation = null;

            if (reader != null && reader.Read())
            {
                objPayDesignation         = new PayLeavesDC();
                objPayDesignation.EmpCode = reader["EmpCode"].ToString();
                objPayDesignation.Date    = reader["Date"] == DBNull.Value ? null : (DateTime?)reader["Date"];
                objPayDesignation.Remarks = reader["Remarks"].ToString();
                objPayDesignation.From    = reader["From"] == DBNull.Value ? null : (DateTime?)reader["From"];
                objPayDesignation.To      = reader["To"] == DBNull.Value ? null : (DateTime?)reader["To"];
                objPayDesignation.Days    = Convert.ToInt16(reader["Days"]);
                objPayDesignation.Type    = reader["Type"].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"];


                reader.Close();
                reader.Dispose();
            }
            return(objPayDesignation);
        }
Пример #2
0
        public PayLeavesDC LoadByPrimaryKey(DBConnection Connection, string Code)
        {
            PayLeavesDC   objPayDesignation = new PayLeavesDC();
            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);
        }
Пример #3
0
        private PayLeavesDC FillObject(DataRow row)
        {
            PayLeavesDC objPayDesignation = null;

            objPayDesignation         = new PayLeavesDC();
            objPayDesignation.ID      = Convert.ToInt32(row["ID"]);
            objPayDesignation.EmpCode = row["EmpCode"].ToString();
            objPayDesignation.Date    = row["Date"] == DBNull.Value ? null : (DateTime?)row["Date"];
            objPayDesignation.Remarks = row["Remarks"].ToString();
            objPayDesignation.From    = row["From"] == DBNull.Value ? null : (DateTime?)row["From"];
            objPayDesignation.To      = row["To"] == DBNull.Value ? null : (DateTime?)row["To"];
            objPayDesignation.Days    = Convert.ToInt16(row["Days"]);
            objPayDesignation.Type    = row["Type"].ToString();
            // objPayDesignation.Description = reader["Description"].ToString();
            //objPayDesignation.SortOrder = reader["SortOrder"] == DBNull.Value ? null : (int?)reader["SortOrder"];

            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);
        }
Пример #4
0
        private PayLeavesDC FillObjectEmployee(DataRow row)

        {
            PayLeavesDC objPayDesignation = null;

            objPayDesignation = new PayLeavesDC();

            objPayDesignation.EmpCode = row["EmpCode"].ToString();

            objPayDesignation.Name = row["Name"].ToString();

            return(objPayDesignation);
        }
Пример #5
0
        private int Update(DBConnection Connection, PayLeavesDC objPayDesignation)
        {
            int updateCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_PayLeavesUpdate");

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

            dbCommandWrapper.AddInParameter("p_ID", DbType.String, objPayDesignation.ID);
            dbCommandWrapper.AddInParameter("p_EmpCode", DbType.String, objPayDesignation.EmpCode);
            dbCommandWrapper.AddInParameter("p_Date", DbType.DateTime, objPayDesignation.Date);
            dbCommandWrapper.AddInParameter("p_Remarks", DbType.String, objPayDesignation.Remarks);
            dbCommandWrapper.AddInParameter("p_From", DbType.DateTime, objPayDesignation.From);
            dbCommandWrapper.AddInParameter("p_To", DbType.DateTime, objPayDesignation.To);
            dbCommandWrapper.AddInParameter("p_Days", DbType.Int16, objPayDesignation.Days);
            dbCommandWrapper.AddInParameter("p_Type", DbType.String, objPayDesignation.Type);

            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);
        }
        public IHttpActionResult Delete([FromBody] PayLeavesDC objUsers)
        {
            PayLeavesBL        objUser      = new PayLeavesBL();
            List <EXCEPTIONDC> lstException = new List <EXCEPTIONDC>();
            List <PayLeavesDC> list         = new List <PayLeavesDC>();

            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));
            }
        }
Пример #7
0
        public PayLeavesDC LoadByPrimaryKey(string Code)
        {
            DBConnection objConnection  = new DBConnection();
            PayLeavesDA  objPayLeavesDA = new PayLeavesDA();
            PayLeavesDC  objPayLeavesDC = null;

            try
            {
                objConnection.Open(false);
                objPayLeavesDC = objPayLeavesDA.LoadByPrimaryKey(objConnection, Code);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objConnection.Close();
            }
            return(objPayLeavesDC);
        }
Пример #8
0
        private int Delete(DBConnection Connection, PayLeavesDC objPayDesignation)
        {
            int deleteCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_PayLeavesDelete");

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

            dbCommandWrapper.AddInParameter("p_ID", DbType.String, objPayDesignation.ID);

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

            return(deleteCount);
        }
        public IHttpActionResult postShifts([FromBody] PayLeavesDC payDepartment)
        {
            //List<EXCEPTIONDC> lstException = new List<EXCEPTIONDC>();
            try
            {
                var bl = new PayLeavesBL();

                PayLeavesBL objUser = new PayLeavesBL();
                PayLeavesDC oldObj  = new PayLeavesDC();
                //get Object before saving
                //oldObj = objUser.LoadByPrimaryKey(PayLeavesDC.Code);

                List <PayLeavesDC> list = new List <PayLeavesDC>();
                list.Add(payDepartment);
                int UpdatedCount = 0;
                if (payDepartment.ID != null && payDepartment.ID > 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);
            }
        }