Ejemplo n.º 1
0
        public string DeletePostMaster(PostMaster argPostMaster, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();
            SqlParameter[] param = new SqlParameter[5];
            param[0]           = new SqlParameter("@PostId", argPostMaster.PostId);
            param[1]           = new SqlParameter("@ModifiedBy", argPostMaster.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_DeletePostMaster", 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);
        }
Ejemplo n.º 2
0
        public ICollection <ErrorHandlerClass> SavePostMaster(PostMaster objPostMaster)
        {
            List <ErrorHandlerClass> lstErr = new List <ErrorHandlerClass>();
            DataAccess da = new DataAccess();

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

                InsertPostMaster(objPostMaster, 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.º 3
0
        public void InsertPostMaster(PostMaster argPostMaster, DataAccess da, List <ErrorHandlerClass> lstErr)
        {
            da.Open_Connection();

            SqlParameter[] param = new SqlParameter[10];
            param[0] = new SqlParameter("@PostId", argPostMaster.PostId);
            param[1] = new SqlParameter("@PostName", argPostMaster.PostName);
            param[2] = new SqlParameter("@AdvertisementId", argPostMaster.AdvertisementId);
            param[3] = new SqlParameter("@CreatedBy", argPostMaster.CreatedBy);



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

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

            param[6]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[6].Size      = 20;
            param[6].Direction = ParameterDirection.Output;
            param[7]           = new SqlParameter("@PostDescription", argPostMaster.PostDescription);
            param[8]           = new SqlParameter("@MinAge", argPostMaster.MinAge);
            param[9]           = new SqlParameter("@MaxAge", argPostMaster.MaxAge);


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

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