Exemplo n.º 1
0
        /// <summary>
        /// Calls Request Distributor stored procedure to process XML request
        /// </summary>
        /// <param name="Da">Data access adaptor</param>
        /// <param name="ModuleName">Module Name</param>
        /// <param name="Action">Action</param>
        /// <param name="Message">XML Message</param>
        /// <returns>XML</returns>
        public static string CallRequestDistributor(DataAccessProxy Da, string FunctionCode, string Message)
        {
            TraceOutput.EnterModule("CallRequestDistributor: ");
            try
            {
                //Composing XML message
                XmlDocument xml = new XmlDocument();
                XmlNode root = xml.CreateElement("Request");
                XmlAttribute functionCode = xml.CreateAttribute("FunctionCode");
                functionCode.Value = FunctionCode;
                root.Attributes.Append(functionCode);
                //Append message
                root.InnerXml = Message;

                //Finalize xml
                xml.AppendChild(root);

                //Sending out message
                string[] para = new string[1];
                para[0] = XmlHelper.XmlToString(xml);
                string[,] outputXml;
                CallStoredProcedure(Da, SP_SCOTIA_REQUEST_DISTRIBUTOR, para ,out outputXml);
                TraceOutput.Information(outputXml.Length.ToString());

                return outputXml[1,1];
            }
            catch (Exception ex)
            {
                TraceOutput.Error(ex.Message);
            }
            TraceOutput.ExitModule("CallStoredProcedure");
            return null;
        }
 //to be removed
 public ViewModelMatchHistory()
 {
     if (data == null)
     {
         data = new DataAccessProxy();
     }
 }
Exemplo n.º 3
0
 public int EditColumns(GroupInfo entity)
 {
     return(DataAccessProxy.Edit(entity, it => new GroupInfo()
     {
         GroupName = entity.GroupName
     }, it => it.Id == entity.Id));
 }
Exemplo n.º 4
0
 public List <UserView> GetList()
 {
     return(DataAccessProxy.GetList <UserInfo, GroupInfo, UserView>((st, sc) => new object[] {
         SqlSugar.JoinType.Left, st.GroupID == sc.Id
     }, st => st.Id == 1, (st, sc) => st.Id, (st, sc) => new UserView {
         Id = st.Id, CnName = st.CnName, GroupName = sc.GroupName
     }));
 }
Exemplo n.º 5
0
 public List <UserView> GetList2()
 {
     return(DataAccessProxy.GetList <UserInfo, GroupInfo, DeptInfo, UserView>((st, sc, sd) => new object[] {
         SqlSugar.JoinType.Left, st.GroupID == sc.Id,
         SqlSugar.JoinType.Left, st.DeptID == sd.Id
     }, (st => st.Id == 1), null, (st, sc, sd) => new UserView {
         Id = st.Id, CnName = st.CnName, GroupName = sc.GroupName, DeptName = sd.DeptName
     }));
 }
Exemplo n.º 6
0
 public long Add(GroupInfo entity, bool ignorePk = true)
 {
     if (ignorePk)
     {
         return(DataAccessProxy.Add(entity, x => new { x.Id }));
     }
     else
     {
         return(DataAccessProxy.Add(entity));
     }
 }
        public ViewModelMatchHistory(string username)
        {
            if (data == null)
            {
                data = new DataAccessProxy();
            }

            try
            {
                _player = data.GetPlayerByName(username);
            }
            catch (Exception)
            {
                _player = new NullPlayer();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Return single configuration value for given Branch number, module name and key name
        /// Stored Procedure name 
        /// </summary>
        /// <param name="Da">Opics build in Data Access object</param>
        /// <param name="BR">Branch Number</param>
        /// <param name="ModuleName">Module Name for config table</param>
        /// <param name="KeyName">Key name for configuration Key/value pair</param>
        /// <returns>
        ///     Success: Value in string
        ///     Failure: Empty string
        /// </returns>
        public static string GetConfigSingleValue(DataAccessProxy Da, string BR, string ModuleName, string KeyName)
        {
            TraceOutput.EnterModule(string.Format("GetConfigValue: {0} {1} {2}", BR, ModuleName, KeyName));

            DataSet ds = new DataSet();
            ds = CallStoredProcedure(Da, SP_SCOTIA_CONFIG, new string[3] { BR, ModuleName, KeyName });

            string result = string.Empty;

            try
            {
                // Returned data: BR, MODULENAME, KEY, VALUE
                result = ds.Tables[0].Rows[0].ItemArray[3].ToString(); //Item #4 is Value

                postGetConfigData(ref result);
            }
            catch
            {
                TraceOutput.Error(string.Format("Scotia_Config Key: {0} not found! Returning empty value."));
            }

            TraceOutput.ExitModule("GetConfigValue");
            return result;
        }
Exemplo n.º 9
0
    private void GetDataAccessLevelsRoot_MultiLevelsDataAccessLevels(ComponentArt.Web.UI.TreeView trvDataAccessLevels, DataAccessLevelsType Dalt, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType?Dalot, DataAccessLevelOperationState?Dalos, decimal UserID, UserSearchKeys?SearchKey, string SearchTerm)
    {
        DataAccessProxy rootDals         = null;
        string          rootDalsNodeText = string.Empty;

        if (Dalot == DataAccessLevelOperationType.Group && Dalos == DataAccessLevelOperationState.After)
        {
            UserID = BUser.CurrentUser.ID;
        }
        switch (DataAccessLevelKey)
        {
        case DataAccessParts.Department:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentRoot(Dalt, UserID);
            if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.OrganizationUnit:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationRoot(Dalt, UserID);
            if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.Report:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetReportRoot(Dalt, UserID);
            if (GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.RuleGroup:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetRuleRoot(Dalt, UserID);
            if (GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;
        }
        TreeViewNode rootDalsNode = new TreeViewNode();

        rootDalsNode.ID    = rootDals.ID.ToString();
        rootDalsNode.Text  = rootDalsNodeText;
        rootDalsNode.Value = rootDals.DeleteEnable.ToString().ToLower();
        string ImagePath = string.Empty;
        string ImageUrl  = string.Empty;

        if (rootDals.DeleteEnable)
        {
            if (DataAccessLevelKey != DataAccessParts.Report)
            {
                ImagePath = "\\Images\\TreeView\\folder_blue.gif";
                ImageUrl  = "Images/TreeView/folder_blue.gif";
            }
            else
            {
                ImagePath = "\\Images\\TreeView\\group.png";
                ImageUrl  = "Images/TreeView/group.png";
            }
        }
        else
        {
            if (DataAccessLevelKey != DataAccessParts.Report)
            {
                ImagePath = "\\Images\\TreeView\\folder.gif";
                ImageUrl  = "Images/TreeView/folder.gif";
            }
            else
            {
                ImagePath = "\\Images\\TreeView\\group_silver.png";
                ImageUrl  = "Images/TreeView/group_silver.png";
            }
        }
        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImagePath))
        {
            rootDalsNode.ImageUrl = ImageUrl;
        }
        trvDataAccessLevels.Nodes.Add(rootDalsNode);
        rootDalsNode.Expanded = true;

        switch (Dalot)
        {
        case DataAccessLevelOperationType.Single:
            this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, null, UserID, SearchKey, string.Empty, rootDalsNode, rootDals);
            break;

        case DataAccessLevelOperationType.Group:
            switch (Dalos)
            {
            case DataAccessLevelOperationState.Before:
                break;

            case DataAccessLevelOperationState.After:
                this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, SearchTerm, rootDalsNode, rootDals);
                break;
            }
            break;

        default:
            if (Dalt == DataAccessLevelsType.Source)
            {
                this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, SearchTerm, rootDalsNode, rootDals);
            }
            break;
        }
    }
Exemplo n.º 10
0
        /// <summary>
        /// Call Stored Procedure using Misys Framework
        /// </summary>
        /// <param name="Da">Build in Data Access object</param>
        /// <param name="StoredProcedureName">Stored Procedure Name</param>
        /// <param name="Parameters">Storec Procuedure Parameters array</param>
        /// <returns>
        ///     Success: Table 0 populated with return data
        ///     Failure: Null
        /// </returns>
        public static DataSet CallStoredProcedure(DataAccessProxy Da,string StoredProcedureName, string[] Parameters)
        {
            TraceOutput.EnterModule(string.Format("CallStoredProcedure: {0}", StoredProcedureName));

            try
            {
                //Get data access proxy
                if (Da == null)
                {
                    Da = DataAccessProxy.GetDataProxy();
                }

                // Make a call to database to get data
                for (int i = 0; i < 300; i++) Da.DBFields[i] = string.Empty;

                //Parameters.CopyTo(Da.DBFields, Parameters.Length);
                for (int i = 1; i <= Parameters.Length; i++)
                    Da.DBFields[i] = Parameters[i - 1];

                Da.ColumnCount = Parameters.Length;

                //Call database
                TraceOutput.Information(string.Format("Calling Stored Procedure: {0}", StoredProcedureName));
                Da.DBCALL(Misys.OpicsPlus.Framework.DataAccessLayer.CommandType.STOREDPROCEDURE.ToString(), string.Empty, StoredProcedureName);

                //Scan result
                TraceOutput.Information(string.Format("Stored Procedure returned: ", Da.Result.ToString()));
                if (Da.Result != ReturnType.dbFAIL)
                {
                    //Data has been returned successfully, exit with dataset
                    SessionParameters.Result.ErrorNumber = 0;
                    TraceOutput.ExitModule("CallStoredProcedure");
                    return Da.Output.Data;
                }

                //Trace error message
                TraceOutput.Error(string.Format("CallStoredProcedure failed: {0} {1}", Da.Error.ErrorCode, Da.Error.ErrorMessage));
                //Error happened, return error message and exit
                SessionParameters.Result.ErrorNumber = 21;

            }
            catch (Exception ex)
            {
                TraceOutput.Error(ex.Message);
                SessionParameters.Result.SetError(17201, new object[] { ex.Message });

            }
            TraceOutput.ExitModule("CallStoredProcedure");
            return null;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Retrieve configuration value in a dataset for given Branch number, module name
        /// Stored Procedure name 
        /// </summary>
        /// <param name="Da">Opics build in Data Access object</param>
        /// <param name="BR">Branch Number</param>
        /// <param name="ModuleName">Module Name for config table</param>
        /// <returns>
        ///     Success: Table 0 populated with returned data
        ///     Failure: Null
        /// </returns>
        public static DataSet GetConfigValue(DataAccessProxy Da, string BR, string ModuleName)
        {
            TraceOutput.EnterModule(string.Format("GetConfigValue: {0} {1}", BR, ModuleName));

            DataSet ds = new DataSet();
            ds = CallStoredProcedure(Da, SP_SCOTIA_CONFIG, new string[3] { BR, ModuleName, DBNull.Value.ToString()});

            TraceOutput.ExitModule("GetConfigValue");
            return ds;
        }
Exemplo n.º 12
0
 public List <GroupInfo> GetList(string where, object parameters, int pageIndex, int pageSize, string orderBy, ref int total)
 {
     //db.Queryable<Student>().Where("name=@name", new { name = value }).ToList();
     return(DataAccessProxy.GetListPage <GroupInfo>(where, parameters, orderBy, pageIndex, pageSize, ref total));
 }
Exemplo n.º 13
0
 public List <GroupInfo> GetList(string sql, object obj)
 {
     return(DataAccessProxy.SqlQuery <GroupInfo>(sql, obj) as List <GroupInfo>);
 }
Exemplo n.º 14
0
 public int GetCount(string where, object parameters)
 {
     return(DataAccessProxy.GetCount <GroupInfo>(where, parameters));
 }
Exemplo n.º 15
0
 public List <GroupInfo> GetList(string where, object parameters, string orderBy)
 {
     return(DataAccessProxy.GetList <GroupInfo>(where, parameters, orderBy));
 }
Exemplo n.º 16
0
 public GroupInfo Get(int id)
 {
     return(DataAccessProxy.Get <GroupInfo>(id));
 }
Exemplo n.º 17
0
    private void GetChildDataAccessLevels_MultiLevelsDataAccessLevels(DataAccessLevelsType Dalt, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType?Dalot, decimal UserID, UserSearchKeys?SearchKey, string SearchTerm, TreeViewNode parentDalNode, DataAccessProxy parentDal)
    {
        bool HasChildDals = false;
        IList <DataAccessProxy> DalList = null;

        UserID = this.GetUserID_MultiLevelsDataAccessLevels(Dalot, UserID, SearchKey, SearchTerm);

        switch (DataAccessLevelKey)
        {
        case DataAccessParts.Department:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentChilds(parentDal.ID);
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentsOfUser(UserID, parentDal.ID);
                break;
            }
            break;

        case DataAccessParts.OrganizationUnit:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationChilds(parentDal.ID);
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationOfUser(UserID, parentDal.ID);
                break;
            }
            break;

        case DataAccessParts.Report:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetReportChilds(parentDal.ID);
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetReportOfUser(UserID, parentDal.ID);
                break;
            }
            break;

        case DataAccessParts.RuleGroup:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRuleChilds(parentDal.ID);
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRuleOfUser(UserID, parentDal.ID);
                break;
            }
            break;
        }

        foreach (DataAccessProxy childDal in DalList)
        {
            TreeViewNode childDalNode = new TreeViewNode();
            childDalNode.ID    = childDal.ID.ToString();
            childDalNode.Text  = childDal.Name;
            childDalNode.Value = childDal.DeleteEnable.ToString().ToLower();
            if (DataAccessLevelKey == DataAccessParts.OrganizationUnit)
            {
                childDalNode.ContentCallbackUrl = "XmlMultiLevelsDataAccessLevels.aspx?Dalt=" + Dalt.ToString() + "&Dalk=" + DataAccessLevelKey.ToString() + "&UserID=" + UserID.ToString() + "&ParentDalID=" + childDalNode.ID + "&LangID=" + this.LangProv.GetCurrentLanguage();
                if (this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationChilds(childDal.ID).Count > 0)
                {
                    childDalNode.Nodes.Add(new TreeViewNode());
                }
            }
            string ImagePath = string.Empty;
            string ImageUrl  = string.Empty;
            if (childDal.DeleteEnable)
            {
                if (DataAccessLevelKey != DataAccessParts.Report)
                {
                    ImagePath = "\\Images\\TreeView\\folder_blue.gif";
                    ImageUrl  = "Images/TreeView/folder_blue.gif";
                }
                else
                {
                    if (childDal.IsReport)
                    {
                        ImagePath = "\\Images\\TreeView\\report.png";
                        ImageUrl  = "Images/TreeView/report.png";
                    }
                    else
                    {
                        ImagePath = "\\Images\\TreeView\\group.png";
                        ImageUrl  = "Images/TreeView/group.png";
                    }
                }
            }
            else
            {
                if (DataAccessLevelKey != DataAccessParts.Report)
                {
                    ImagePath = "\\Images\\TreeView\\folder.gif";
                    ImageUrl  = "Images/TreeView/folder.gif";
                }
                else
                {
                    if (childDal.IsReport)
                    {
                        ImagePath = "\\Images\\TreeView\\report_silver.png";
                        ImageUrl  = "Images/TreeView/report_silver.png";
                    }
                    else
                    {
                        ImagePath = "\\Images\\TreeView\\group_silver.png";
                        ImageUrl  = "Images/TreeView/group_silver.png";
                    }
                }
            }
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImagePath))
            {
                childDalNode.ImageUrl = ImageUrl;
            }
            parentDalNode.Nodes.Add(childDalNode);
            try
            {
                if (parentDalNode.Parent.Parent == null)
                {
                    parentDalNode.Expanded = true;
                }
            }
            catch
            { }
            switch (DataAccessLevelKey)
            {
            case DataAccessParts.Department:
                if (this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentChilds(childDal.ID).Count > 0)
                {
                    HasChildDals = true;
                }
                break;

            case DataAccessParts.Report:
                if (this.MultiLevelsDataAccessLevelesBusiness.GetReportChilds(childDal.ID).Count > 0)
                {
                    HasChildDals = true;
                }
                break;

            case DataAccessParts.RuleGroup:
                break;
            }
            if (HasChildDals)
            {
                this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, SearchTerm, childDalNode, childDal);
            }
        }
    }
Exemplo n.º 18
0
 public int Edit(GroupInfo entity)
 {
     return(DataAccessProxy.Edit(entity));
 }
Exemplo n.º 19
0
 public int Delete(int primaryKey, bool isLogic)
 {
     return(DataAccessProxy.Delete <GroupInfo>(primaryKey));
 }
Exemplo n.º 20
0
 public long Add(List <GroupInfo> entitys, bool ignorePk = true)
 {
     return(DataAccessProxy.Add(entitys));
 }