Beispiel #1
0
        public MonthlyAttendanceRegister objGetMonthlyAttendanceRegister(string EmployeeId, string AttendanceId)
        {
            MonthlyAttendanceRegister argMonthlyAttendanceRegister = new MonthlyAttendanceRegister();
            DataSet DataSetToFill = new DataSet();

            if (EmployeeId.ToString().Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetMonthlyAttendanceRegister4ID(EmployeeId.ToString().Trim(), AttendanceId);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argMonthlyAttendanceRegister = this.objCreteMonthlyAttendanceRegister((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;

            return(argMonthlyAttendanceRegister);
        }
Beispiel #2
0
        private MonthlyAttendanceRegister objCreteMonthlyAttendanceRegister(DataRow dr)
        {
            MonthlyAttendanceRegister tMonthlyAttendanceRegister = new MonthlyAttendanceRegister();

            tMonthlyAttendanceRegister.SetObjectInfo(dr);

            return(tMonthlyAttendanceRegister);
        }
Beispiel #3
0
        public void InsertMonthlyAttendanceRegister(MonthlyAttendanceRegister argMonthlyAttendanceRegister, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();

            SqlParameter[] param = new SqlParameter[15];
            param[0] = new SqlParameter("@EmployeeId", argMonthlyAttendanceRegister.EmployeeId);
            param[1] = new SqlParameter("@AttendanceDate", argMonthlyAttendanceRegister.AttendanceDate);
            param[2] = new SqlParameter("@MarkInTime", argMonthlyAttendanceRegister.MarkInTime);
            param[3] = new SqlParameter("@UpdatedMarkInTime", argMonthlyAttendanceRegister.UpdatedMarkInTime);
            param[4] = new SqlParameter("@MarkOutTime", argMonthlyAttendanceRegister.MarkOutTime);
            param[5] = new SqlParameter("@UpdatedMarkOutTime", argMonthlyAttendanceRegister.UpdatedMarkOutTime);
            param[6] = new SqlParameter("@Status", argMonthlyAttendanceRegister.Status);

            param[7]  = new SqlParameter("@CreatedBy", argMonthlyAttendanceRegister.CreatedBy);
            param[8]  = new SqlParameter("@ModifiedBy", argMonthlyAttendanceRegister.ModifiedBy);
            param[9]  = new SqlParameter("@Remarks", argMonthlyAttendanceRegister.Remarks);
            param[10] = new SqlParameter("@Month", argMonthlyAttendanceRegister.Month);
            param[11] = new SqlParameter("@Year", argMonthlyAttendanceRegister.Year);

            param[12]           = new SqlParameter("@Type", SqlDbType.Char);
            param[12].Size      = 1;
            param[12].Direction = ParameterDirection.Output;

            param[13]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[13].Size      = 255;
            param[13].Direction = ParameterDirection.Output;

            param[14]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[14].Size      = 20;
            param[14].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_InsertMonthlyAttendanceRegister", param);

            string strMessage  = Convert.ToString(param[13].Value);
            string strType     = Convert.ToString(param[12].Value);
            string strRetValue = Convert.ToString(param[14].Value);

            objErrorHandlerClass.Type        = strType;
            objErrorHandlerClass.MsgId       = 0;
            objErrorHandlerClass.Message     = strMessage.ToString();
            objErrorHandlerClass.RowNo       = 0;
            objErrorHandlerClass.FieldName   = "";
            objErrorHandlerClass.LogCode     = "";
            objErrorHandlerClass.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandlerClass);
            //return i;
        }
Beispiel #4
0
        public ICollection <ErrorHandlerClass> SaveMonthlyAttendanceRegister(MonthlyAttendanceRegister objMonthlyAttendanceRegister)
        {
            List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>();
            DataAccess da = new DataAccess();

            try
            {
                da.Open_Connection();
                da.BEGIN_TRANSACTION();

                if (blnIsMonthlyAttendanceRegisterExist(objMonthlyAttendanceRegister.EmployeeId, objMonthlyAttendanceRegister.AttendanceDate) == false)
                {
                    InsertMonthlyAttendanceRegister(objMonthlyAttendanceRegister, da, lstErr);

                    foreach (ErrorHandlerClass objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    UpdateMonthlyAttendanceRegister(objMonthlyAttendanceRegister, da, lstErr);

                    foreach (ErrorHandlerClass objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandlerClass.Type      = ErrorConstant.strAboartType;
                objErrorHandlerClass.MsgId     = 0;
                objErrorHandlerClass.Message   = ex.Message.ToString();
                objErrorHandlerClass.RowNo     = 0;
                objErrorHandlerClass.FieldName = "";
                objErrorHandlerClass.LogCode   = "";
                lstErr.Add(objErrorHandlerClass);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }