Пример #1
0
 public void SaveAuthJobRoleDetails(AuthJobRoleDetails argAuthJobRoleDetails, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsAuthJobRoleDetailsExists(argAuthJobRoleDetails.AuthJobRoleCode, argAuthJobRoleDetails.Module, argAuthJobRoleDetails.ClientCode, da) == false)
         {
             InsertAuthJobRoleDetails(argAuthJobRoleDetails, da, lstErr);
         }
         else
         {
             UpdateAuthJobRoleDetails(argAuthJobRoleDetails, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         objErrorHandler.Type       = ErrorConstant.strAboartType;
         objErrorHandler.MsgId      = 0;
         objErrorHandler.Module     = ErrorConstant.strInsertModule;
         objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
         objErrorHandler.Message    = ex.Message.ToString();
         objErrorHandler.RowNo      = 0;
         objErrorHandler.FieldName  = "";
         objErrorHandler.LogCode    = "";
         lstErr.Add(objErrorHandler);
     }
 }
Пример #2
0
        private AuthJobRoleDetails objCreateAuthJobRoleDetails(DataRow dr)
        {
            AuthJobRoleDetails tAuthJobRoleDetails = new AuthJobRoleDetails();

            tAuthJobRoleDetails.SetObjectInfo(dr);

            return(tAuthJobRoleDetails);
        }
Пример #3
0
        //public ICollection<ErrorHandler> SaveAuthJobRoleDetails(AuthJobRoleDetails argAuthJobRoleDetails)
        //{
        //    List<ErrorHandler> lstErr = new List<ErrorHandler>();
        //    DataAccess da = new DataAccess();
        //    try
        //    {
        //        if (blnIsAuthJobRoleDetailsExists(argAuthJobRoleDetails.AuthJobRoleCode, argAuthJobRoleDetails.Module, argAuthJobRoleDetails.ClientCode) == false)
        //        {

        //            da.Open_Connection();
        //            da.BEGIN_TRANSACTION();
        //            InsertAuthJobRoleDetails(argAuthJobRoleDetails, da, lstErr);
        //            foreach (ErrorHandler objerr in lstErr)
        //            {
        //                if (objerr.Type == "E")
        //                {
        //                    da.ROLLBACK_TRANSACTION();
        //                    return lstErr;
        //                }
        //            }
        //        }
        //        else
        //        {
        //            da.Open_Connection();
        //            da.BEGIN_TRANSACTION();
        //            UpdateAuthJobRoleDetails(argAuthJobRoleDetails, da, lstErr);
        //            foreach (ErrorHandler objerr in lstErr)
        //            {
        //                if (objerr.Type == "E")
        //                {
        //                    da.ROLLBACK_TRANSACTION();
        //                    return lstErr;
        //                }
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        if (da != null)
        //        {
        //            da.ROLLBACK_TRANSACTION();
        //        }
        //        objErrorHandler.Type = ErrorConstant.strAboartType;
        //        objErrorHandler.MsgId = 0;
        //        objErrorHandler.Module = ErrorConstant.strInsertModule;
        //        objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
        //        objErrorHandler.Message = ex.Message.ToString();
        //        objErrorHandler.RowNo = 0;
        //        objErrorHandler.FieldName = "";
        //        objErrorHandler.LogCode = "";
        //        lstErr.Add(objErrorHandler);
        //    }
        //    finally
        //    {
        //        if (da != null)
        //        {
        //            da.Close_Connection();
        //            da = null;
        //        }
        //    }
        //    return lstErr;
        //}


        public void InsertAuthJobRoleDetails(AuthJobRoleDetails argAuthJobRoleDetails, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[14];
            param[0]  = new SqlParameter("@AuthJobRoleCode", argAuthJobRoleDetails.AuthJobRoleCode);
            param[1]  = new SqlParameter("@ModuleType", argAuthJobRoleDetails.ModuleType);
            param[2]  = new SqlParameter("@Module", argAuthJobRoleDetails.Module);
            param[3]  = new SqlParameter("@CreateAllowed", argAuthJobRoleDetails.CreateAllowed);
            param[4]  = new SqlParameter("@ModifiedAllowed", argAuthJobRoleDetails.ModifiedAllowed);
            param[5]  = new SqlParameter("@DeleteAllowed", argAuthJobRoleDetails.DeleteAllowed);
            param[6]  = new SqlParameter("@PrintAllowed", argAuthJobRoleDetails.PrintAllowed);
            param[7]  = new SqlParameter("@DisplayAllowed", argAuthJobRoleDetails.DisplayAllowed);
            param[8]  = new SqlParameter("@ClientCode", argAuthJobRoleDetails.ClientCode);
            param[9]  = new SqlParameter("@CreatedBy", argAuthJobRoleDetails.CreatedBy);
            param[10] = new SqlParameter("@ModifiedBy", argAuthJobRoleDetails.ModifiedBy);

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

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

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

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


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


            objErrorHandler.Type        = strType;
            objErrorHandler.MsgId       = 0;
            objErrorHandler.Module      = ErrorConstant.strInsertModule;
            objErrorHandler.ModulePart  = ErrorConstant.strMasterModule;
            objErrorHandler.Message     = strMessage.ToString();
            objErrorHandler.RowNo       = 0;
            objErrorHandler.FieldName   = "";
            objErrorHandler.LogCode     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);
        }
Пример #4
0
        public AuthJobRoleDetails objGetAuthJobRoleDetails(string argAuthJobRoleCode, string argModule, string argClientCode)
        {
            AuthJobRoleDetails argAuthJobRoleDetails = new AuthJobRoleDetails();
            DataSet            DataSetToFill         = new DataSet();

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

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

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

            DataSetToFill = this.GetAuthJobRoleDetails(argAuthJobRoleCode, argModule, argClientCode);

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

            argAuthJobRoleDetails = this.objCreateAuthJobRoleDetails((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argAuthJobRoleDetails);
        }
Пример #5
0
        public ICollection <AuthJobRoleDetails> colGetAuthJobRoleDetails(string argAuthJobRoleCode, string argClientCode)
        {
            List <AuthJobRoleDetails> lst          = new List <AuthJobRoleDetails>();
            DataSet            DataSetToFill       = new DataSet();
            AuthJobRoleDetails tAuthJobRoleDetails = new AuthJobRoleDetails();

            DataSetToFill = this.GetAuthJobRoleDetails(argAuthJobRoleCode, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateAuthJobRoleDetails(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
Пример #6
0
        public ICollection <ErrorHandler> SaveAuthJobRoleMaster(AuthJobRoleMaster argAuthJobRoleMaster, DataTable dtAuthJobRoleDetail)
        {
            List <ErrorHandler> lstErr               = new List <ErrorHandler>();
            DataAccess          da                   = new DataAccess();
            string             strRetValue           = "";
            AuthJobRoleDetails objAuthJobRoleDetails = null;

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

                if (blnIsAuthJobRoleMasterExists(argAuthJobRoleMaster.AuthJobRoleCode, argAuthJobRoleMaster.ClientCode, da) == false)
                {
                    strRetValue = InsertAuthJobRoleMaster(argAuthJobRoleMaster, da, lstErr);
                }
                else
                {
                    strRetValue = UpdateAuthJobRoleMaster(argAuthJobRoleMaster, da, lstErr);
                }

                foreach (ErrorHandler objerr in lstErr)
                {
                    if (objerr.Type == "E")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }
                }

                if (strRetValue != "")
                {
                    foreach (DataRow dr in dtAuthJobRoleDetail.Rows)
                    {
                        objAuthJobRoleDetails = new AuthJobRoleDetails();

                        objAuthJobRoleDetails.AuthJobRoleCode = strRetValue;
                        objAuthJobRoleDetails.ModuleType      = Convert.ToString(dr["ModuleType"]);
                        objAuthJobRoleDetails.Module          = Convert.ToString(dr["Module"]);
                        objAuthJobRoleDetails.CreateAllowed   = Convert.ToInt32(dr["CreateAllowed"]);
                        objAuthJobRoleDetails.ModifiedAllowed = Convert.ToInt32(dr["ModifiedAllowed"]);
                        objAuthJobRoleDetails.DeleteAllowed   = Convert.ToInt32(dr["DeleteAllowed"]);
                        objAuthJobRoleDetails.DisplayAllowed  = Convert.ToInt32(dr["DisplayAllowed"]);
                        objAuthJobRoleDetails.PrintAllowed    = Convert.ToInt32(dr["PrintAllowed"]);
                        objAuthJobRoleDetails.ClientCode      = Convert.ToString(dr["ClientCode"]);
                        objAuthJobRoleDetails.IsDeleted       = Convert.ToInt32(dr["IsDeleted"]);
                        objAuthJobRoleDetails.CreatedBy       = Convert.ToString(dr["CreatedBy"]);
                        objAuthJobRoleDetails.ModifiedBy      = Convert.ToString(dr["ModifiedBy"]);

                        if (objAuthJobRoleDetails.IsDeleted == 0)
                        {
                            objAuthJobRoleDetailManager.SaveAuthJobRoleDetails(objAuthJobRoleDetails, da, lstErr);
                        }
                        else
                        {
                            objAuthJobRoleDetailManager.DeleteAuthJobRoleDetails(objAuthJobRoleDetails.AuthJobRoleCode, objAuthJobRoleDetails.Module, objAuthJobRoleDetails.ClientCode);
                        }
                    }

                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }



                da.COMMIT_TRANSACTION();
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }