Пример #1
0
 void btnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.txtDepName.Text) && !string.IsNullOrEmpty(this.txtDepCode.Text))
     {
         using (MMSProDBDataContext db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString))
         //   using (MMSProDBDataContext db = new MMSProDBDataContext(@"Data Source=192.168.1.199;Initial Catalog=MMS;User ID=sa;Password=111qqq..." providerName="System.Data.SqlClient"))
         {
             var temp = db.DepInfo.SingleOrDefault(a => a.DepCode == this.txtDepCode.Text.Trim());
             if (temp == null)
             {
                 DepInfo di = new DepInfo();
                 di.DepName  = this.txtDepName.Text.Trim();
                 di.DepCode  = this.txtDepCode.Text.Trim();
                 di.Contact  = this.txtDepContact.Text.Trim();
                 di.InCharge = this.txtDepInCharge.Text.Trim();
                 di.Remark   = this.txtRemark.Text.Trim();
                 db.DepInfo.InsertOnSubmit(di);
                 db.SubmitChanges();
                 Response.Redirect("DepManager.aspx");
             }
             else
             {
                 ClientScript.RegisterClientScriptBlock(typeof(string), "ShowMessage", "<script>alert('部门编码重复请更改')</script>");
             }
         }
     }
 }
Пример #2
0
        public JsonResult List(DepInfo filter)
        {
            List <DepInfo> list = new List <DepInfo>();

            for (int i = 0; i < 100; i++)
            {
                list.Add(new DepInfo
                {
                    ID           = 1,
                    ChannelCode  = "Dep" + i,
                    ChannelStyle = "部門代號" + i,
                    CnName       = "中文描述" + i,
                    EnName       = "E-Decription" + i,
                    Status       = "1"
                });
            }
            if (!string.IsNullOrEmpty(filter.ChannelCode))
            {
                list = list.Where(x => x.ChannelCode == filter.ChannelCode.Trim()).ToList();
            }
            if (!string.IsNullOrEmpty(filter.CnName))
            {
                list = list.Where(x => x.CnName == filter.CnName.Trim()).ToList();
            }
            if (!string.IsNullOrEmpty(filter.EnName))
            {
                list = list.Where(x => x.EnName == filter.EnName.Trim()).ToList();
            }

            //构造成Json的格式传递
            var result = new { iTotalRecords = 1100, iTotalDisplayRecords = 10, data = list };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        private void add_btn_Click(object sender, EventArgs e)
        {
            if (new_dep_txb.Text != "")
            {
                DepInfo de = new DepInfo(new_dep_txb.Text);

                if (DepAdd != null)
                {
                    DepAdd(de, null);
                }
                DepViewItem dvi = new DepViewItem();
                dvi.DepNameChanged += Dvi_DepNameChanged;
                dvi.DepDeleted     += Dvi_DepDeleted;
                if (panel.Controls.Count > 0)
                {
                    dvi.Location = new Point(0, panel.Controls[panel.Controls.Count - 1].Location.Y + 36);
                }
                else
                {
                    dvi.Location = new Point(0, 0);
                }
                dvi.Dep    = de;
                dvi.Width  = panel.Width;
                dvi.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

                panel.Controls.Add(dvi);
                if (m_DepList == null)
                {
                    m_DepList = new List <DepInfo>();
                }
                m_DepList.Add(de);
                new_dep_txb.Text = "";
            }
        }
Пример #4
0
        /// <summary>
        /// 递归获取任意部门
        /// </summary>
        /// <param name="parentOU">父OU</param>
        protected void GetChildOU(DirectoryOrganizationalUnit parentOU)
        {
            var     childOUs = ous.Where(u => u.ParentGuid == parentOU.Guid);
            DepInfo di;

            if (childOUs != null && childOUs.Count() > 0)
            {
                foreach (var childOU in childOUs)
                {
                    using (MMSProDBDataContext db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString))
                    {
                        using (DirectoryContext dc = new DirectoryContext(this._domainName, this._adminOfDC, this._pwdOfDC))
                        {
                            var tempDep = db.DepInfo.SingleOrDefault(u => u.DepName == childOU.Name);
                            if (tempDep == null)
                            {
                                di          = new DepInfo();
                                di.DepName  = childOU.Name;
                                di.DepCode  = childOU.Guid.ToString();
                                di.InCharge = "";
                                di.Contact  = "";
                                di.Remark   = "";
                                db.DepInfo.InsertOnSubmit(di);
                                db.SubmitChanges();
                            }
                        }
                    }
                    GetChildOU(childOU);
                }
            }
        }
Пример #5
0
        ArrayList AddSubprops(XmlNodeList nodes, ItemGroup group, ClassDescriptor klass)
        {
            ArrayList list = null;

            // Sub-properties can have a name+value (which checks for the value of a
            // property) or a method name, which should return true if the item has
            // to be disabled/hidden.

            foreach (XmlElement elem in nodes)
            {
                string name = elem.GetAttribute("name");
                if (name.Length > 0)
                {
                    string value = elem.GetAttribute("value");

                    PropertyDescriptor prop = (PropertyDescriptor)group[name];
                    if (prop == null)
                    {
                        prop = (PropertyDescriptor)klass[name];
                    }
                    if (prop == null)
                    {
                        throw new ArgumentException("Bad sub-prop " + name);
                    }
                    if (list == null)
                    {
                        list = new ArrayList();
                    }

                    DepInfo info = new DepInfo();
                    info.Property = prop;
                    info.Value    = prop.StringToValue(value);
                    list.Add(info);
                }
                else if ((name = elem.GetAttribute("check")).Length > 0)
                {
                    DepInfo info = new DepInfo();
                    info.CheckName = name;
                    if (list == null)
                    {
                        list = new ArrayList();
                    }
                    list.Add(info);
                }
                else
                {
                    throw new ArgumentException("Bad sub-prop");
                }
            }
            return(list);
        }
Пример #6
0
 void InsertRow()
 {
     using (MMSProDBDataContext db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString))
     {
         DepInfo di = db.DepInfo.SingleOrDefault(a => a.DepID == int.Parse(Request.QueryString["DepID"]));
         if (di != null)
         {
             di.DepName  = this.txtDepName.Text.Trim();
             di.DepCode  = this.txtDepCode.Text.Trim();
             di.Contact  = this.txtDepContact.Text.Trim();
             di.InCharge = this.txtDepInCharge.Text.Trim();
             di.Remark   = this.txtRemark.Text.Trim();
             db.SubmitChanges();
             Response.Redirect("DepManager.aspx");
         }
     }
 }
Пример #7
0
        private void refresh_btn_Click(object sender, EventArgs e)
        {
            List <object[]> obj_arr  = DataBase.SelectQuery("select id, depInfo from departments;", m_Cfg.DbConnectionString);
            List <DepInfo>  dep_list = new List <DepInfo>();

            foreach (object[] obj in obj_arr)
            {
                MemoryStream ms = new MemoryStream();

                ms.Write(((byte[])obj[1]), 0, ((byte[])obj[1]).Length);
                ms.Position = 0;
                BinaryFormatter bf  = new BinaryFormatter();
                DepInfo         dep = (DepInfo)bf.Deserialize(ms);
                dep.Id_InDb = (int)obj[0];
                dep_list.Add(dep);
            }
            depView.DepList = dep_list;
        }
Пример #8
0
 private static void collectDep(string asset, string bundle, Dictionary <string, DepInfo> depasset2bundles,
                                Dictionary <string, string> asset2bundle)
 {
     foreach (var depasset in AssetDatabase.GetDependencies(asset, false))
     {
         if (!depasset.EndsWith(".cs") && !depasset.Equals(asset) && !asset2bundle.ContainsKey(depasset))
         {
             DepInfo res;
             if (depasset2bundles.TryGetValue(depasset, out res))
             {
                 res.containingABs.Add(bundle);
             }
             else
             {
                 res = new DepInfo();
                 res.containingABs.Add(bundle);
                 depasset2bundles.Add(depasset, res);
             }
             collectDep(depasset, bundle, depasset2bundles, asset2bundle);
         }
     }
 }
Пример #9
0
        private static void collectDep(string asset, string bundle, int depth)
        {
            /*
             * if (depth == 0)
             * {
             *  Debug.Log(asset + " --- " + bundle);
             * }
             * else if (depth < 10)
             * {
             *  string res = "";
             *  for (int i = 0; i < depth; i++)
             *  {
             *      res += "    ";
             *  }
             *  Debug.Log(res + asset);
             * }
             */

            foreach (var depasset in AssetDatabase.GetDependencies(asset, false))
            {
                if (!depasset.EndsWith(".cs") && !asset2bundle.ContainsKey(depasset))
                {
                    DepInfo res;
                    if (depasset2bundles.TryGetValue(depasset, out res))
                    {
                        res.containingABs.Add(bundle);
                    }
                    else
                    {
                        res = new DepInfo();
                        res.containingABs.Add(bundle);
                        depasset2bundles.Add(depasset, res);
                    }
                    collectDep(depasset, bundle, depth + 1);
                }
            }
        }
Пример #10
0
		ArrayList AddSubprops (XmlNodeList nodes, ItemGroup group, ClassDescriptor klass)
		{
			ArrayList list = null;
			
			// Sub-properties can have a name+value (which checks for the value of a
			// property) or a method name, which should return true if the item has
			// to be disabled/hidden.

			foreach (XmlElement elem in nodes) {
				string name = elem.GetAttribute ("name");
				if (name.Length > 0) {
					string value = elem.GetAttribute ("value");

					PropertyDescriptor prop = (PropertyDescriptor)group[name];
					if (prop == null)
						prop = (PropertyDescriptor)klass[name];
					if (prop == null)
						throw new ArgumentException ("Bad sub-prop " + name);
					if (list == null)
						list = new ArrayList ();
						
					DepInfo info = new DepInfo ();
					info.Property = prop;
					info.Value = prop.StringToValue (value);
					list.Add (info);
				} else if ((name = elem.GetAttribute ("check")).Length > 0) {
					DepInfo info = new DepInfo ();
					info.CheckName = name;
					if (list == null)
						list = new ArrayList ();
					list.Add (info);
				} else {
					throw new ArgumentException ("Bad sub-prop");
				}
			}
			return list;
		}
Пример #11
0
        private void BindData()
        {
            int intID = 0;

            if (int.TryParse(Request.QueryString["DepID"], out intID))
            {
                using (MMSProDBDataContext db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString))
                {
                    DepInfo di = db.DepInfo.SingleOrDefault(a => a.DepID == intID);
                    if (di != null)
                    {
                        this.txtDepName.Text     = di.DepName;
                        this.txtRemark.Text      = di.Remark;
                        this.txtDepCode.Text     = di.DepCode;
                        this.txtDepContact.Text  = di.Contact;
                        this.txtDepInCharge.Text = di.InCharge;
                    }
                }
            }
            else
            {
                Response.Redirect("DepManager.aspx");
            }
        }
Пример #12
0
 public OutputMessage Append(Dependency dep, DepInfo info)
 {
     elements.Add(new Element(dep, info));
     return this;
 }
Пример #13
0
 public Element(Dependency dependendcy, DepInfo depInfo)
 {
     Dependendcy = dependendcy;
     DepInfo = depInfo;
 }