示例#1
0
        public DAILYDC LoadByPrimaryKey(DBConnection Connection, int DAILY_ID)
        {
            DAILYDC       objDAIL = new DAILYDC();
            StringBuilder sql     = new StringBuilder();

            sql.Append("proc_DAILYLoadByPrimaryKey");

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

            dbCommandWrapper.AddInParameter("p_DAILY_ID", DbType.Int32, DAILY_ID);


            DataSet ds = new DataSet();

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

            objDAIL = (Utility.ConvertToObject <DAILYDC>(ds.Tables[0]));
            return(objDAIL);
        }
示例#2
0
        private DAILYDC FillObject(IDataReader reader)
        {
            DAILYDC objDAIL = null;

            if (reader != null && reader.Read())
            {
                objDAIL                   = new DAILYDC();
                objDAIL.DAILY_ID          = (int)reader["DAILY_ID"];
                objDAIL.PROJECT_ID        = reader["PROJECT_ID"] == DBNull.Value ? null : (int?)reader["PROJECT_ID"];
                objDAIL.JOB_ID            = reader["JOB_ID"] == DBNull.Value ? null : (int?)reader["JOB_ID"];
                objDAIL.DAILY_TYPE        = (int)reader["DAILY_TYPE"];
                objDAIL.DAILY_DATE        = (DateTime)reader["DAILY_DATE"];
                objDAIL.DAY_OF_WEEK       = reader["DAY_OF_WEEK"] == DBNull.Value ? null : (String)reader["DAY_OF_WEEK"];
                objDAIL.DAILY_DAYS        = (int)reader["DAILY_DAYS"];
                objDAIL.STATUS            = (int)reader["STATUS"];
                objDAIL.SHIFT             = (int)reader["SHIFT"];
                objDAIL.WORK_ORDER_NUMBER = reader["WORK_ORDER_NUMBER"] == DBNull.Value ? null : (String)reader["WORK_ORDER_NUMBER"];
                objDAIL.DAILY_TYPE_NOTES  = reader["DAILY_TYPE_NOTES"] == DBNull.Value ? null : (String)reader["DAILY_TYPE_NOTES"];
                objDAIL.CREATED_ON        = (DateTime)reader["CREATED_ON"];
                objDAIL.CREATED_BY        = (int)reader["CREATED_BY"];
                objDAIL.MODIFIED_ON       = (DateTime)reader["MODIFIED_ON"];
                objDAIL.MODIFIED_BY       = (int)reader["MODIFIED_BY"];
                objDAIL.LOCK_COUNTER      = (int)reader["LOCK_COUNTER"];

                reader.Close();
                reader.Dispose();
            }
            return(objDAIL);
        }
示例#3
0
        private void InsertMaterials(DBConnection objConnection, DAILYDC objDAILYDC, List <MATERIALDC> listMATERIALDC, ref bool exceptionFound)
        {
            MATERIALBL materialBL = new MATERIALBL();

            foreach (MATERIALDC materialDC in listMATERIALDC)
            {
                try
                {
                    materialDC.DAILY_ID     = objDAILYDC.DAILY_ID;
                    materialDC.LOCK_COUNTER = 0;
                    materialDC.CREATED_ON   = objDAILYDC.MODIFIED_ON;
                    materialDC.MODIFIED_ON  = materialDC.CREATED_ON;
                    materialDC.CREATED_BY   = objDAILYDC.MODIFIED_BY;
                    materialDC.MODIFIED_BY  = objDAILYDC.MODIFIED_BY;
                    materialBL.Insert(objConnection, materialDC);
                }
                catch (Exception mvException)
                {
                    exceptionFound = true;
                    materialDC.POST_MESSAGEDC.Type = "EXCEPTION";
                    if (mvException.Message.Contains("CONCURRENCY_ERROR"))
                    {
                        materialDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                        materialDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                    }
                    else
                    {
                        materialDC.POST_MESSAGEDC.Message    = mvException.Message;
                        materialDC.POST_MESSAGEDC.StackTrace = mvException.StackTrace;
                    }
                }
            }
        }
示例#4
0
        public void SendDailyEmail(HttpRequestMessage request, DAILYDC dailyDC, bool isNewDaily)
        {
            int       sentStatus   = 0;
            MESSAGEBL objMessageBL = new MESSAGEBL();

            try
            {
                MESSAGEDC objMessage = new MESSAGEDC();
                objMessage.FROM       = ConfigurationManager.AppSettings["AdminEmail"];
                objMessage.RECIPIENTS = new EMAIL_GROUPSBL().GetEmailsAgainstClient(dailyDC.CLIENT_PM);
                if (String.IsNullOrEmpty(objMessage.FROM))
                {
                    throw new Exception("Daily email cann't be sent.</br>Daily's Admin email address is not configured. Please contact your administrator.");
                }
                if (String.IsNullOrEmpty(objMessage.RECIPIENTS))
                {
                    throw new Exception("Daily email cann't be sent.</br>Daily's To email address is not configured. Please contact your administrator.");
                }

                if (String.IsNullOrEmpty(ConfigurationManager.AppSettings["SMTPAddress"]))
                {
                    throw new Exception("Your password cannot be reset.</br>SMTP address is not configured.");
                }
                string subjectPrefix = isNewDaily ? "New" : "Update";
                dailyDC.HYLAN_PROJECT_ID = dailyDC.HYLAN_PROJECT_ID == null ? "Unknown" : dailyDC.HYLAN_PROJECT_ID;
                dailyDC.JOB_FILE_NUMBER  = dailyDC.JOB_FILE_NUMBER == null ? "Unknown" : dailyDC.JOB_FILE_NUMBER;
                objMessage.SUBJECT       = subjectPrefix + " Daily Submitted " + dailyDC.HYLAN_PROJECT_ID + "_" + dailyDC.JOB_FILE_NUMBER;


                string msgBody   = "<!DOCTYPE HTML><html><body><table cellspacing='0' cellpadding='0'>";
                string col1Style = " style='font-weight: bold;background-color: #f2f2f2;padding-left:10px;padding-right:10px;' ";
                string col2Style = " style='padding-left: 10px;' ";
                string rowStyle  = " style='height:25px;' ";
                msgBody += "<tr " + rowStyle + " ><td " + col1Style + " >Submitted by: </td><td " + col2Style + " > " + dailyDC.MODIFIED_BY_NAME + "<td></tr>";  //new to change need to display the name
                msgBody += "<tr " + rowStyle + " ><td " + col1Style + ">Date/Time: </td><td " + col2Style + " > " + dailyDC.MODIFIED_ON.ToString("MM/dd/yyyy HH:mm") + "<td></tr>";
                //msgBody += "<tr><td colspan = 2 >" + dailyDC.DAILY_TYPE_NAME + "<td></tr>";
                msgBody += "<tr " + rowStyle + " ><td " + col1Style + ">Daily Type: </td><td " + col2Style + " > " + dailyDC.DAILY_TYPE_NAME + "<td></tr>";
                msgBody += "<tr " + rowStyle + " ><td " + col1Style + ">Day: </td><td " + col2Style + " > " + dailyDC.DAILY_DAYS + "<td></tr>";
                msgBody += "<tr " + rowStyle + " ><td " + col1Style + ">Status: </td><td " + col2Style + " > " + dailyDC.DAILY_STATUS_NAME + "<td></tr>";
                msgBody += "<tr " + rowStyle + " ><td " + col1Style + ">Work Date: </td><td " + col2Style + " > " + dailyDC.DAILY_DATE.ToString("MM/dd/yyyy") + "<td></tr>";

                msgBody            += "</table></body></html>";
                objMessage.CONTENTS = msgBody;
                sentStatus          = objMessageBL.SendSMTPEmail(objMessage);
                if (sentStatus != 1)
                {
                    throw new Exception("Daily email cann't be sent.due to some error. Please contact your administrator.");
                }
            }
            catch (Exception exp)
            {
                int userID = Common.Utility.GetUserID(request);
                Util.Utility.InsertIntoErrorLog(exp.Message, exp.StackTrace, userID);
            }
        }
        public IHttpActionResult GetByID(int dailyid)
        {
            DAILYBL dailyBL   = new DAILYBL();
            DAILYDC objResult = new DAILYDC();

            if (dailyid > 0)
            {
                objResult = dailyBL.LoadByPrimaryKey(dailyid);
            }
            return(Ok(new { objResult }));
        }
        public int Update(DBConnection Connection, DAILYDC objDAILY_UNKNOW)
        {
            int updateCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_DAILY_UNKNOWNUpdate");

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

            dbCommandWrapper.AddInParameter("p_DU_DAILY_ID", DbType.Int32, objDAILY_UNKNOW.DU_DAILY_ID);
            dbCommandWrapper.AddInParameter("p_DAILY_ID", DbType.Int32, objDAILY_UNKNOW.DAILY_ID);
            dbCommandWrapper.AddInParameter("p_NODE_ID1", DbType.String, objDAILY_UNKNOW.NODE_ID1);
            dbCommandWrapper.AddInParameter("p_NODE_ID2", DbType.String, objDAILY_UNKNOW.NODE_ID2);
            dbCommandWrapper.AddInParameter("p_NODE_ID3", DbType.String, objDAILY_UNKNOW.NODE_ID3);
            dbCommandWrapper.AddInParameter("p_HUB", DbType.String, objDAILY_UNKNOW.HUB);
            dbCommandWrapper.AddInParameter("p_HYLAN_PM", DbType.Int32, objDAILY_UNKNOW.HYLAN_PM);
            dbCommandWrapper.AddInParameter("p_STREET_ADDRESS", DbType.String, objDAILY_UNKNOW.STREET_ADDRESS);
            dbCommandWrapper.AddInParameter("p_CITY", DbType.String, objDAILY_UNKNOW.CITY);
            dbCommandWrapper.AddInParameter("p_STATE", DbType.String, objDAILY_UNKNOW.STATE);
            dbCommandWrapper.AddInParameter("p_ZIP", DbType.String, objDAILY_UNKNOW.ZIP);
            dbCommandWrapper.AddInParameter("p_LAT", DbType.String, objDAILY_UNKNOW.LAT);
            dbCommandWrapper.AddInParameter("p_LONG", DbType.String, objDAILY_UNKNOW.LONG);
            dbCommandWrapper.AddInParameter("p_POLE_LOCATION", DbType.String, objDAILY_UNKNOW.POLE_LOCATION);
            dbCommandWrapper.AddInParameter("p_CLIENT_PM", DbType.String, objDAILY_UNKNOW.CLIENT_PM);
            dbCommandWrapper.AddInParameter("p_UNKNOWN_STATUS", DbType.Int32, objDAILY_UNKNOW.STATUS);
            dbCommandWrapper.AddInParameter("p_CREATED_ON", DbType.DateTime, objDAILY_UNKNOW.CREATED_ON);
            dbCommandWrapper.AddInParameter("p_CREATED_BY", DbType.Int32, objDAILY_UNKNOW.CREATED_BY);
            dbCommandWrapper.AddInParameter("p_MODIFIED_ON", DbType.DateTime, objDAILY_UNKNOW.MODIFIED_ON);
            dbCommandWrapper.AddInParameter("p_MODIFIED_BY", DbType.Int32, objDAILY_UNKNOW.MODIFIED_BY);
            dbCommandWrapper.AddInParameter("p_LOCK_COUNTER", DbType.Int32, objDAILY_UNKNOW.LOCK_COUNTER);


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

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

            return(updateCount);
        }
示例#7
0
        public int Update(DBConnection Connection, DAILYDC objDAIL)
        {
            int updateCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_DAILYUpdate");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);
            int?projId = (objDAIL.PROJECT_ID == -1) ? null : objDAIL.PROJECT_ID;
            int?jobId  = (objDAIL.JOB_ID == -1) ? null : objDAIL.JOB_ID;

            dbCommandWrapper.AddInParameter("p_DAILY_ID", DbType.Int32, objDAIL.DAILY_ID);
            dbCommandWrapper.AddInParameter("p_PROJECT_ID", DbType.Int32, projId);
            dbCommandWrapper.AddInParameter("p_JOB_ID", DbType.Int32, jobId);
            dbCommandWrapper.AddInParameter("p_DAILY_TYPE", DbType.Int32, objDAIL.DAILY_TYPE);
            dbCommandWrapper.AddInParameter("p_DAILY_DATE", DbType.DateTime, objDAIL.DAILY_DATE);
            dbCommandWrapper.AddInParameter("p_DAY_OF_WEEK", DbType.String, objDAIL.DAY_OF_WEEK);
            dbCommandWrapper.AddInParameter("p_DAILY_DAYS", DbType.Int32, objDAIL.DAILY_DAYS);
            dbCommandWrapper.AddInParameter("p_STATUS", DbType.Int32, objDAIL.STATUS);
            dbCommandWrapper.AddInParameter("p_SHIFT", DbType.Int32, objDAIL.SHIFT);
            dbCommandWrapper.AddInParameter("p_WORK_ORDER_NUMBER", DbType.String, objDAIL.WORK_ORDER_NUMBER);
            dbCommandWrapper.AddInParameter("p_DAILY_TYPE_NOTES", DbType.String, objDAIL.DAILY_TYPE_NOTES);
            dbCommandWrapper.AddInParameter("p_QUICK_NOTES", DbType.String, objDAIL.QUICK_NOTES);
            dbCommandWrapper.AddInParameter("p_CREATED_ON", DbType.DateTime, objDAIL.CREATED_ON);
            dbCommandWrapper.AddInParameter("p_CREATED_BY", DbType.Int32, objDAIL.CREATED_BY);
            dbCommandWrapper.AddInParameter("p_MODIFIED_ON", DbType.DateTime, objDAIL.MODIFIED_ON);
            dbCommandWrapper.AddInParameter("p_MODIFIED_BY", DbType.Int32, objDAIL.MODIFIED_BY);
            dbCommandWrapper.AddInParameter("p_LOCK_COUNTER", DbType.Int32, objDAIL.LOCK_COUNTER);
            dbCommandWrapper.AddInParameter("p_TRACK_REVENUE", DbType.Decimal, objDAIL.TRACK_REVENUE);


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

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

            return(updateCount);
        }
示例#8
0
        public DAILYDC LoadByPrimaryKey(int DAILY_ID)
        {
            DBConnection objConnection = new DBConnection();
            DAILYDA      objDAILDA     = new DAILYDA();
            DAILYDC      objDAILDC     = null;

            try
            {
                objConnection.Open(false);
                objDAILDC = objDAILDA.LoadByPrimaryKey(objConnection, DAILY_ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objConnection.Close();
            }
            return(objDAILDC);
        }
        public IHttpActionResult SendDailyEmail(int dailyID, bool isNewDaily)
        {
            try
            {
                if (dailyID < 0)
                {
                    throw new Exception("Wrong Daily ID i.e." + dailyID);
                }
                DAILYDC daily   = null;
                DAILYBL dailyBL = new DAILYBL();


                daily = dailyBL.LoadByPrimaryKey(dailyID);
                dailyBL.SendDailyEmail(Request, daily, isNewDaily);

                return(Ok(1));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#10
0
        private int Delete(DBConnection Connection, DAILYDC objDAIL)
        {
            int deleteCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_DAILYDelete");

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

            dbCommandWrapper.AddInParameter("p_DAILY_ID", DbType.Int32, objDAIL.DAILY_ID);

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

            return(deleteCount);
        }
示例#11
0
        private DAILYDC FillObject(DataRow row)
        {
            DAILYDC objDAIL = null;

            objDAIL                   = new DAILYDC();
            objDAIL.DAILY_ID          = (int)row["DAILY_ID"];
            objDAIL.PROJECT_ID        = row["PROJECT_ID"] == DBNull.Value ? null : (int?)row["PROJECT_ID"];
            objDAIL.JOB_ID            = row["JOB_ID"] == DBNull.Value ? null : (int?)row["JOB_ID"];
            objDAIL.DAILY_TYPE        = (int)row["DAILY_TYPE"];
            objDAIL.DAILY_DATE        = (DateTime)row["DAILY_DATE"];
            objDAIL.DAY_OF_WEEK       = row["DAY_OF_WEEK"] == DBNull.Value ? null : (String)row["DAY_OF_WEEK"];
            objDAIL.DAILY_DAYS        = (int)row["DAILY_DAYS"];
            objDAIL.STATUS            = (int)row["STATUS"];
            objDAIL.SHIFT             = (int)row["SHIFT"];
            objDAIL.WORK_ORDER_NUMBER = row["WORK_ORDER_NUMBER"] == DBNull.Value ? null : (String)row["WORK_ORDER_NUMBER"];
            objDAIL.DAILY_TYPE_NOTES  = row["DAILY_TYPE_NOTES"] == DBNull.Value ? null : (String)row["DAILY_TYPE_NOTES"];
            objDAIL.CREATED_ON        = (DateTime)row["CREATED_ON"];
            objDAIL.CREATED_BY        = (int)row["CREATED_BY"];
            objDAIL.MODIFIED_ON       = (DateTime)row["MODIFIED_ON"];
            objDAIL.MODIFIED_BY       = (int)row["MODIFIED_BY"];
            objDAIL.LOCK_COUNTER      = (int)row["LOCK_COUNTER"];

            return(objDAIL);
        }
示例#12
0
        public DailyDTO Insert(DailyDTO dailyDTO)
        {
            DAILYDC      objDAILYDC     = dailyDTO.DAILYDC;
            int          p_DAILY_ID     = 0;
            DBConnection objConnection  = new DBConnection();
            DAILYDA      objDAILDA      = new DAILYDA();
            bool         exceptionFound = true;

            try
            {
                objConnection.Open(true);
                DateTime currentDateTime = DateTime.Now;
                objDAILYDC.CREATED_ON   = currentDateTime;
                objDAILYDC.MODIFIED_ON  = objDAILYDC.CREATED_ON;
                objDAILYDC.LOCK_COUNTER = 0;
                p_DAILY_ID = objDAILDA.Insert(objConnection, objDAILYDC);

                if (p_DAILY_ID != 0)
                {
                    objDAILYDC.DAILY_ID = p_DAILY_ID;
                    exceptionFound      = false;
                    #region Unknown Daily - Insert
                    try
                    {
                        if (objDAILYDC.PROJECT_ID == null || objDAILYDC.JOB_ID == null || objDAILYDC.PROJECT_ID == -1 || objDAILYDC.PROJECT_ID == -1)
                        {
                            DAILY_UNKNOWNDA unknownDailyDA = new DAILY_UNKNOWNDA();
                            objDAILYDC.DAILY_ID     = p_DAILY_ID;
                            objDAILYDC.LOCK_COUNTER = 0;
                            unknownDailyDA.Insert(objConnection, objDAILYDC);
                        }
                    }
                    catch (Exception unkDailyException)
                    {
                        exceptionFound = true;
                        dailyDTO.DAILYDC.POST_MESSAGEDC.Type = "EXCEPTION";
                        if (unkDailyException.Message.Contains("CONCURRENCY_ERROR"))
                        {
                            dailyDTO.DAILYDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                            dailyDTO.DAILYDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                        }
                        else
                        {
                            dailyDTO.DAILYDC.POST_MESSAGEDC.Message    = unkDailyException.Message;
                            dailyDTO.DAILYDC.POST_MESSAGEDC.StackTrace = unkDailyException.StackTrace;
                        }
                    }
                    #endregion

                    #region ManPower - Insert
                    MAN_POWERBL manPowerBL = new MAN_POWERBL();
                    foreach (MAN_POWERDC mpDC in dailyDTO.listMAN_POWERDC)
                    {
                        try {
                            mpDC.DAILY_ID     = objDAILYDC.DAILY_ID;
                            mpDC.LOCK_COUNTER = 0;

                            mpDC.CREATED_ON  = objDAILYDC.MODIFIED_ON;
                            mpDC.MODIFIED_ON = mpDC.CREATED_ON;
                            mpDC.CREATED_BY  = objDAILYDC.MODIFIED_BY;
                            mpDC.MODIFIED_BY = objDAILYDC.MODIFIED_BY;
                            manPowerBL.Insert(objConnection, mpDC);
                        }
                        catch (Exception mpException)
                        {
                            exceptionFound           = true;
                            mpDC.POST_MESSAGEDC.Type = "EXCEPTION";
                            if (mpException.Message.Contains("CONCURRENCY_ERROR"))
                            {
                                mpDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                                mpDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                            }
                            else
                            {
                                mpDC.POST_MESSAGEDC.Message    = mpException.Message;
                                mpDC.POST_MESSAGEDC.StackTrace = mpException.StackTrace;
                            }
                        }
                    }
                    #endregion

                    #region Vehicles - Insert
                    VEHICLEBL vehicleBL = new VEHICLEBL();
                    foreach (VEHICLEDC vehicleDC in dailyDTO.listVEHICLEDC)
                    {
                        try {
                            vehicleDC.DAILY_ID     = objDAILYDC.DAILY_ID;
                            vehicleDC.LOCK_COUNTER = 0;
                            vehicleDC.CREATED_ON   = objDAILYDC.MODIFIED_ON;
                            vehicleDC.MODIFIED_ON  = vehicleDC.CREATED_ON;
                            vehicleDC.CREATED_BY   = objDAILYDC.MODIFIED_BY;
                            vehicleDC.MODIFIED_BY  = objDAILYDC.MODIFIED_BY;
                            vehicleBL.Insert(objConnection, vehicleDC);
                        }
                        catch (Exception vvException)
                        {
                            exceptionFound = true;
                            vehicleDC.POST_MESSAGEDC.Type = "EXCEPTION";
                            if (vvException.Message.Contains("CONCURRENCY_ERROR"))
                            {
                                vehicleDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                                vehicleDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                            }
                            else
                            {
                                vehicleDC.POST_MESSAGEDC.Message    = vvException.Message;
                                vehicleDC.POST_MESSAGEDC.StackTrace = vvException.StackTrace;
                            }
                        }
                    }
                    #endregion

                    #region Labor - Insert
                    LABORBL laborBL = new LABORBL();
                    foreach (LABORDC laborDC in dailyDTO.listLABORDC)
                    {
                        try
                        {
                            laborDC.DAILY_ID     = objDAILYDC.DAILY_ID;
                            laborDC.LOCK_COUNTER = 0;
                            laborDC.CREATED_ON   = objDAILYDC.MODIFIED_ON;
                            laborDC.MODIFIED_ON  = laborDC.CREATED_ON;
                            laborDC.CREATED_BY   = objDAILYDC.MODIFIED_BY;
                            laborDC.MODIFIED_BY  = objDAILYDC.MODIFIED_BY;
                            laborBL.Insert(objConnection, laborDC);
                        }
                        catch (Exception lbrException)
                        {
                            exceptionFound = true;
                            laborDC.POST_MESSAGEDC.Type = "EXCEPTION";
                            if (lbrException.Message.Contains("CONCURRENCY_ERROR"))
                            {
                                laborDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                                laborDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                            }
                            else
                            {
                                laborDC.POST_MESSAGEDC.Message    = lbrException.Message;
                                laborDC.POST_MESSAGEDC.StackTrace = lbrException.StackTrace;
                            }
                        }
                    }
                    #endregion

                    #region Material - Insert
                    InsertMaterials(objConnection, objDAILYDC, dailyDTO.listMATERIALDC, ref exceptionFound);
                    #endregion

                    #region Labor Item - Insert
                    InsertMaterials(objConnection, objDAILYDC, dailyDTO.listLaborItemDC, ref exceptionFound);
                    #endregion

                    #region Aerial - Insert
                    InsertMaterials(objConnection, objDAILYDC, dailyDTO.listAerialDC, ref exceptionFound);
                    #endregion

                    #region MDU - Insert
                    InsertMaterials(objConnection, objDAILYDC, dailyDTO.listMDUDC, ref exceptionFound);
                    #endregion

                    #region Work Detail - Insert
                    WORK_DETAILBL workDetailBL = new WORK_DETAILBL();
                    foreach (WORK_DETAILDC workDetailDC in dailyDTO.listWORK_DETAILDC)
                    {
                        try
                        {
                            workDetailDC.DAILY_ID     = objDAILYDC.DAILY_ID;
                            workDetailDC.LOCK_COUNTER = 0;
                            workDetailDC.CREATED_ON   = objDAILYDC.MODIFIED_ON;
                            workDetailDC.MODIFIED_ON  = workDetailDC.CREATED_ON;
                            workDetailDC.CREATED_BY   = objDAILYDC.MODIFIED_BY;
                            workDetailDC.MODIFIED_BY  = objDAILYDC.MODIFIED_BY;
                            workDetailBL.Insert(objConnection, workDetailDC);
                        }
                        catch (Exception wvException)
                        {
                            exceptionFound = true;
                            workDetailDC.POST_MESSAGEDC.Type = "EXCEPTION";
                            if (wvException.Message.Contains("CONCURRENCY_ERROR"))
                            {
                                workDetailDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                                workDetailDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                            }
                            else
                            {
                                workDetailDC.POST_MESSAGEDC.Message    = wvException.Message;
                                workDetailDC.POST_MESSAGEDC.StackTrace = wvException.StackTrace;
                            }
                        }
                    }
                    #endregion
                }
            }
            catch (Exception exception)
            {
                exceptionFound = true;
                dailyDTO.DAILYDC.POST_MESSAGEDC.Type = "EXCEPTION";
                if (exception.Message.Contains("CONCURRENCY_ERROR"))
                {
                    dailyDTO.DAILYDC.POST_MESSAGEDC.Type    = "CONCURRENCY_ERROR";
                    dailyDTO.DAILYDC.POST_MESSAGEDC.Message = "CONCURRENCY_ERROR";
                }
                else
                {
                    dailyDTO.DAILYDC.POST_MESSAGEDC.Message    = exception.Message;
                    dailyDTO.DAILYDC.POST_MESSAGEDC.StackTrace = exception.StackTrace;
                }
            }
            finally
            {
                if (exceptionFound)
                {
                    dailyDTO.DAILYDC.TRANSACTION_SUCCESS = false;
                    objConnection.Rollback();
                }
                else
                {
                    dailyDTO.DAILYDC.TRANSACTION_SUCCESS = true;
                    dailyDTO.DAILYDC.DAILY_ID            = p_DAILY_ID;
                    objConnection.Commit();
                }
                objConnection.Close();
            }
            return(dailyDTO);
        }