Exemplo n.º 1
0
        public EmployeeEarningDetails objGetEmployeeEarningDetails(string EmployeeId)
        {
            EmployeeEarningDetails argEmployeeEarningDetails = new EmployeeEarningDetails();
            DataSet DataSetToFill = new DataSet();

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

            DataSetToFill = this.GetEmployeeEarningDetails4ID(EmployeeId.ToString().Trim());

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

            argEmployeeEarningDetails = this.objCreteEmployeeEarningDetails((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;

            return(argEmployeeEarningDetails);
        }
Exemplo n.º 2
0
        private EmployeeEarningDetails objCreteEmployeeEarningDetails(DataRow dr)
        {
            EmployeeEarningDetails tEmployeeEarningDetails = new EmployeeEarningDetails();

            tEmployeeEarningDetails.SetObjectInfo(dr);

            return(tEmployeeEarningDetails);
        }
Exemplo n.º 3
0
        public void InsertEmployeeEarningDetails(EmployeeEarningDetails argEmployeeEarningDetails, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();

            SqlParameter[] param = new SqlParameter[14];
            param[0] = new SqlParameter("@EmployeeId", argEmployeeEarningDetails.EmployeeId);
            param[1] = new SqlParameter("@Allowances", argEmployeeEarningDetails.Allowances);
            param[2] = new SqlParameter("@Amount", argEmployeeEarningDetails.Amount);
            param[3] = new SqlParameter("@CalcOn", argEmployeeEarningDetails.CalcOn);
            param[4] = new SqlParameter("@PaymentMode", argEmployeeEarningDetails.PaymentMode);
            param[5] = new SqlParameter("@Bonus", argEmployeeEarningDetails.Bonus);
            param[6] = new SqlParameter("@OT", argEmployeeEarningDetails.OT);

            param[7] = new SqlParameter("@CreatedBy", argEmployeeEarningDetails.CreatedBy);
            param[8] = new SqlParameter("@ModifiedBy", argEmployeeEarningDetails.ModifiedBy);
            param[9] = new SqlParameter("@ItemNo", argEmployeeEarningDetails.ItemNo);

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

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

            param[12]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[12].Size      = 20;
            param[12].Direction = ParameterDirection.Output;
            param[13]           = new SqlParameter("@EmployeeEarningId", argEmployeeEarningDetails.EmployeeEarningId);
            int i = da.NExecuteNonQuery("Proc_InsertEmployeeEarningDetails", param);

            string strMessage  = Convert.ToString(param[11].Value);
            string strType     = Convert.ToString(param[10].Value);
            string strRetValue = Convert.ToString(param[12].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;
        }
Exemplo n.º 4
0
 public void SaveEmployeeEarningDetails(EmployeeEarningDetails objEmployeeEarningDetails, ref DataAccess da, ref List <ErrorHandlerClass> lstErr)
 {
     try
     {
         if (blnIsEmployeeEarningDetailsExist(objEmployeeEarningDetails.EmployeeId, objEmployeeEarningDetails.ItemNo) == false)
         {
             InsertEmployeeEarningDetails(objEmployeeEarningDetails, da, lstErr);
         }
         else
         {
             UpdateEmployeeEarningDetails(objEmployeeEarningDetails, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
        public ICollection <ErrorHandlerClass> SaveEmployeeEarningDetails(EmployeeEarningDetails objEmployeeEarningDetails)
        {
            List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>();
            DataAccess da = new DataAccess();

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

                if (blnIsEmployeeEarningDetailsExist(objEmployeeEarningDetails.EmployeeId, objEmployeeEarningDetails.ItemNo) == false)
                {
                    InsertEmployeeEarningDetails(objEmployeeEarningDetails, da, lstErr);

                    foreach (ErrorHandlerClass objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    UpdateEmployeeEarningDetails(objEmployeeEarningDetails, 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);
        }