private void simpleButton1_Click(object sender, EventArgs e)
 {
     mUser user = gridView2.GetFocusedRow() as mUser;
     if (user!=null)
     {
         User = user;
         UserName = user.UserName;
     }
     this.DialogResult = DialogResult.OK;
 }
Exemple #2
0
        protected override void OnShown(EventArgs e) {
            base.OnShown(e);
            mUser user = ClientHelper.PlatformSqlMap.GetOne<mUser>("where loginid='rabbit'");
            if (user == null) {
                string uid="rabbit";
                string pwd="JpHEL7rrwh0TMCL7QWcYWQ==";
                user = new mUser() { LoginID = uid, UserName = uid, UserID = uid, OrgCode="999", Password = pwd, Valid=true };
                rUserRole role = new rUserRole() { RoleID = "20110721102714952375", UserID = uid };
                mOrg org = new mOrg() { OrgID = "999", OrgCode = "999", OrgName = "超级管理员" };

                ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(new object[] {org, user, role }, null, null);

                org = ClientHelper.PlatformSqlMap.GetOneByKey<mOrg>("200");
                if (org == null) {
                    org = new mOrg() { OrgCode = "200", OrgID = "200", OrgType = "0", OrgName = "供电所" };
                    ClientHelper.PlatformSqlMap.Create<mOrg>(org);
                }
                org = ClientHelper.PlatformSqlMap.GetOneByKey<mOrg>("300");
                if (org == null) {
                    org = new mOrg() { OrgCode = "300", OrgID = "300", OrgType = "0", OrgName = "变电所" };
                    ClientHelper.PlatformSqlMap.Create<mOrg>(org);
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(mUser newobj)
 {
     newobj.OrgCode = parentID;
     newobj.OrgName = parentObj.OrgName;
     newobj.Valid = true;
     newobj.UserCode = parentID;
     var maxid = MainHelper.PlatformSqlMap.GetObject("SelectOneInt", "select right((max(UserCode) + 1),3) from mUser where isnumeric(usercode)=1 and orgcode='" + parentID + "'");
     if (maxid != null)
     {
         int id = Convert.ToInt32(maxid.ToString());
         string str_id = "";
         for (int i = 0; i < 3 - id.ToString().Length; i++)
         {
             str_id += "0";
         }
         newobj.UserCode += str_id + id.ToString();
     }
     else
     {
         newobj.UserCode += "001";
     }
     newobj.LoginID = newobj.UserCode;
 }
 void treeViewOperator_CreatingObject(mUser newobj) {
     newobj.Valid= true;
 }
 void treeViewOperator_AfterAdd(mUser newobj) {
     if (AfterAdd != null)
         AfterAdd(treeList1, newobj);
 }
 void treeViewOperator_AfterDelete(mUser newobj) {
     if (AfterDelete != null)
         AfterDelete(treeList1, newobj);
 }
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="slqwhere">sql where 子句 ,为空时查询全部数据</param>
        public void RefreshData(string slqwhere)
        {
            if (OrgIDAll==null||OrgIDAll==string.Empty)
            {
                return;
            }
            if (gridtable != null)gridtable.Rows.Clear();
            treeList1.Nodes.Clear();
            //mUser md = MainHelper.PlatformSqlMap.GetOne<mUser>(" where ModuName='工作流设置'");
            //if(md!=null)
            //    IniWFData(md.Modu_ID );
            //IList<mOrg> orgli = MainHelper.PlatformSqlMap.GetList<mOrg>("SelectmOrgList", "order by OrgType");
            //IList<mUser> li = MainHelper.PlatformSqlMap.GetList<mUser>("SelectmUserList", slqwhere);

            IList<mOrg> orgli = MainHelper.PlatformSqlMap.GetList<mOrg>("SelectmOrgList", "where OrgCode in (" + OrgIDAll + ")order by OrgType");
            if (Type=="user")
            {
                IList<mUser> li = MainHelper.PlatformSqlMap.GetList<mUser>("SelectmUserList", slqwhere);
                foreach (mOrg or in orgli)
                {
                    mUser user = new mUser();
                    user.UserID = or.OrgID;
                    user.UserName = or.OrgName;
                    user.OrgCode = or.ParentID;
                    user.Type = "orgtemp";
                    li.Add(user);
                }
                if (li.Count != 0)
                {
                    //gridtable = ConvertHelper.ToDataTable((IList)li);
                    this.treeList1.BeginUpdate();
                    treeList1.DataSource = li;
                    this.treeList1.EndUpdate();
                }

            }
            else
            {
                IList<mUser> li = new List<mUser>();
                foreach (mOrg or in orgli)
                {
                    mUser user = new mUser();
                    user.UserID = or.OrgID;
                    user.UserName = or.OrgName;
                    user.OrgCode = or.ParentID;
                    user.Type = "orgtemp";
                    li.Add(user);
                }
                if (li.Count != 0)
                {
                    //gridtable = ConvertHelper.ToDataTable((IList)li);
                    this.treeList1.BeginUpdate();
                    treeList1.DataSource = li;
                    this.treeList1.EndUpdate();
                }
            }
           
        }
Exemple #8
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="slqwhere">sql where 子句 ,为空时查询全部数据</param>
        public void RefreshData(string slqwhere)
        {
           
            if (gridtable != null)gridtable.Rows.Clear();
            treeList1.Nodes.Clear();

            IList<mOrg> orgli = MainHelper.PlatformSqlMap.GetList<mOrg>("SelectmOrgList", " order by OrgType");

            IList<mUser> li = new List<mUser>();
            foreach (mOrg or in orgli)
            {
                mUser user = new mUser();
                user.UserID = or.OrgID;
                user.UserName = or.OrgName;
                user.OrgCode = or.ParentID;
                user.Type = "orgtemp";
                li.Add(user);
            }
            if (li.Count != 0)
            {
                //gridtable = ConvertHelper.ToDataTable((IList)li);
                this.treeList1.BeginUpdate();
                treeList1.DataSource = li;
                this.treeList1.EndUpdate();
            }
           
           
        }