Ejemplo n.º 1
0
        public ICollection <ErrorHandlerClass> SaveAllowanceMaster(AllowanceMaster objAllowanceMaster)
        {
            List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>();
            DataAccess da = new DataAccess();

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

                InsertAllowanceMaster(objAllowanceMaster, 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);
        }
Ejemplo n.º 2
0
        public string UpdateAllowanceMaster(AllowanceMaster argAllowanceMaster, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();
            SqlParameter[] param = new SqlParameter[6];
            param[0] = new SqlParameter("@AllowanceId", argAllowanceMaster.AllowanceId);
            param[1] = new SqlParameter("@Allowances", argAllowanceMaster.Allowances);
            param[2] = new SqlParameter("@ModifiedBy", argAllowanceMaster.ModifiedBy);



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

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

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



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

            string strMessage  = Convert.ToString(param[4].Value);
            string strType     = Convert.ToString(param[3].Value);
            string strRetValue = Convert.ToString(param[5].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(strRetValue);
        }