private void AllocateItem(string type, string inc) { if (!IsExistItem(type, inc) && Prj.AddItem(type, inc)) { allocatedItems.Add(type); log.LogMessage(MessageImportance.Low, Resources.Allocated_item_0_1, type, inc); } }
public void DoDelete() { Prj prj = new Prj(this.FK_Prj); AtPara ap = new AtPara(prj.Files); string file = ap.GetValStrByKey(this.IDX.ToString()); File.Delete(file); this.WinClose(); }
public void DoDown() { Prj prj = new Prj(this.FK_Prj); AtPara ap = new AtPara(prj.Files); string file = ap.GetValStrByKey(this.IDX.ToString()); FileInfo fi = new FileInfo(file); BP.PubClass.DownloadFile(fi.FullName, fi.Name); this.WinClose(); }
void Dispose(bool _) { if (disposed) { return; } disposed = true; allocatedItems?.ForEach(t => Prj.GetItems(t).ToArray().ForEach(i => Prj.RemoveItem(i))); _sln.Dispose(); }
protected void TEST() { SBMObjectList <Project> PrjLst = null; AppObjectList <CalendarWeek> CalWkLst; Project Prj; Category Cat; LineItem LnItem; CostCenter CosCen; CalendarWeek CalWk; SBMObjectList <Planning> PlnLst = null; Planning Pln; PlanningRate PlnRat; object objVal; Application.GetCategories(); PrjLst = Application.GetProjects(); for (int nPrjIdx = 0; nPrjIdx < PrjLst.Count; nPrjIdx++) { Prj = PrjLst[nPrjIdx]; Cat = Prj.GetCategory(); LnItem = Prj.GetLineItem(); CosCen = Prj.GetCostCenter(); if (Prj.GetNumber() == 500097) { PlnLst = Prj.GetPlannings(); for (int nPlnIdx = 0; nPlnIdx < PlnLst.Count; nPlnIdx++) { Pln = PlnLst[nPlnIdx]; for (int nRatIdx = 0; nRatIdx < Pln.GetPlanningRates().Count; nRatIdx++) { PlnRat = Pln.GetPlanningRates().GetAt(nRatIdx); CalWk = PlnRat.GetCalendarWeek(); } } } } CalWkLst = Application.GetCalendar().GetCalendarWeeks(); for (int nIdx = 0; nIdx < CalWkLst.Count; nIdx++) { CalWk = CalWkLst[nIdx]; objVal = CalWk.FirstDay; objVal = CalWk.LastDay; objVal = CalWk.OrderIndex; } }
protected void Page_Load(object sender, EventArgs e) { Prj prj = new Prj(this.RefNo); this.Pub1.AddTable("width='80%'"); this.Pub1.AddCaptionLeft(prj.Name + " - 成员岗位设置"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("IDX"); this.Pub1.AddTDTitle("人员"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("现有岗位"); this.Pub1.AddTDTitle("编辑岗位"); this.Pub1.AddTDTitle("移出"); this.Pub1.AddTREnd(); EmpPrjs emps = new EmpPrjs(); emps.Retrieve(EmpPrjAttr.FK_Prj, this.RefNo); int idx = 1; foreach (EmpPrj emp in emps) { this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD(emp.FK_Emp); this.Pub1.AddTD(emp.FK_EmpT); EmpPrjStations stas = new EmpPrjStations(); stas.Retrieve(EmpPrjStationAttr.FK_EmpPrj, this.RefNo + "_" + emp.FK_Emp); string str = ""; foreach (EmpPrjStation sta in stas) { str += sta.FK_StationT + ";"; } if (str == "") { str = "无"; } this.Pub1.AddTD(str); this.Pub1.AddTD("<a href=''>编辑</a>"); this.Pub1.AddTD("移出"); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
void btn_Upload_Click(object sender, EventArgs e) { System.Web.UI.WebControls.FileUpload fu = this.Pub1.FindControl("file") as System.Web.UI.WebControls.FileUpload; if (fu.HasFile == false || fu.FileName.Length <= 2) { this.Alert("请选择上传的文件."); return; } Prj prj = new Prj(this.FK_Prj); AtPara ap = new AtPara(prj.Files); string file = ap.GetValStrByKey(this.IDX.ToString()); try { fu.SaveAs(file); } catch { string root = BP.SystemConfig.PathOfDataUser + "\\PrjData\\Templete\\" + this.FK_Prj; string rootData = BP.SystemConfig.PathOfDataUser + "\\PrjData\\Data\\" + this.FK_Prj; if (Directory.Exists(rootData) == false) { Directory.CreateDirectory(rootData); } string[] strs = System.IO.Directory.GetDirectories(root); foreach (string str in strs) { DirectoryInfo info = new DirectoryInfo(str); if (Directory.Exists(rootData + "\\" + info.Name) == false) { Directory.CreateDirectory(rootData + "\\" + info.Name); } } fu.SaveAs(file); } this.WinClose(); }
protected void Page_Load(object sender, EventArgs e) { switch (this.DoType) { case "Upload": this.BindUpload(); return; case "DoDown": this.DoDown(); return; case "DoDelete": this.DoDelete(); return; default: break; } NodeAccesss nrs = new NodeAccesss(); nrs.Retrieve(NodeAccessAttr.FK_Node, this.FK_Node, NodeAccessAttr.FK_Prj, this.FK_Prj); string root = BP.SystemConfig.PathOfDataUser + "\\PrjData\\Templete\\" + this.FK_Prj; string rootData = BP.SystemConfig.PathOfDataUser + "\\PrjData\\Data\\" + this.FK_Prj; Prj prj = new Prj(this.FK_Prj); this.Pub1.AddTable(); this.Pub1.AddCaptionLeft("项目目录树:" + prj.Name); this.Pub1.AddTR(); this.Pub1.AddTDTitle("IDX"); this.Pub1.AddTDTitle("目录"); this.Pub1.AddTDTitle("文件"); this.Pub1.AddTDTitle("操作"); this.Pub1.AddTREnd(); string MyFiles = ""; int idx = 1; string[] strs = System.IO.Directory.GetDirectories(root); foreach (string str in strs) { DirectoryInfo dir = new DirectoryInfo(str); FileInfo[] fils = dir.GetFiles(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("<img src='./../Images/Btn/open.gif'>" + dir.Name); this.Pub1.AddTD("文件:" + fils.Length); this.Pub1.AddTD(); this.Pub1.AddTREnd(); foreach (FileInfo info in fils) { NodeAccess nr = nrs.GetEntityByKey(NodeAccessAttr.FileFullName, info.FullName) as NodeAccess; if (nr == null) { nr = new NodeAccess(); } if (nr.IsView == false) { idx++; continue; } this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD(); this.Pub1.AddTDB("<img src='./../Images/FileType/" + info.Extension.Replace(".", "") + ".gif'>" + info.Name); string relFile = rootData + "\\" + dir.Name + "\\" + info.Name; MyFiles += "@" + idx + "=" + relFile; if (File.Exists(relFile) == true) { string msg = ""; if (nr.IsDown) { msg += "[<a href=\"javascript:DoDown('" + this.FK_Prj + "','" + idx + "');\" ><img src='../Images/Btn/Save.gif' border=0/>下载</a>]"; } if (nr.IsDelete) { msg += "[<a href=\"javascript:DoDelete('" + this.FK_Prj + "','" + idx + "');\" ><img src='../Images/Btn/Delete.gif' border=0/>删除</a>]"; } if (nr.IsUpload) { msg += "[<a href=\"javascript:Upload('" + this.FK_Prj + "','" + idx + "');\" ><img src='../Images/Btn/ApplyTask.gif' border=0/>重新上传</a>]"; } this.Pub1.AddTD(msg); } else { if (nr.IsUpload) { this.Pub1.AddTD("<a href=\"javascript:Upload('" + this.FK_Prj + "','" + idx + "')\"><img src='../Images/Btn/ApplyTask.gif' border=0/>上传</a>"); } else { this.Pub1.AddTD(); } } this.Pub1.AddTREnd(); } } this.Pub1.AddTableEnd(); prj.Files = MyFiles; prj.Update(); }
public MainWindow() { InitializeComponent(); this.Width = 800; this.Height = 600; //=_=|| Tab.ApplyTemplate(); TabPanel panel = Tab.Template.FindName("HeaderPanel", Tab) as TabPanel; panel.SetBinding(TabPanel.IsEnabledProperty, new Binding() { Path = new PropertyPath(EnabledNavigationProperty), Source = this }); menu = FindResource("dropMenu") as ContextMenu; menu.PlacementTarget = drop; menu.Placement = PlacementMode.Bottom; (menu.Items[0] as MenuItem).Click += DbViewer_Click; (menu.Items[1] as MenuItem).Click += StackDecoder_Click; (menu.Items[2] as MenuItem).Click += About_Click; IPage page; page = new Asms(); page.Init(this); Tab.Items.Add(page); page = new Settings(); page.Init(this); Tab.Items.Add(page); page = new Rules(); page.Init(this); Tab.Items.Add(page); page = new Progress(); page.Init(this); Tab.Items.Add(page); Project = new Prj(); foreach (ConfuserTab i in Tab.Items) i.InitProj(); Project.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); ProjectChanged(Project, new PropertyChangedEventArgs("")); }
private void Open_Click(object sender, RoutedEventArgs e) { if (Project.IsModified) { switch (MessageBox.Show( "You have unsaved changes in this project!\r\nDo you want to save them?", "Confuser", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: Save_Click(this, new RoutedEventArgs()); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: return; } } OpenFileDialog sfd = new OpenFileDialog(); sfd.Filter = "Confuser Project (*.crproj)|*.crproj|All Files (*.*)|*.*"; if (sfd.ShowDialog() ?? false) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(sfd.FileName); ConfuserProject proj = new ConfuserProject(); proj.Load(xmlDoc); Prj prj = new Prj(); prj.FromConfuserProject(proj); prj.FileName = sfd.FileName; Project = prj; foreach (ConfuserTab i in Tab.Items) i.InitProj(); prj.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); prj.IsModified = false; ProjectChanged(Project, new PropertyChangedEventArgs("")); Tab.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(string.Format( @"Invalid project file! Message : {0} Stack Trace : {1}", ex.Message, ex.StackTrace), "Confuser", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void New_Click(object sender, RoutedEventArgs e) { if (Project.IsModified) { switch (MessageBox.Show( "You have unsaved changes in this project!\r\nDo you want to save them?", "Confuser", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: Save_Click(this, new RoutedEventArgs()); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: return; } } Project = new Prj(); foreach (ConfuserTab i in Tab.Items) i.InitProj(); Project = new Prj(); foreach (ConfuserTab i in Tab.Items) i.InitProj(); Project.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); ProjectChanged(Project, new PropertyChangedEventArgs("")); Tab.SelectedIndex = 0; }
public void LoadPrj(string path) { if (Project.IsModified) { switch (MessageBox.Show( "You have unsaved changes in this project!\r\nDo you want to save them?", "Confuser", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: Save_Click(this, new RoutedEventArgs()); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: return; } } try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(path); ConfuserProject proj = new ConfuserProject(); proj.Load(xmlDoc); Prj prj = new Prj(); prj.FileName = path; prj.FromConfuserProject(proj); Project = prj; foreach (ConfuserTab i in Tab.Items) i.InitProj(); prj.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); prj.IsModified = false; ProjectChanged(Project, new PropertyChangedEventArgs("")); Tab.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(string.Format( @"Invalid project file! Message : {0} Stack Trace : {1}", ex.Message, ex.StackTrace), "Confuser", MessageBoxButton.OK, MessageBoxImage.Error); } }
private bool IsExistItem(string type, string inc) => Prj.GetItem(type, inc).parentProject != null;
/// <summary> /// </summary> /// <returns></returns> public static ArrayList GetListProjectsByListId(ArrayList alPrjs) { ArrayList _List = new ArrayList(); foreach (int iPrjId in alPrjs) { Prj _p = new Prj(); using (IDataReader reader = Project.GetProject(iPrjId)) { if (reader.Read()) { _p.ProjectId = iPrjId; _p.Title = reader["Title"].ToString(); _p.ManagerId = (int)reader["ManagerId"]; _p.StatusId = (int)reader["StatusId"]; _p.StatusName = reader["StatusName"].ToString(); _p.TypeId = (int)reader["TypeId"]; _p.TypeName = reader["TypeName"].ToString(); _p.Budget = 0; } } using (IDataReader reader = User.GetUserInfo(_p.ManagerId)) { if (reader.Read()) _p.ManagerName = reader["FirstName"].ToString() + " " + reader["LastName"].ToString(); } Hashtable htGenCats = new Hashtable(); using (IDataReader reader = Project.GetListCategories(iPrjId)) { while (reader.Read()) htGenCats.Add((int)reader["CategoryId"], reader["CategoryName"].ToString()); } _p.GeneralCategories = htGenCats; Hashtable htPrjCats = new Hashtable(); using (IDataReader reader = Project.GetListProjectCategoriesByProject(iPrjId)) { while (reader.Read()) htPrjCats.Add((int)reader["CategoryId"], reader["CategoryName"].ToString()); } _p.ProjectCategories = htPrjCats; _List.Add(_p); } return _List; }