public void SaveAuthORGRoleDetails(AuthORGRoleDetails argAuthORGRoleDetails, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsAuthORGRoleDetailsExists(argAuthORGRoleDetails.AuthOrgcode, argAuthORGRoleDetails.SerialNo, argAuthORGRoleDetails.FieldName, argAuthORGRoleDetails.ClientCode, da) == false)
         {
             InsertAuthORGRoleDetails(argAuthORGRoleDetails, da, lstErr);
         }
         else
         {
             UpdateAuthORGRoleDetails(argAuthORGRoleDetails, 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);
     }
 }
        private AuthORGRoleDetails objCreateAuthORGRoleDetails(DataRow dr)
        {
            AuthORGRoleDetails tAuthORGRoleDetails = new AuthORGRoleDetails();

            tAuthORGRoleDetails.SetObjectInfo(dr);

            return(tAuthORGRoleDetails);
        }
        public void UpdateAuthORGRoleDetails(AuthORGRoleDetails argAuthORGRoleDetails, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[11];
            param[0] = new SqlParameter("@AuthOrgcode", argAuthORGRoleDetails.AuthOrgcode);
            param[1] = new SqlParameter("@SerialNo", argAuthORGRoleDetails.SerialNo);
            param[2] = new SqlParameter("@FieldName", argAuthORGRoleDetails.FieldName);
            param[3] = new SqlParameter("@FieldValueFrom", argAuthORGRoleDetails.FieldValueFrom);
            param[4] = new SqlParameter("@FieldValueTo", argAuthORGRoleDetails.FieldValueTo);
            param[5] = new SqlParameter("@ClientCode", argAuthORGRoleDetails.ClientCode);
            param[6] = new SqlParameter("@CreatedBy", argAuthORGRoleDetails.CreatedBy);
            param[7] = new SqlParameter("@ModifiedBy", argAuthORGRoleDetails.ModifiedBy);

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

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

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


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

            string strMessage  = Convert.ToString(param[9].Value);
            string strType     = Convert.ToString(param[8].Value);
            string strRetValue = Convert.ToString(param[10].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);
        }
        public AuthORGRoleDetails objGetAuthORGRoleDetails(string argAuthOrgcode, int ISerialNo, string argFieldName, string argClientCode)
        {
            AuthORGRoleDetails argAuthORGRoleDetails = new AuthORGRoleDetails();
            DataSet            DataSetToFill         = new DataSet();

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

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

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

            DataSetToFill = this.GetAuthORGRoleDetails(argAuthOrgcode, ISerialNo, argFieldName, argClientCode);

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

            argAuthORGRoleDetails = this.objCreateAuthORGRoleDetails((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argAuthORGRoleDetails);
        }
        public ICollection <AuthORGRoleDetails> colGetAuthORGRoleDetails(string argAuthOrgcode, string argClientCode)
        {
            List <AuthORGRoleDetails> lst          = new List <AuthORGRoleDetails>();
            DataSet            DataSetToFill       = new DataSet();
            AuthORGRoleDetails tAuthORGRoleDetails = new AuthORGRoleDetails();

            DataSetToFill = this.GetAuthORGRoleDetails(argAuthOrgcode, argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveAuthOrgRoleMaster(AuthOrgRoleMaster argAuthOrgRoleMaster, DataTable dtAuthORGRoleDetails)
        {
            List <ErrorHandler> lstErr              = new List <ErrorHandler>();
            DataAccess          da                  = new DataAccess();
            string             strRetValue          = "";
            AuthORGRoleDetails objAuthORGRoleDetail = null;

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

                if (blnIsAuthOrgRoleMasterExists(argAuthOrgRoleMaster.AuthOrgcode, argAuthOrgRoleMaster.ClientCode, da) == false)
                {
                    strRetValue = InsertAuthOrgRoleMaster(argAuthOrgRoleMaster, da, lstErr);
                }
                else
                {
                    strRetValue = UpdateAuthOrgRoleMaster(argAuthOrgRoleMaster, da, lstErr);
                }

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

                if (dtAuthORGRoleDetails.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtAuthORGRoleDetails.Rows)
                    {
                        objAuthORGRoleDetail                = new AuthORGRoleDetails();
                        objAuthORGRoleDetail.AuthOrgcode    = strRetValue;
                        objAuthORGRoleDetail.SerialNo       = Convert.ToInt32(dr["SerialNo"]);
                        objAuthORGRoleDetail.FieldName      = Convert.ToString(dr["FieldName"]);
                        objAuthORGRoleDetail.FieldValueFrom = Convert.ToString(dr["FieldValueFrom"]);
                        objAuthORGRoleDetail.FieldValueTo   = Convert.ToString(dr["FieldValueTo"]);
                        objAuthORGRoleDetail.IsDeleted      = Convert.ToInt32(dr["IsDeleted"]);
                        objAuthORGRoleDetail.ClientCode     = Convert.ToString(dr["ClientCode"]);
                        objAuthORGRoleDetail.CreatedBy      = Convert.ToString(dr["CreatedBy"]);
                        objAuthORGRoleDetail.ModifiedBy     = Convert.ToString(dr["ModifiedBy"]);

                        if (objAuthORGRoleDetail.IsDeleted == 0)
                        {
                            ObjAuthOrgroleDetailManager.SaveAuthORGRoleDetails(objAuthORGRoleDetail, da, lstErr);
                        }
                        else
                        {
                            ObjAuthOrgroleDetailManager.DeleteAuthORGRoleDetails(objAuthORGRoleDetail.AuthOrgcode, objAuthORGRoleDetail.FieldName, objAuthORGRoleDetail.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);
        }