Esempio n. 1
0
        /// <summary>
        /// 选出所有城市
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="obType"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public DataTable GetCityList(out int totalCount, int pageSize, int pageIndex, Common.OrderByType obType, BusinessFilter filter)
        {
            Common commonRule = new Common();

            BusinessFilter flt = new BusinessFilter("Dictionary");

            flt.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            flt.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            flt.AddFilterItem("Level", SystemManage.Level.City, Operation.Equal, FilterType.NumberType, AndOr.AND);

            flt.AddFilter(filter, AndOr.AND);

            // Add Data Permission
            //			flt.AddFilter(GetAuthorizedCityFilter(GlobalFacade.SystemContext.GetContext().UserID), AndOr.AND);

            BusinessObjectCollection boc = new BusinessObjectCollection("Dictionary");

            boc.SessionInstance = new Session();
            boc.AddFilter(flt);

            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC) ? true : false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
Esempio n. 2
0
        private void SaveElement(XmlDocument doc, XmlElement Parent, DataTable childtable)
        {
            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                int    childpkid;
                string ChsName;
                string URL;

                childpkid = (int)childtable.Rows[i]["PKID"];
                ChsName   = (string)childtable.Rows[i]["ChineseName"];
                if (childtable.Rows[i]["URL"] != null || childtable.Rows[i]["URL"].ToString() != "")
                {
                    URL = childtable.Rows[i]["URL"].ToString();
                }
                else
                {
                    URL = "";
                }
                RoleMenu checkmenu = new RoleMenu();
                checkmenu.SessionInstance = session;
                BusinessFilter checkfilter = new BusinessFilter("RoleMenu");
                checkfilter.AddFilterItem("FK_Menu", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                checkfilter.AddFilterItem("FK_Role", this.rolepkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                checkfilter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                checkmenu.AddFilter(checkfilter);
                checkmenu.Load();
                if (checkmenu.HaveRecord)
                {
                    System.Xml.XmlElement child = GlobalFacade.XDom.CreateDocumentElement(doc, "TREENODE");
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "TEXT", ChsName);
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "NODEDATA", childpkid.ToString());
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "EXPANDED", "false");
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "TARGET", "main");
                    GlobalFacade.XDom.SetNodeAttribute(doc, child, "NAVIGATEURL", URL);
                    Parent.AppendChild(child);

                    System.Data.DataTable    subchildTable;
                    BusinessObjectCollection subchild = new BusinessObjectCollection("Menu");
                    subchild.SessionInstance = session;
                    BusinessFilter filter = new BusinessFilter("Menu");
                    filter.AddFilterItem("Parent", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                    filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                    subchild.AddFilter(filter);
                    /* Andy Modify 2007-04-26 Add Order By */
                    subchild.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
                    subchildTable = subchild.GetDataTable();
                    if (subchildTable.Rows.Count > 0)
                    {
                        SaveElement(doc, child, subchildTable);
                    }
                }
            }
        }
Esempio n. 3
0
        public bool IsFieldExclusiveM(string fieldName, string fieldValue, string ObjectName, bool stringField, int objectPKID)
        {
            BusinessFilter filter = new BusinessFilter(ObjectName);

            filter.AddFilterItem("PKID", objectPKID.ToString(), Operation.NotEqual, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem(fieldName, fieldValue, Operation.Equal, stringField ? FilterType.StringType : FilterType.NumberType, AndOr.AND);

            BusinessObjectCollection boc = new BusinessObjectCollection(ObjectName);

            boc.SessionInstance = new Wicresoft.Session.Session();
            boc.AddFilter(filter);
            boc.Query();

            return((boc.Count > 0) ? false : true);
        }
Esempio n. 4
0
        public string GetRoot()
        {
            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Parent", SystemManage.Level.Top, Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.Dictionary rootregion = new BusinessMapping.Dictionary();
            rootregion.AddFilter(filter);
            rootregion.SessionInstance = new Session();
            rootregion.Load();

            return((rootregion.HaveRecord) ? rootregion.PKID.Value.ToString() : SystemManage.Level.Top);
        }
Esempio n. 5
0
        public bool IsRegionExclusive(string fieldName, string fieldValue, bool stringField, int FK_Dictionary)
        {
            BusinessFilter filter = new BusinessFilter("Dictionary_RegionDetail");

            filter.AddFilterItem("FK_Dictionary", FK_Dictionary.ToString(), Operation.NotEqual, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem(fieldName, fieldValue, Operation.Equal, stringField ? FilterType.StringType : FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessObjectCollection boc = new BusinessObjectCollection("Dictionary_RegionDetail");

            boc.SessionInstance = new Wicresoft.Session.Session();
            boc.AddFilter(filter);
            boc.Query();

            return((boc.Count > 0) ? false : true);
        }
Esempio n. 6
0
        public void Update()
        {
            BusinessMapping.Role bo = new BusinessMapping.Role();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Role");

            filter.AddFilterItem("PKID", this.PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                bo.RoleCode.Value = this.tbxRoleCode.Text.Trim();
                bo.RoleName.Value = this.tbxRoleName.Text.Trim();
                bo.Memo.Value     = this.tbxMemo.Text.Trim();

                bo.ModifyTime.Value = DateTime.Now;
                bo.ModifyUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
                bo.Update();

                //BusinessRule.SystemManage.OperationLog rule = new BusinessRule.SystemManage.OperationLog();
                //rule.WriteOperationLog("用户组管理", "编辑用户组");
            }
        }
Esempio n. 7
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.CWInfo bo = new BusinessMapping.CWInfo();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWInfo");

            filter.AddFilterItem("PKID", pkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                txtVillageName.Text = bo.VillageName.Value;
                txtLocation.Text    = bo.Location.Value;
                if (bo.District.Value > 0)
                {
                    ddlDistrict.SelectedValue = bo.District.Value.ToString();
                }
                if (bo.TotalPeps.Value > 0)
                {
                    txtTotalPeps.Text = bo.TotalPeps.Value.ToString();
                }
                if (bo.IndusValue.Value > 0)
                {
                    txtIndusValue.Text = bo.IndusValue.Value.ToString();
                }
                txtVillageChief.Text = bo.VillageChief.Value;
                txtMemo.Text         = bo.Memo.Value;
            }
        }
Esempio n. 8
0
        private void GenerateElement(Microsoft.Web.UI.WebControls.TreeNode Parent, DataTable childtable)
        {
            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                int    childpkid;
                string Name;
                string path;
                childpkid = (int)childtable.Rows[i]["PKID"];
                Name      = childtable.Rows[i]["Name"].ToString();
                path      = childtable.Rows[i]["path"].ToString();
                Microsoft.Web.UI.WebControls.TreeNode node = new TreeNode();

                node.NodeData = childpkid.ToString();
                node.Text     = Name;
                node.ID       = path;
                Parent.Nodes.Add(node);

                System.Data.DataTable    subchildTable;
                BusinessObjectCollection subchild = new BusinessObjectCollection("Dictionary");
                subchild.SessionInstance = session;
                BusinessFilter filter = new BusinessFilter("Dictionary");
                filter.AddFilterItem("Parent", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

                filter.AddFilterItem("Type", Convert.ToString((int)type), Operation.Equal, FilterType.NumberType, AndOr.AND);
//				if (type == DictionaryType.Region)
//				{
//					filter.AddFilterItem("Type","1",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
//				else if (type == DictionaryType.Product)
//				{
//					filter.AddFilterItem("Type","2",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
//				else
//				{
//					filter.AddFilterItem("Type","3",Operation.Equal,FilterType.NumberType,AndOr.AND);
//				}
                filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                subchild.AddFilter(filter);

                subchildTable = subchild.GetDataTable();
                if (subchildTable.Rows.Count > 0)
                {
                    GenerateElement(node, subchildTable);
                }
            }
        }
Esempio n. 9
0
        private void validatorOldPwd_ServerValidate(object source, ServerValidateEventArgs args)
        {
            string Alias = GlobalFacade.SystemContext.GetContext().Alias.ToString();

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("Alias", Alias, Operation.Equal, FilterType.StringType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsActive", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            bo.AddFilter(filter);
            bo.Load();

            args.IsValid = GlobalFacade.EncryptionManager.VerifyPassword(this.tbxOldPassword.Text.Trim(), bo.Password.Value);
            this.validatorOldPwd.ErrorMessage = "旧密码输入错误";
        }
Esempio n. 10
0
        public static void DictionaryList(System.Web.UI.WebControls.DropDownList DropOnDictionary, string type)
        {
            BusinessObjectCollection boc = new BusinessObjectCollection("Dictionary");

            boc.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", type, Operation.Equal, FilterType.NumberType, AndOr.AND);

            boc.AddFilter(filter);

            DropOnDictionary.DataSource     = boc.GetDataTable();
            DropOnDictionary.DataTextField  = "Name";
            DropOnDictionary.DataValueField = "PKID";
            DropOnDictionary.DataBind();
            DropOnDictionary.Items.Insert(0, new ListItem(ResourceManager.Instance.GetString("PleaseSelect"), "0"));
        }
Esempio n. 11
0
        private void BindForeignKeyData()
        {
            BusinessObjectCollection boc = new BusinessObjectCollection("Dictionary");

            boc.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", GlobalFacade.DictionaryType.Type_1.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            boc.AddFilter(filter);

            ddlDistrict.DataSource     = boc.GetDataTable();
            ddlDistrict.DataTextField  = "Name";
            ddlDistrict.DataValueField = "PKID";
            ddlDistrict.DataBind();
            ddlDistrict.Items.Insert(0, new ListItem(ResourceManager.Instance.GetString("PleaseSelect"), "0"));
        }
Esempio n. 12
0
        public void GenerateMenuTreeXML()
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection MenuCollection = new BusinessObjectCollection("Menu");

            MenuCollection.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Menu");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            MenuCollection.AddFilter(filter);
            /* Andy Modify 2007-04-26 Add Order By */
            MenuCollection.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
            DataTable childtable = MenuCollection.GetDataTable();

            GenerateElement(doc, root, childtable);
            outxml = doc.OuterXml;
        }
Esempio n. 13
0
        public string GetMenuXML()
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection MenuCollection = new BusinessObjectCollection("Menu");

            MenuCollection.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Menu");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            MenuCollection.AddFilter(filter);

            MenuCollection.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
            DataTable childtable = MenuCollection.GetDataTable();

            SaveElement(doc, root, childtable);
            return(doc.OuterXml);
        }
Esempio n. 14
0
        private void DeleteNode(int Dictionary_PKID, Wicresoft.Session.Session session)
        {
            // Delete the entry in Dictionary
            BusinessMapping.Dictionary owner = new BusinessMapping.Dictionary();
            owner.SessionInstance = session;
            owner.PKID.Value      = Dictionary_PKID;
            owner.IsValid.Value   = false;
            owner.Update();

            // Delete the entry in Dictionary_RegionDetail
            BusinessObjectCollection region = new BusinessObjectCollection("Dictionary_RegionDetail");

            region.SessionInstance = session;

            BusinessFilter regiondeletefilter = new BusinessFilter("Dictionary_RegionDetail");

            regiondeletefilter.AddFilterItem("FK_Dictionary", Dictionary_PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            region.AddFilter(regiondeletefilter);

            ((BusinessMapping.Dictionary_RegionDetail)region.Businessobject).IsValid.Value = false;
            region.UpdateFilter();


            // Delete any child entries
            BusinessObjectCollection child = new BusinessObjectCollection("Dictionary");

            child.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Parent", Dictionary_PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            child.AddFilter(filter);

            DataTable childtable = child.GetDataTable();

            for (int i = 0; i < childtable.Rows.Count; i++)
            {
                DeleteNode(int.Parse(childtable.Rows[i]["PKID"].ToString()), session);
            }
        }
Esempio n. 15
0
        public void GenerateRegionTreeXML()
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection RegionCollection = new BusinessObjectCollection("Dictionary");

            RegionCollection.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            RegionCollection.AddFilter(filter);

            DataTable childtable = RegionCollection.GetDataTable();

            GenerateRegionElement(doc, root, childtable);
            this.outregionxml = doc.OuterXml;
        }
Esempio n. 16
0
 private void GenerateRegionElement(XmlDocument doc, XmlElement Parent, DataTable childtable)
 {
     for (int i = 0; i < childtable.Rows.Count; i++)
     {
         int    childpkid;
         string Name;
         childpkid = (int)childtable.Rows[i]["PKID"];
         Name      = (string)childtable.Rows[i]["Name"];
         System.Xml.XmlElement child      = GlobalFacade.XDom.CreateDocumentElement(doc, "TREENODE");
         RoleDataPermission    HaveRegion = new RoleDataPermission();
         HaveRegion.SessionInstance = session;
         BusinessFilter checkfilter = new BusinessFilter("RoleDataPermission");
         checkfilter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
         checkfilter.AddFilterItem("FK_Role", this.RolePKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
         checkfilter.AddFilterItem("FK_Dictionary", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
         HaveRegion.AddFilter(checkfilter);
         HaveRegion.Load();
         if (HaveRegion.HaveRecord)
         {
             GlobalFacade.XDom.SetNodeAttribute(doc, child, "checked", "True");
         }
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "checkBox", "True");
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "Expanded", "True");
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "Text", Name);
         GlobalFacade.XDom.SetNodeAttribute(doc, child, "NodeData", childpkid.ToString());
         Parent.AppendChild(child);
         System.Data.DataTable    subchildTable;
         BusinessObjectCollection subchild = new BusinessObjectCollection("Dictionary");
         subchild.SessionInstance = session;
         BusinessFilter filter = new BusinessFilter("Dictionary");
         filter.AddFilterItem("Parent", childpkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
         filter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
         filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
         subchild.AddFilter(filter);
         subchildTable = subchild.GetDataTable();
         if (subchildTable.Rows.Count > 0)
         {
             GenerateRegionElement(doc, child, subchildTable);
         }
     }
 }
Esempio n. 17
0
        public DataTable GetRegionList(out int totalCount, int pageSize, int pageIndex, Common.OrderByType obType, BusinessFilter subfilter, string Parent)
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("Dictionary");
            BusinessFilter            filter  = new BusinessFilter("Dictionary");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            if (Parent == SystemManage.Level.Top)
            {
                BusinessMapping.Dictionary TopParent = new BusinessMapping.Dictionary();
                TopParent.SessionInstance = session;
                BusinessFilter searchparent = new BusinessFilter("Dictionary");
                searchparent.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                searchparent.AddFilterItem("Type", ((int)SystemManage.DictionaryType.Region).ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                searchparent.AddFilterItem("Parent", SystemManage.Level.Top, Operation.Equal, FilterType.NumberType, AndOr.AND);
                TopParent.AddFilter(searchparent);
                TopParent.Load();
                if (TopParent.HaveRecord)
                {
                    Parent = TopParent.PKID.Value.ToString();
                }
            }

            if (!(Parent == null || Parent.Equals(string.Empty)))
            {
                filter.AddFilterItem("Parent", Parent.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            }

            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.SessionInstance = session;
            boc.AddFilter(filter);
            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC) ? true : false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
Esempio n. 18
0
        /// <summary>
        /// 获取城市名称
        /// </summary>
        /// <param name="pkid">城市PKID</param>
        /// <returns></returns>
        public string GetDictionaryName(string pkid)
        {
            string name = string.Empty;

            BusinessMapping.Dictionary bo = new BusinessMapping.Dictionary();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("Dictionary");

            filter.AddFilterItem("PKID", pkid, Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);

            bo.Load();
            if (bo.HaveRecord)
            {
                name = bo.Name.Value;
            }

            return(name);
        }
Esempio n. 19
0
 private void Initialize()
 {
     bo.SessionInstance = new Wicresoft.Session.Session();
     filter             = new BusinessFilter("User");
     filter.AddFilterItem("PKID", userid, Operation.Equal, FilterType.NumberType, AndOr.AND);
     bo.AddFilter(filter);
     bo.Load();
     if (bo.HaveRecord)
     {
         this.Info.Text = "您正在修改" + bo.ChineseName.Value.ToString() + "[" + bo.Alias.Value.ToString() + "]的个人信息<br/><br/>";
     }
 }
Esempio n. 20
0
        public string GetRoleName(string roleID)
        {
            string rolename = string.Empty;

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessMapping.Role      bo      = new BusinessMapping.Role();
            bo.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Role");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("PKID", roleID, Operation.Equal, FilterType.StringType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                rolename = bo.RoleName.Value;
            }

            return(rolename);
        }
Esempio n. 21
0
        /* 根据名称获取用户组ID */
        public int GetRoleID(string rolename)
        {
            int roleid = -1;

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessMapping.Role      bo      = new BusinessMapping.Role();
            bo.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Role");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("RoleName", rolename, Operation.Equal, FilterType.StringType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                roleid = bo.PKID.Value;
            }

            return(roleid);
        }
Esempio n. 22
0
        public string GetEntryLevelById(string entryId)
        {
            BusinessFilter flt = new BusinessFilter("Dictionary");

            flt.AddFilterItem("PKID", entryId, Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.Dictionary bo = new BusinessMapping.Dictionary();
            bo.SessionInstance = session;
            bo.AddFilter(flt);
            bo.Load();

            return((bo.HaveRecord)?bo.Level.Value.ToString():string.Empty);
        }
Esempio n. 23
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.CWBirthInfo bo = new BusinessMapping.CWBirthInfo();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWBirthInfo");

            filter.AddFilterItem("PKID", pkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                if (bo.FK_CWID.Value > 0)
                {
                    this.gpCWInfo.SelectedValue = bo.FK_CWID.Value.ToString();
                }
                this.txtChildName.Text = bo.ChildName.Value;
                if (bo.Sex.Value > 0)
                {
                    this.ddlSex.SelectedValue = bo.Sex.Value.ToString();
                }
                if (bo.BirthDate.Value != DateTime.MinValue)
                {
                    this.txtBirthDate.Text = bo.BirthDate.Value.ToString("yyyy-MM-dd");
                }
                this.txtBirthNo.Text = bo.BirthNo.Value;
                if (bo.IsPlan.Value > 0)
                {
                    this.ddlIsPlan.SelectedValue = bo.IsPlan.Value.ToString();
                }
                if (bo.ExpectDate.Value != DateTime.MinValue)
                {
                    this.txtExpectDate.Text = bo.ExpectDate.Value.ToString("yyyy-MM-dd");
                }

                this.txtChildAddress.Text   = bo.ChildAddress.Value;
                this.txtHolderName.Text     = bo.HolderName.Value;
                this.txtHolderIDCardNo.Text = bo.HolderIDCardNo.Value;
                this.txtFathName.Text       = bo.FathName.Value;
                this.txtFathIDCardNo.Text   = bo.FathIDCardNo.Value;
                this.txtFathAddress.Text    = bo.FathAddress.Value;
                this.txtFathLinkPhone.Text  = bo.FathLinkPhone.Value;
                this.txtMothName.Text       = bo.MothName.Value;
                this.txtMothIDCardNo.Text   = bo.MothIDCardNo.Value;
                this.txtMothAddress.Text    = bo.MothAddress.Value;
                this.txtMothLinkPhone.Text  = bo.MothLinkPhone.Value;
                this.txtMemo.Text           = bo.Memo.Value;
            }
        }
Esempio n. 24
0
        private void GetCurrentUser()
        {
            string id = System.Web.HttpContext.Current.User.Identity.Name;

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("Alias", id, Operation.Equal, FilterType.StringType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                this.currentUser = bo;
            }
            else
            {
                throw new Exception("无法取得当前用户信息!");
            }
        }
Esempio n. 25
0
        public void SaveRegionConfig(string[] name, int rolepkid)
        {
            Session session = new Session();

            try
            {
                session.BeginTransaction();
                BusinessObjectCollection regioncollection = new BusinessObjectCollection("RoleDataPermission");
                regioncollection.SessionInstance = session;
                BusinessFilter filter = new BusinessFilter("RoleDataPermission");
                filter.AddFilterItem("FK_Role", rolepkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                filter.AddFilterItem("Type", Convert.ToString((int)DictionaryType.Region), Operation.Equal, FilterType.NumberType, AndOr.AND);
                regioncollection.AddFilter(filter);
                regioncollection.DeleteFilter();

                for (int index = 0; index < name.Length; index++)
                {
                    BusinessMapping.RoleDataPermission regionright = new RoleDataPermission();
                    regionright.SessionInstance     = session;
                    regionright.FK_Role.Value       = rolepkid;
                    regionright.Type.Value          = 1;
                    regionright.FK_Dictionary.Value = int.Parse(name[index].ToString());
                    regionright.CreateUser.Value    = SystemContext.GetContext().UserID;
                    regionright.ModifyUser.Value    = SystemContext.GetContext().UserID;
                    regionright.CreateTime.Value    = regionright.ModifyTime.Value = DateTime.Now;
                    regionright.Insert();
                }
                session.Commit();

                OperationLog opLog = new OperationLog();
                opLog.WriteOperationLog("数据权限管理", "配置数据权限");
            }
            catch
            {
                session.Rollback();
            }
        }
Esempio n. 26
0
        public void SaveConfig(string[] name, int rolepkid)
        {
            Session session = new Session();

            try
            {
                session.BeginTransaction();
                BusinessObjectCollection rolemenucollection = new BusinessObjectCollection("RoleMenu");
                rolemenucollection.SessionInstance = session;
                BusinessFilter filter = new BusinessFilter("RoleMenu");
                filter.AddFilterItem("FK_Role", rolepkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
                rolemenucollection.AddFilter(filter);
                rolemenucollection.DeleteFilter();
                for (int index = 0; index < name.Length; index++)
                {
                    RoleMenu rolemenu = new RoleMenu();
                    rolemenu.SessionInstance  = session;
                    rolemenu.FK_Menu.Value    = int.Parse(name[index].ToString());
                    rolemenu.FK_Role.Value    = rolepkid;
                    rolemenu.CreateUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
                    rolemenu.ModifyUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
                    rolemenu.CreateTime.Value = DateTime.Now;
                    rolemenu.ModifyTime.Value = DateTime.Now;
                    rolemenu.IsValid.Value    = true;
                    rolemenu.Insert();
                }
                session.Commit();

                BusinessRule.SystemManage.OperationLog opLog = new BusinessRule.SystemManage.OperationLog();
                opLog.WriteOperationLog("界面权限管理", "配置界面权限");
            }
            catch
            {
                session.Rollback();
            }
        }
Esempio n. 27
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.CWNewMarrige bo = new BusinessMapping.CWNewMarrige();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWNewMarrige");

            filter.AddFilterItem("PKID", pkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                if (bo.FK_CWID.Value > 0)
                {
                    this.gpCWInfo.SelectedValue = bo.FK_CWID.Value.ToString();
                }
                this.txtMaleIDCardNo.Text    = bo.MaleIDCardNo.Value;
                this.txtMaleName.Text        = bo.MaleName.Value;
                this.txtMaleAddress.Text     = bo.MaleAddress.Value;
                this.txtMaleLinkPhone.Text   = bo.MaleLinkPhone.Value;
                this.txtFemaleIDCardNo.Text  = bo.FemaleIDCardNo.Value;
                this.txtFemaleName.Text      = bo.FemaleName.Value;
                this.txtFemaleAddress.Text   = bo.FemaleAddress.Value;
                this.txtFemaleLinkPhone.Text = bo.FemaleLinkPhone.Value;
                if (bo.MarrigeDate.Value != DateTime.MinValue)
                {
                    this.txtMarrigeDate.Text = bo.MarrigeDate.Value.ToString("yyyy-MM-dd");
                }

                if (bo.IsPregnant.Value > 0)
                {
                    this.ddlIsPregnant.SelectedValue = bo.IsPregnant.Value.ToString();
                }

                if (bo.ExpectDate.Value != DateTime.MinValue)
                {
                    this.txtExpectDate.Text = bo.ExpectDate.Value.ToString("yyyy-MM-dd");
                }

                if (bo.VillageDate.Value != DateTime.MinValue)
                {
                    this.txtVillageDate.Text = bo.VillageDate.Value.ToString("yyyy-MM-dd");
                }

                this.txtMarrigeNo.Text = bo.MarrigeNo.Value;
                this.txtMemo.Text      = bo.Memo.Value;
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Process User Login Flow
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool ProcessLogin(string userid, string password)
        {
            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("Alias", userid, Operation.Equal, FilterType.StringType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsActive", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord && GlobalFacade.EncryptionManager.VerifyPassword(password, bo.Password.Value))
            {
                GlobalFacade.SystemContext context = GlobalFacade.SystemContext.GetContext();
                context.CurrentUser = bo;
                GlobalFacade.SystemContext.SaveContext(context);

                if (NeedModifyPassword())
                {
                    System.Web.HttpContext.Current.Response.Redirect(System.Web.HttpContext.Current.Request.ApplicationPath + "/SystemManage/UserManage/CheckPassword.aspx");
                }
                else
                {
                    System.Web.Security.FormsAuthentication.SetAuthCookie(userid, false);
                    System.Web.HttpContext.Current.Response.Redirect(System.Web.HttpContext.Current.Request.ApplicationPath + "/" + Enums.Constants.DefaultUrl);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 29
0
        public void SaveMenuTreeXML(string path)
        {
            XmlElement  root;
            XmlDocument doc = GlobalFacade.XDom.GenXmlDocument("TREENODES", out root);
            BusinessObjectCollection MenuCollection = new BusinessObjectCollection("Menu");

            MenuCollection.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("Menu");

            filter.AddFilterItem("Parent", "0", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            MenuCollection.AddFilter(filter);
            /* Andy Modify 2007-04-26 Add Order By */
            MenuCollection.Businessobject.OrderBy = "ORDER BY [DisplayOrder] ASC";
            DataTable childtable = MenuCollection.GetDataTable();

            SaveElement(doc, root, childtable);
            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            path = path + "\\" + this.rolepkid.ToString() + ".xml";
            doc.Save(path);
        }
Esempio n. 30
0
        private void btnDel_Click(object sender, ImageClickEventArgs e)
        {
            string PKID;
            int    selectedIndex = -1;

            foreach (DataGridItem item in this.dgUser.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    if (((System.Web.UI.WebControls.RadioButton)item.Cells[0].Controls[1]).Checked)
                    {
                        selectedIndex = item.ItemIndex;
                        break;
                    }
                }
            }

            if (selectedIndex != -1)
            {
                PKID = this.dgUser.Items[selectedIndex].Cells[1].Text;
                Wicresoft.Session.Session session = new Wicresoft.Session.Session();
                BusinessMapping.User      bo      = new BusinessMapping.User();
                bo.SessionInstance = session;

                BusinessFilter filter = new BusinessFilter("User");
                filter.AddFilterItem("PKID", PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                bo.AddFilter(filter);
                bo.Load();

                if (bo.IsReserved.Value)
                {
                    GlobalFacade.Utils.ShowMessage(Enums.Constants.RecordReserved);
                }
                else
                {
                    bo.ModifyUser.Value = this.MyContext.UserID;
                    bo.ModifyTime.Value = DateTime.Now;
                    bo.IsValid.Value    = false;
                    bo.Update();

                    //BusinessRule.SystemManage.OperationLog rule = new BusinessRule.SystemManage.OperationLog();
                    //rule.WriteOperationLog("用户信息管理", "删除用户信息");

                    // Reload Data
                    ucCustomPaging.LoadData(ucCustomPaging.CurrentPage);
                }
            }
        }