Exemplo n.º 1
0
        public string DeleteHolidayMaster(HolidayMaster argHolidayMaster, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();
            SqlParameter[] param = new SqlParameter[5];
            param[0]           = new SqlParameter("@HolidaysId", argHolidayMaster.HolidaysId);
            param[1]           = new SqlParameter("@ModifiedBy", argHolidayMaster.ModifiedBy);
            param[2]           = new SqlParameter("@Type", SqlDbType.Char);
            param[2].Size      = 1;
            param[2].Direction = ParameterDirection.Output;

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

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

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

            string strMessage  = Convert.ToString(param[3].Value);
            string strType     = Convert.ToString(param[2].Value);
            string strRetValue = Convert.ToString(param[4].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);
        }
Exemplo n.º 2
0
        public string UpdateHolidayMaster(HolidayMaster argHolidayMaster, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();
            SqlParameter[] param = new SqlParameter[13];
            param[0] = new SqlParameter("@HolidaysId", argHolidayMaster.HolidaysId);
            param[1] = new SqlParameter("@HoliDays", argHolidayMaster.HoliDays);
            param[2] = new SqlParameter("@FinancialYear", argHolidayMaster.FinancialYear);
            param[3] = new SqlParameter("@EnglishMonth", argHolidayMaster.EnglishMonth);
            param[4] = new SqlParameter("@EnglishDate", argHolidayMaster.EnglishDate);
            param[5] = new SqlParameter("@SakaMonth", argHolidayMaster.SakaMonth);
            param[6] = new SqlParameter("@SakaDate", argHolidayMaster.SakaDate);
            param[7] = new SqlParameter("@HoliDays_Day", argHolidayMaster.HoliDays_Day);
            param[8] = new SqlParameter("@Holidays_Type", argHolidayMaster.Holidays_Type);
            param[9] = new SqlParameter("@ModifiedBy", argHolidayMaster.ModifiedBy);



            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;



            int i = da.NExecuteNonQuery("Proc_UpdateHolidayMaster", 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(strRetValue);
        }
Exemplo n.º 3
0
        public ICollection <ErrorHandlerClass> SaveHolidayMaster(HolidayMaster objHolidayMaster)
        {
            List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>();
            DataAccess da = new DataAccess();

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

                InsertHolidayMaster(objHolidayMaster, 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);
        }