protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); foreach (Control control in Controls) { if (regForm == null) { regForm = control as HtmlForm; if (regForm != null) break; } } if (regForm == null) { throw new ArgumentException("登录页面中至少添加一个服务器端表单"); } window = new Window(); window.Title = "管理员注册"; window.Closable = false; window.Icon = Icon.Key; window.Width = 320; window.Height = 185; formPanel = new FormPanel(); formPanel.BodyStyle = "padding:20px;"; formPanel.Layout = "table"; formPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); formPanel.Items.Add(new TextField() { FieldLabel = "用户名", AllowBlank = false, ColSpan = 2, Name = "Username" }); formPanel.Items.Add(new TextField() { FieldLabel = "密码", AllowBlank = false, ColSpan = 2, InputType = Ext.Net.InputType.Password, Name = "Password" }); formPanel.Items.Add(new TextField() { FieldLabel = "确认密码", AllowBlank = false, ColSpan = 1, InputType = Ext.Net.InputType.Password, Name = "Password2" }); window.Items.Add(formPanel); regForm.Controls.Add(window); btnReg = new KeyAddButton(); btnReg.Text = "注册"; btnReg.ID = "btnReg"; btnReg.OnClientClick = "App.direct.Reg({eventMask:{showMask:true,msg:'正在注册'}});"; window.Buttons.Add(btnReg); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); _formPanel = new FormPanel(); _formPanel.BodyPadding = 10; _formPanel.Layout = "table"; _formPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); _formPanel.ID = "addForm"; _formPanel.DefaultAnchor = "100%"; _txtUsername = new TextField(); _txtUsername.ID = "txtUsername"; _txtUsername.Name = "Username"; _txtUsername.ColSpan = 1; _txtUsername.Width = 300; _txtUsername.AllowBlank = false; _txtUsername.FieldLabel = "用户名"; _txtUsername.EmptyText = "输入用户名"; _formPanel.Add(_txtUsername); _comboStatus = new ComboBox(); _comboStatus.EmptyText = "选择状态"; _comboStatusStore = new Store(); _comboStatusStore.ID = "comboStoreStatus"; _comboStatusStore.Model.Add(ComponentHelper.GetModel( new Dictionary<string, ModelFieldType>(){ {"Id",ModelFieldType.Int},{"Name",ModelFieldType.String} })); _comboStatus.ValueHiddenName = "Status"; _comboStatus.SimpleSubmit = true; _comboStatus.DisplayField = "Name"; _comboStatus.ValueField = "Id"; _comboStatus.Store.Add(_comboStatusStore); _comboStatus.FieldLabel = "状态"; _comboStatus.Editable = false; _formPanel.Add(_comboStatus); _txtMemo = new TextArea(); _txtMemo.Width = 750; _txtMemo.Name = "Description"; _txtMemo.ColSpan = 2; _txtMemo.FieldLabel = "描述"; _txtMemo.Height = 80; _formPanel.Add(_txtMemo); _treeRoleSelector = new TreePanelNodeMover(); _treeRoleSelector.LeftReadData += _treeRoleSelector_LeftReadData; //_treeRoleSelector.RightReadData += _treeRoleSelector_RightReadData; _treeRoleSelector.Height = 180; _treeRoleSelector.Width = 750; _treeRoleSelector.ColSpan = 2; _treeRoleSelector.ID = "treeRoles"; _formPanel.Add(_treeRoleSelector); _btnAdd = new Button(); _btnAdd.Text = "添加"; _btnAdd.Icon = Icon.Add; _btnAdd.DirectEvents.Click.Event += AddUser; _btnAdd.DirectEvents.Click.EventMask.Set("正在添加"); _formPanel.Buttons.Add(_btnAdd); MainForm.Controls.Add(_formPanel); }
/// <summary> /// Load thanh menu ngang /// </summary> private void LoadTopMenu() { List <MenuInfo> MenuPanelList = MenuController.GetInstance().GetMenus(-1, false, true, CurrentUser.ID).OrderByDescending(p => p.Order).ToList(); foreach (MenuInfo item in MenuPanelList) { Ext.Net.Button btn = new Ext.Net.Button(item.MenuName.ToUpper()); btn.ID = "mnu" + item.ID; // btn.IconCls = item.Icon; Toolbar1.Items.Insert(0, btn); LoadSubTopMenu(btn, item); } Ext.Net.ImageButton btnLogo = new Ext.Net.ImageButton(); btnLogo.ImageUrl = "Resource/images/logo.png"; btnLogo.OverImageUrl = "Resource/images/logoHover.png"; Toolbar1.Items.Insert(0, btnLogo); Ext.Net.Label lblApplication = new Ext.Net.Label(); lblApplication.Html = "<b style='color:#15428B !important;font-family:verdana !important;'>" + ltrApplicationName.Text.ToUpper() + "</b>"; Toolbar1.Items.Insert(1, lblApplication); Toolbar1.Items.Insert(1, new ToolbarSpacer() { ID = "tbspacer", Width = 5 }); }
protected void btnEdit_Click(object sender, EventArgs e) { Ext.Net.Button bb = (Ext.Net.Button)sender; string sID = this.txtNODE_ID.Text; string sTEXT = this.txtNODE_TEXT.Text; if (sID.Substring(1, 1) != "_") { //修改 switch (sID.Substring(0, 1)) { case "A": this.Panel1.Loader.SuspendScripting(); this.Panel1.Loader.Url = "./Dialysis_05_01.aspx?editmode=edit&editmode2=edit&sel_info_date=" + sTEXT; this.Panel1.Loader.DisableCaching = true; this.Panel1.LoadContent(); break; case "B": this.Panel1.Loader.SuspendScripting(); this.Panel1.Loader.Url = "./Dialysis_05_02.aspx?editmode=edit&editmode2=edit&sel_info_date=" + sTEXT; this.Panel1.Loader.DisableCaching = true; this.Panel1.LoadContent(); break; } } }
protected void btnPrint_Click(object sender, EventArgs e) { Ext.Net.Button bb = (Ext.Net.Button)sender; string sID = this.txtNODE_ID.Text; string sTEXT = this.txtNODE_TEXT.Text; if (sID.Substring(1, 1) != "_") { //打印 switch (sID.Substring(0, 1)) { case "A": this.Panel1.Loader.SuspendScripting(); this.Panel1.Loader.Url = "../report/Report_Dialysis_h.aspx?_PAT_ID=" + _PAT_ID + "&_INFO_DATE=" + sTEXT + "&_REPORT_NAME=6"; this.Panel1.Loader.DisableCaching = true; this.Panel1.LoadContent(); break; case "B": //this.Panel1.Loader.SuspendScripting(); //this.Panel1.Loader.Url = "./Dialysis_05_02.aspx?editmode=show&sel_info_date=" + sTEXT; //this.Panel1.Loader.DisableCaching = true; //this.Panel1.LoadContent(); break; } } }
private FormPanel AddFormPanel(string bjlx, string title) { FormPanel panel = new FormPanel(); panel.ID = "Panel2_" + bjlx; panel.Title = title + " -- 处理信息"; panel.Frame = true; panel.DefaultAnchor = "100%"; panel.MonitorValid = true; panel.Padding = 5; switch (bjlx) { case "1": case "2": case "3": panel.Items.Add(Bll.CommonExt.AddTextField("TxtRecordId_" + bjlx, "记录编号", false, "请输入记录编号")); panel.Items.Add(Bll.CommonExt.AddTextField("TxtPlateId_" + bjlx, "号牌号码", false, "请输入号牌号码")); panel.Items.Add(Bll.CommonExt.AddComboBox("CmbPlateType_" + bjlx, "号牌种类", "StorePlateType", "选择号牌种类", false)); panel.Items.Add(Bll.CommonExt.AddTextField("TxtDeal_" + bjlx, "处理人员", userName)); panel.Items.Add(Bll.CommonExt.AddTextArea("TxtNotice_" + bjlx, "处理意见")); break; } string butId = "Button_" + bjlx; Ext.Net.Button butsave = CommonExt.AddButton(butId, "信息保存", "TableSave", "AlarmCarDeal.UpdateData('" + bjlx + "')"); panel.Buttons.Add(butsave); panel.Listeners.ClientValidation.Handler = butId + ".setDisabled(!valid);"; return(panel); }
protected void Page_Load(object sender, EventArgs e) { b = this.Button2; this.SetNomModule("Vehicules"); this.PreSchema("Vehicules", "VehiculeId"); string idv = Request.Params.Get("id").ToString(); this.vehiculeid.Text = Request.Params.Get("id").ToString(); // this.codee.Text = idv; string req = "select * from vehicules where vehiculeid=" + Int32.Parse(idv); SqlDataReader s = Select(req); String matri = ""; string codev = ""; if (s.HasRows) { while (s.Read()) { codev = s[2].ToString(); matri = s[1].ToString(); } } s.Close(); string req2 = "select * from vehiculeConf where vehiculeid=" + Int32.Parse(idv); SqlDataReader s2 = Select(req2); if (s2.HasRows) { while (s2.Read()) { this.vitesse.Text = s2[2].ToString(); this.kilometrage.Text = s2[3].ToString(); this.connsomation.Text = s2[4].ToString(); this.dureeMax.Text = s2[5].ToString(); vconf++; } } else { X.Msg.Show(new MessageBoxConfig { Title = "Nouvelle configuration", Message = "Cette vehicule n'est pas encore configurer ", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO }); } s2.Close(); this.matricule.Text = matri; this.codee.Text = codev; this.TextField11.Text = idv; this.TextField12.Text = codev; this.TextField13.Text = matri; }
public static Ext.Net.Button AddButton(string fieldName, string title, string icon, string handler) { Ext.Net.Button but = new Ext.Net.Button(); but.ID = fieldName; but.Text = title; but.Icon = (Icon)Enum.Parse(typeof(Icon), icon, true); but.Listeners.Click.Handler = handler; return(but); }
private void TaoMenuChucNang(string bienkiemtra) { daNguoiDung nd = new daNguoiDung(); DataTable dt = new DataTable(); dt = nd.ThongTinTheoIDNguoiDung(Cl_KetNoi.hamketnoisql(), Guid.Parse(bienkiemtra)); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; string quyenhan = dr["QuyenHan"].ToString(); if (quyenhan == "1") { #region // phân hệ quản trị string url1 = cl_ReadURL.LayDiaChiURL("/QuanLy/DanhSachNguoiDung.aspx?ACCS-_-ADD=" + bienkiemtra + ""); Ext.Net.Button _btn = new Ext.Net.Button(); _btn.Icon = Icon.BookmarkAdd; _btn.Text = "Quản lý người dùng"; _btn.OnClientClick = "addTab123('idmnuItemquanlydanhsachnguoidung','" + url1 + "','Quản lý người dùng');"; ToolbarMenu.Items.Add(_btn); string url2 = cl_ReadURL.LayDiaChiURL("/QuanLy/DanhSachRender.aspx?ACCS-_-ADD=" + bienkiemtra + ""); Ext.Net.Button _btn2 = new Ext.Net.Button(); _btn2.Icon = Icon.BookmarkGo; _btn2.Text = "Quản lý danh sách render"; _btn2.OnClientClick = "addTab123('idmnuItemquanlydanhsachrender','" + url2 + "','Quản lý danh sách render');"; ToolbarMenu.Items.Add(_btn2); #endregion } else { #region // phân hệ người dùng string url3 = cl_ReadURL.LayDiaChiURL("/NoiDung/LayNoiDung.aspx?ACCS-_-ADD=" + bienkiemtra + ""); Ext.Net.Button _btn3 = new Ext.Net.Button(); _btn3.Icon = Icon.BookAdd; _btn3.Text = "Thêm nội dung"; _btn3.OnClientClick = "addTab123('idmnuItemlaynoidung','" + url3 + "','Thêm nội dung');"; ToolbarMenu.Items.Add(_btn3); string url4 = cl_ReadURL.LayDiaChiURL("/NoiDung/DanhSachNoiDung.aspx?ACCS-_-ADD=" + bienkiemtra + ""); Ext.Net.Button _btn4 = new Ext.Net.Button(); _btn4.Icon = Icon.BookMagnify; _btn4.Text = "Danh sách render"; _btn4.OnClientClick = "addTab123('idmnuItemdanhsachrender','" + url4 + "','Danh sách render');"; ToolbarMenu.Items.Add(_btn4); #endregion } Ext.Net.Button _mnuitem = new Ext.Net.Button(); _mnuitem.Text = "Đăng xuất"; _mnuitem.Icon = Icon.ArrowRight; _mnuitem.Handler = "DangXuat_Click"; ToolbarMenu.Items.Add(_mnuitem); } }
/// <summary> /// Load menu con của menu ngang /// </summary> /// <param name="parentComponent"></param> /// <param name="parentMenu"></param> private void LoadSubTopMenu(Component parentComponent, MenuInfo parentMenu) { List <MenuInfo> ChildMenu; // if (CurrentUser.IsSuperUser) ChildMenu = MenuController.GetInstance().GetMenus(parentMenu.ID, false, false); //Lấy các tree nằm trong panel // else // ChildMenu = MenuController.GetInstance().GetMenus(parentMenu.ID, false, false, CurrentUser.ID); if (ChildMenu == null || ChildMenu.Count() == 0) { return; } Ext.Net.Menu menu = new Ext.Net.Menu(); if (parentComponent.InstanceOf.Contains("Button")) { Ext.Net.Button btn = parentComponent as Ext.Net.Button; btn.Menu.Add(menu); } else { Ext.Net.MenuItem menuItem = parentComponent as Ext.Net.MenuItem; menuItem.Menu.Add(menu); } foreach (MenuInfo item in ChildMenu) { Ext.Net.MenuItem mnu = new Ext.Net.MenuItem(item.MenuName); if (string.IsNullOrEmpty(item.Icon)) { mnu.Icon = Icon.BulletBlue; } else { mnu.IconCls = item.Icon; } mnu.ID = item.ID + "mnu"; if (!string.IsNullOrEmpty(item.LinkUrl)) { if (item.LinkUrl.Contains("?") == false) { item.LinkUrl += "?mId=" + item.ID; } else { item.LinkUrl += "&mId=" + item.ID; } mnu.Listeners.Click.Handler = "addTab(#{pnTabPanel},'dm_file" + item.ID + "','" + item.LinkUrl + "', '" + item.TabName + "')"; } menu.Items.Add(mnu); LoadSubTopMenu(mnu, item); } }
public void ShowDialog(int id) { ContentItem contentItem = Engine.Persister.Get(id); var window = new Window { ID = "pageCachingSettings", Title = @"Page Caching Settings", Width = 500, Height = 300, Layout = "fit", Modal = true }; var formPanel = new FormPanel { Padding = 5 }; var formLayout = new FormLayout(); formPanel.ContentControls.Add(formLayout); window.Items.Add(formPanel); var chkEnableCache = new Checkbox { ID = "chkEnableCache", FieldLabel = @"Enable page cache?", LabelSeparator = "", Checked = contentItem.GetPageCachingEnabled() }; formLayout.Anchors.Add(new Anchor(chkEnableCache)); var tmeCacheDuration = new TimeField { ID = "tmeCacheDuration", FieldLabel = @"Cache duration", Width = 80, SelectedTime = contentItem.GetPageCachingDuration() }; formLayout.Anchors.Add(new Anchor(tmeCacheDuration)); Button btnSave = new Button { Text = @"Save" }; window.Buttons.Add(btnSave); btnSave.Listeners.Click.Handler = string.Format( "stbStatusBar.showBusy(); Ext.net.DirectMethods.PageCaching.SavePageCachingSettings({0}, Ext.getCmp('{1}').getValue(), Ext.getCmp('{2}').getValue(), {{ url: '{4}', success: function() {{ stbStatusBar.setStatus({{ text: 'Saved page caching settings', iconCls: '', clear: true }}); }} }}); {3}.close();", id, chkEnableCache.ClientID, tmeCacheDuration.ClientID, window.ClientID, Engine.AdminManager.GetAdminDefaultUrl()); Button btnCancel = new Button { Text = @"Cancel" }; window.Buttons.Add(btnCancel); btnCancel.Listeners.Click.Handler = string.Format("{0}.close();", window.ClientID); window.Render(pnlContainer, RenderMode.RenderTo); }
private Ext.Net.Button __BuildControlbtnLogin() { Ext.Net.Button button = new Ext.Net.Button(); btnLogin = button; button.ApplyStyleSheetSkin(this); button.Text = ("登录"); button.ID = "btnLogin"; this.__BuildControl__control19(button.DirectEvents); object[] parameters = new object[5]; parameters[0] = button; parameters[2] = 0x728; parameters[3] = 0x14d; parameters[4] = false; this.__PageInspector_SetTraceData(parameters); return(button); }
private void TaoMenuChucNang() { string url1 = cl_ReadURL.LayDiaChiURL("/KiemSoatCod/KiemSoatCod.aspx"); Ext.Net.Button _btn = new Ext.Net.Button(); _btn.Icon = Icon.LightningAdd; _btn.Text = "Kiểm soát cod lỗi"; _btn.OnClientClick = "addTab123('idmnuItemquanlykenh','" + url1 + "','Kiểm soát cod lỗi');"; ToolbarMenu.Items.Add(_btn); string url3 = cl_ReadURL.LayDiaChiURL("/KiemSoatDongTui/KiemSoatDongTui.aspx"); Ext.Net.Button _btn3 = new Ext.Net.Button(); _btn3.Icon = Icon.Help; _btn3.Text = "Kiểm soát chưa đóng túi"; _btn3.OnClientClick = "addTab123('idmnuItemlaythucong','" + url3 + "','Kiểm soát chưa đóng túi');"; ToolbarMenu.Items.Add(_btn3); }
protected override void OnInit(EventArgs e) { this._panel = new Panel(); this._panel.ID = "_panelImages"; this._panel.AutoScroll = true; this._panel.BodyPadding = 8; Toolbar item = new Toolbar(); Ext.Net.Button component = new Ext.Net.Button { Text = "选择文件", ID = "_btnSelectFile" }; item.Add(component); Ext.Net.Button button2 = new Ext.Net.Button { ID = "_btnRemoveFileFromAll", Text = "清空" }; Ext.Net.Button button3 = new Ext.Net.Button { Text = "上传", ID = "_btnStartUpload", Handler = "window.startUpload();" }; button2.Handler = "window.btnRemoveAll_click();"; item.Add(button2); item.Add(button3); this._panel.TopBar.Add(item); this.Items.Add(this._panel); this._hdn.Style.Add("display", "none"); this._hdn.Listeners.Change.Fn = "window.updateFileUrl"; this._hdn.Value = string.Join(",", new string[] { this.Files }); this.Items.Add(this._hdn); this.FieldLabel = "图片"; this.Layout = "fit"; this._panel.Layout = "column"; if (!Ext.Net.X.IsAjaxRequest) { this.AddScript(Resource.uploader.Replace("{uploadUrl}", this.UploadUrl).Replace("{fieldName}", this._hdn.ID)); } this.ID = null; base.OnInit(e); }
protected override void OnInit(EventArgs e) { this._panel = new Panel(); this._panel.ID = "_panelImages"; this._panel.AutoScroll = true; this._panel.BodyPadding = 8; Toolbar item = new Toolbar(); Ext.Net.Button component = new Ext.Net.Button { Text = "选择文件", ID = "_btnSelectFile" }; item.Add(component); Ext.Net.Button button2 = new Ext.Net.Button { ID = "_btnRemoveFileFromAll", Text = "清空" }; Ext.Net.Button button3 = new Ext.Net.Button { Text = "上传", ID = "_btnStartUpload", Handler = "window.startUpload();" }; button2.Handler = "window.btnRemoveAll_click();"; item.Add(button2); item.Add(button3); this._panel.TopBar.Add(item); this.Items.Add(this._panel); this._hdn.Style.Add("display", "none"); this._hdn.Listeners.Change.Fn = "window.updateFileUrl"; this._hdn.Value = string.Join(",", new string[] { this.Files }); this.Items.Add(this._hdn); this.FieldLabel = "图片"; this.Layout = "fit"; this._panel.Layout = "column"; if (!Ext.Net.X.IsAjaxRequest) { this.AddScript(Resource .uploader.Replace("{uploadUrl}", this.UploadUrl).Replace("{fieldName}", this._hdn.ID)); } this.ID = null; base.OnInit(e); }
protected void btnCount_Click(object sender, EventArgs e) { Ext.Net.Button btnCount = (Ext.Net.Button)sender; string sPAT_NO = _PAT_ID; //foreach (Ext.Net.Node nn in root1.Children) // for (int i = nn.Children.Count - 1; i >= 0; i--) // nn.Children.RemoveAt(i); if (btnCount.Text != "全部") { btnCount.Text = "全部"; } else { btnCount.Text = "前" + iiCNT.ToString(); } }
internal static void SetActionsControls(string applyFunctionName, Ext.Net.Panel panelFilters, bool hasAdditionalFilters) { var applyButton = new Ext.Net.Button(StandartConfigApplyButton()); var clearButton = new Ext.Net.Button(StandartConfigClearButton()); SetListenersApplyButton(applyButton, applyFunctionName); SetListenersClearButton(clearButton); panelFilters.Buttons.Add(applyButton); panelFilters.Buttons.Add(clearButton); if (!hasAdditionalFilters) { return; } var additonalFiltersButton = new Ext.Net.Button(StandartConfigAdditonalFiltersButton()); SetListenersAdditonalFiltersButton(additonalFiltersButton); panelFilters.Buttons.Add(additonalFiltersButton); }
protected void Page_Load(object sender, EventArgs e) { int i = 0; Literal lt = new Literal(); lt.Text = " "; foreach (var ic in Enum.GetValues(typeof(Icon))) { Ext.Net.Button bt = new Ext.Net.Button(); i++; bt.ID = "ID" + i.ToString(); bt.Text = Enum.GetName(typeof(Icon), ic); bt.Icon = (Icon)ic; bt.Style.Add("float", "left"); ph.Controls.Add(bt); ph.Controls.Add(lt); } //GetName(typeof(eErrorDetailCode), myCode);// }
public static void SetBtnAccessRight(string AccessString, Ext.Net.Button BtnAddId, Ext.Net.Button BtnEditId, Ext.Net.Button BtnDeleteId) { char[] arr = AccessString.ToCharArray(); bool IsAdd = (arr[1] == '1' ? true : false); bool IsEdit = (arr[2] == '1' ? true : false); bool IsDelete = (arr[3] == '1' ? true : false); if (BtnAddId != null) { BtnAddId.Disabled = !IsAdd; } if (BtnEditId != null) { BtnEditId.Disabled = !IsEdit; } if (BtnDeleteId != null) { BtnDeleteId.Disabled = !IsDelete; } }
protected void changelang(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("lang"); Ext.Net.Button btnEN = (Ext.Net.Button)sender; if (btnEN.Text == "中文") { cookie.Value = "zh-cn"; } else { cookie.Value = "en-us"; } Request.Cookies.Remove("lang"); Request.Cookies.Add(cookie); Response.Cookies.Remove("lang"); Response.Cookies.Add(cookie); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cookie.Value); Thread.CurrentThread.CurrentUICulture = new CultureInfo(cookie.Value); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); txtOldPassword = new TextField(); txtOldPassword.Name = "OldPassword"; txtOldPassword.ID = "txtOldPassword"; txtOldPassword.FieldLabel = "旧密码"; txtOldPassword.InputType = InputType.Password; txtNewPassword = new TextField() { Name = "NewPassword", ID = "txtNewPassword", InputType = InputType.Password, FieldLabel = "新密码" }; txtNewPassword2 = new TextField() { Name = "NewPassword2", ID = "txtNewPassword2", InputType = InputType.Password, FieldLabel = "确认密码" }; formPanel = new FormPanel(); formPanel.BodyPadding = 20; formPanel.Add(txtOldPassword); formPanel.Add(txtNewPassword); formPanel.Add(txtNewPassword2); Controls.Add(formPanel); btnAccept = new Button() { Icon = Icon.Accept, Text = "修改", ID = "btnAccept" }; btnAccept.DirectClick += btnAccept_DirectClick; btnAccept.DirectEvents.Click.EventMask.Set("正在修改"); formPanel.Buttons.Add(btnAccept); }
protected void Page_Load(object sender, EventArgs e) { //if (!X.IsAjaxRequest) //{ //} grp_nhatkytrucap.AddComponent(btnTruncateHistory, 2); grp_nhatkytrucap.HiddenDuplicateButton(true); if (!X.IsAjaxRequest) { NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("History"), MOTA = GlobalResourceManager.GetInstance().GetHistoryAccessValue("History"), IsError = false, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "NHATKY_TRUYCAP", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } Ext.Net.Button btnChooseTime = new Ext.Net.Button() { Text = "Chọn thời gian", Icon = Icon.Clock, }; btnChooseTime.Listeners.Click.Handler = "#{wdChooseTime}.show();"; if (!X.IsAjaxRequest) { grp_nhatkytrucap.HiddenAddButton(true); grp_nhatkytrucap.HiddenEditButton(true); grp_nhatkytrucap.HiddenHelpButton(true); grp_nhatkytrucap.HiddenTienIch(true); } grp_nhatkytrucap.AddComponent(btnChooseTime, 0); }
public override Button GetToolbarButton(ContentItem contentItem, GridPanel gridPanel) { Button toolbarButton = new Button { Text = "Delete", Icon = Icon.Delete, Disabled = true }; toolbarButton.Listeners.Click.Handler = string.Format(@" var selections = {0}.getSelectionModel().getSelections(); var selectedIDs = []; for (var i = 0; i < selections.length; i++) {{ var record = selections[i]; selectedIDs.push(record.data.ID); }} top.Ext.net.DirectMethods.Delete.ShowDialog('Delete Items', 'Are you sure you wish to delete these items?', selectedIDs.join(','), {{ url : '{1}' }});", gridPanel.ClientID, Context.AdminManager.GetAdminDefaultUrl()); return toolbarButton; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); GridView item = View.FirstOrDefault(); if (item == null) { item = new GridView(); item.EnableTextSelection = true; this.View.Add(item); } item.ID = this.ID + "View"; item.LoadingText = "正在加载"; item.LoadMask = true; Ext.Net.Button button = null; Ext.Net.Button button2 = null; if (this.EnableAdd) { button = new Ext.Net.Button { Text = "添加" }; button.DirectEvents.Click.EventMask.Msg = "正在加载"; button.DirectEvents.Click.EventMask.ShowMask = true; } if (this.EnableRemove) { button2 = new Ext.Net.Button { Text = "删除" }; button2.DirectEvents.Click.EventMask.Msg = "正在删除"; button2.DirectEvents.Click.EventMask.ShowMask = true; button2.DirectEvents.Click.Confirmation.ConfirmRequest = true; button2.DirectEvents.Click.Confirmation.Message = "确认删除?"; button2.DirectEvents.Click.Confirmation.Title = "提示"; Parameter parameters = new Parameter { Name = "ids", Value = "getSelectionIds()", Mode = ParameterMode.Raw }; button2.DirectEvents.Click.ExtraParams.Add(parameters); } if (this.EditorConfig != null) { if (this.EnableAdd) { button.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.ExtraParams); button.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.AddWindow.ExtraParams); } if (this.EnableRemove) { button2.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.ExtraParams); button2.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.AddWindow.ExtraParams); } } PagingToolbar toolbar = new PagingToolbar(); if (this.EnableAdd) { button.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnAdd_DirectClick); toolbar.Items.Add(button); } if (this.EnableRemove) { button2.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnRemove_DirectClick); toolbar.Items.Add(button2); } if (BottomBar.Count > 0) { toolbar.Items.AddRange(BottomBar[0].Items); BottomBar.Clear(); } this.BottomBar.Add(toolbar); this.SelectionModel.Add(new CheckboxSelectionModel()); this.InitModel(); this.InitGridCommand(); if (!Ext.Net.X.IsAjaxRequest) { this.AddScript("function getSelectionIds(){var sm=Ext.getCmp(\"" + this.ID + "\").getSelectionModel();var ids=Array();var selections=sm.getSelection();for(var i=0;i<selections.length;i++)ids.push(selections[i].data.Id);return ids.join(',');}"); } }
private void InitComponents() { #region Header #region Button btnSave = new Button { ID = "btnSave", Icon = Icon.Disk, Text = "Save", ToolTip = "Save" }; btnPost = new Button { ID = "btnPost", Icon = Icon.PackageAdd, Text = "Post Receive", ToolTip = "Post Receive" }; topBar = new Toolbar { ID = "topBar", Items = { btnSave, btnPost } }; #endregion Button #region Fields txtKey = new Hidden { DataIndex = "Key", Name = "Key", LabelWidth = 150, Anchor = "100%", FieldLabel = "Key", ID = "Key" }; txtNo = new TextField { LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", DataIndex = "No", Name = "No", ID = "txtNo", ReadOnly = true }; txtBuy_from_Vendor_No = new TextField { LabelWidth = 150, Anchor = "100%", FieldLabel = "Buy-from Vendor No.", DataIndex = "Buy_from_Vendor_No", Name = "Buy_from_Vendor_No", ID = "txtBuy_from_Vendor_No", ReadOnly = true }; txtBuy_from_Vendor_Name = new TextField { LabelWidth = 150, Anchor = "100%", FieldLabel = "Buy-from Vendor Name", DataIndex = "Buy_from_Vendor_Name", Name = "Buy_from_Vendor_Name", ID = "txtBuy_from_Vendor_Name", ReadOnly = true }; txtOrder_Date = new DateField { LabelWidth = 150, FieldLabel = "Order Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", DataIndex = "Order_Date", Name = " Order_Date", SelectOnFocus = true, ID = "txtOrder_Date", ReadOnly = true }; txtDocument_Date = new DateField { LabelWidth = 150, FieldLabel = "Document Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", DataIndex = "Document_Date", Name = " Document_Date", SelectOnFocus = true, ID = "txtDocument_Date", ReadOnly = true }; txtPosting_Date = new DateField { LabelWidth = 150, FieldLabel = "Posting Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", DataIndex = "Posting_Date", Name = " Posting_Date", SelectOnFocus = true, ID = "txtPosting_Date", AllowBlank = false, MsgTarget = MessageTarget.Side }; txtVietnamese_Desc = new TextField { LabelWidth = 150, FieldLabel = "Vietnamese Description", Anchor = "100%", DataIndex = "Vietnamese_Description", Name = " Vietnamese_Description", SelectOnFocus = true, ID = "txtVietnamese_Desc", AllowBlank = false, MsgTarget = MessageTarget.Side }; txtVAT_Desc = new TextField { LabelWidth = 150, FieldLabel = "VAT Description", Anchor = "100%", DataIndex = "VAT_Description", Name = " VAT_Description", SelectOnFocus = true, ID = "txtVAT_Desc", AllowBlank = false, MsgTarget = MessageTarget.Side }; cboReceive = new Checkbox { LabelWidth = 150, FieldLabel = "Receive", Anchor = "100%", DataIndex = "Receive", Name = " Receive", ID = "cboReceive" }; #endregion Fields #region FormPanel frmHeader = new FormPanel { //Margins = "10 10 0 10", Region = Region.North, Icon = Ext.Net.Icon.ApplicationForm, Title = "General", Border = true, CollapseMode = CollapseMode.Header, Collapsible = true, ID = "frmHeader", TrackResetOnLoad = true, Layout = "Hbox", Items = { new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 0 10", Border = false, Items = { txtKey, txtNo, txtBuy_from_Vendor_No, txtBuy_from_Vendor_Name, txtOrder_Date } }, new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 0 10", Border = false, Items = { txtPosting_Date, txtVietnamese_Desc, txtVAT_Desc, cboReceive } } } }; #endregion FormPanel #endregion Header #region Line #region GridLine dataTemplateLine = BuilDataTemplateLine(); grdLine = new GridPanelEditBase { ID = "grdLine", Border = false, TitleAlign = Ext.Net.TitleAlign.Center, ProxyUrl = @"..//..//..//..//PurchaseOrder//SvcPurchaseOrder.asmx/GetPOLine", DocumentType = "", DocumentNo = DocumentNo, CurCompany = GlobalVariable.CompanyName, SCOPE = this.SCOPE, DataTemplate = dataTemplateLine, }; #endregion GridLine #region pnlLine pnlLine = new Panel { ID = "pnlLine", Region = Ext.Net.Region.Center, Layout = "Fit", Icon = Ext.Net.Icon.Group, Title = "Lines", Border = true, //Margins = "10 10 5 10", Split = true, Items = { grdLine } }; #endregion pnlLine #endregion Line #region Windows this.ID = "winCard"; this.Maximizable = false; this.Minimizable = false; this.CloseAction = CloseAction.Destroy; this.Icon = Icon.ApplicationEdit; this.TopBar.Add(topBar); this.Layout = "Border"; this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> { this.frmHeader, this.pnlLine }); #endregion Windows }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { this.txtNODE_ID.Hidden = true; this.txtNODE_TEXT.Hidden = true; this.TreePanel1.Hidden = true; this.TreePanel1.ID = "TreePanel1"; //this.TreePanel1.Width = Unit.Pixel(200); this.TreePanel1.Height = Unit.Pixel(400); this.TreePanel1.AutoScroll = true; Ext.Net.Button btnExpand = new Ext.Net.Button(); btnExpand.Text = "展开"; btnExpand.Listeners.Click.Handler = this.TreePanel1.ClientID + ".expandAll();"; Ext.Net.Button btnCollapse = new Ext.Net.Button(); btnCollapse.Text = "收合"; btnCollapse.Listeners.Click.Handler = this.TreePanel1.ClientID + ".collapseAll();"; Ext.Net.Button btnCount = new Ext.Net.Button(); btnCount.Text = "前3"; //btnCount.Click += btnCount_Click; btnCount.AutoPostBack = true; Ext.Net.Button btnEdit = new Ext.Net.Button(); btnEdit.Text = "修改"; btnEdit.Icon = Icon.Pencil; btnEdit.Click += btnEdit_Click; btnEdit.AutoPostBack = true; Ext.Net.Button btnPrint = new Ext.Net.Button(); btnPrint.Text = "打印"; btnPrint.Icon = Icon.Printer; btnPrint.Click += btnPrint_Click; btnPrint.AutoPostBack = true; Toolbar toolBar = new Toolbar(); toolBar.ID = "Toolbar1"; toolBar.Items.Add(btnExpand); toolBar.Items.Add(btnCollapse); //toolBar.Items.Add(btnCount); //toolBar.Items.Add(btnEdit); //toolBar.Items.Add(btnPrint); this.TreePanel1.TopBar.Add(toolBar); StatusBar statusBar1 = new StatusBar(); statusBar1.ID = "StatusBar1"; statusBar1.AutoClear = 1000; this.TreePanel1.BottomBar.Add(statusBar1); this.TreePanel1.Listeners.ItemClick.Handler = statusBar1.ClientID + ".setStatus({text: '点选: <b>' + record.data.text + '</b>', clear: false});"; string sSQL; root.Text = "病程记录"; //root.Icon = Icon.ReportUser; root.NodeID = "__"; root.Cls = "large-font"; //Ext.Net.Node rA = new Ext.Net.Node(); rA.Text = "病程记录"; rA.Icon = Icon.ReportUser; rA.NodeID = "A_"; rA.Cls = "large-font"; //AddChild(rA, "A", "G001", 3); Ext.Net.Node rA0 = new Ext.Net.Node() { Text = "添加", NodeID = "A_A", Icon = Icon.Add, Cls = "large-font", Leaf = true }; rA.Children.Add(rA0); sSQL = "SELECT info_date FROM zinfo_e_01 WHERE pat_id=" + _PAT_ID + " ORDER BY info_date DESC "; DataTable dt1 = db.Query(sSQL); for (int i = 0; i < dt1.Rows.Count; i++) { Ext.Net.Node rr = new Ext.Net.Node() { Text = dt1.Rows[i]["info_date"].ToString(), NodeID = "A" + i.ToString(), Icon = Icon.Page, Cls = "large-font", Leaf = true }; rA.Children.Add(rr); } //if (rA.Children.Count == 0) //{ // Ext.Net.Node rA0 = new Ext.Net.Node() // { // Text = "添加", // NodeID = "A_A", // Icon = Icon.ControlBlank, // Cls = "large-font", // Leaf = true // }; // rA.Children.Add(rA0); //} rA.Expanded = true; //Ext.Net.Node rB = new Ext.Net.Node(); rB.Text = "手术记录"; rB.Icon = Icon.ReportUser; rB.NodeID = "B_"; rB.Cls = "large-font"; //AddChild(rB, "B", "G003", 3); Ext.Net.Node rB0 = new Ext.Net.Node() { Text = "添加", NodeID = "B_B", Icon = Icon.Add, Cls = "large-font", Leaf = true }; rB.Children.Add(rB0); sSQL = "SELECT info_date FROM zinfo_e_02 WHERE pat_id=" + _PAT_ID + " ORDER BY info_date DESC "; DataTable dt2 = db.Query(sSQL); for (int i = 0; i < dt2.Rows.Count; i++) { Ext.Net.Node rr = new Ext.Net.Node() { Text = dt2.Rows[i]["info_date"].ToString(), NodeID = "B" + i.ToString(), Icon = Icon.Page, Cls = "large-font", Leaf = true }; rB.Children.Add(rr); } //if (rB.Children.Count == 0) //{ // Ext.Net.Node rB0 = new Ext.Net.Node() // { // Text = "添加", // NodeID = "B_B", // Icon = Icon.ControlBlank, // Cls = "large-font", // Leaf = true // }; // rB.Children.Add(rB0); //} rB.Expanded = true; //Ext.Net.Node rC = new Ext.Net.Node(); rC.Text = ""; rC.Icon = Icon.ReportUser; rC.NodeID = "C_"; rC.Cls = "large-font"; //AddChild(rC, "C", "G002", 3); rC.Expanded = true; // rD.Text = ""; rD.Icon = Icon.ReportUser; rD.NodeID = "D_"; rD.Cls = "large-font"; //AddChild(rD, "D", "G004", 3); rD.Expanded = true; // rZ.Text = ""; rZ.Icon = Icon.ReportUser; rZ.NodeID = "Z_"; rZ.Cls = "large-font"; //AddChild(rZ, "Z", "", 3); rZ.Expanded = true; // root.Children.Add(rA); root.Children.Add(rB); //root.Children.Add(rC); //root.Children.Add(rD); //root.Children.Add(rZ); root.Expanded = true; this.TreePanel1.Root.Add(root); //this.LastData(); } }
public override void ModifyInterface(IMainInterface mainInterface) { // Add tree. TreePanel treePanel = new TreePanel { ID = "stpNavigation", Width = 200, Icon = Icon.SitemapColor, Title = "Site", AutoScroll = true, PathSeparator = "|", EnableDD = true, UseArrows = true, BodyStyle = "padding-top:5px", Region = Region.West, MinWidth = 175, MaxWidth = 400, Split = true, CollapseFirst = false }; mainInterface.Viewport.Items.Add(treePanel); // Setup tree top toolbar. Toolbar topToolbar = new Toolbar(); treePanel.TopBar.Add(topToolbar); TriggerField filterField = new TriggerField { EnableKeyEvents = true, Width = 100, EmptyText = "Filter..." }; filterField.Triggers.Add(new FieldTrigger { Icon = TriggerIcon.Clear, HideTrigger = true }); filterField.Listeners.KeyUp.Fn = "keyUp"; filterField.Listeners.KeyUp.Buffer = 100; filterField.Listeners.TriggerClick.Fn = "clearFilter"; topToolbar.Items.Add(filterField); topToolbar.Items.Add(new ToolbarFill()); Button refreshButton = new Button { Icon = Icon.Reload }; refreshButton.ToolTips.Add(new ToolTip { Html = "Refresh" }); refreshButton.Listeners.Click.Handler = string.Format("{0}.getLoader().load({0}.getRootNode());", treePanel.ClientID); topToolbar.Items.Add(refreshButton); Button expandAllButton = new Button { IconCls = "icon-expand-all" }; expandAllButton.ToolTips.Add(new ToolTip { Html = "Expand All" }); expandAllButton.Listeners.Click.Handler = string.Format("{0}.expandAll();", treePanel.ClientID); topToolbar.Items.Add(expandAllButton); Button collapseAllButton = new Button { IconCls = "icon-collapse-all" }; collapseAllButton.ToolTips.Add(new ToolTip { Html = "Collapse All" }); collapseAllButton.Listeners.Click.Handler = string.Format("{0}.collapseAll();", treePanel.ClientID); topToolbar.Items.Add(collapseAllButton); topToolbar.Items.Add(new ToolbarSeparator()); Window helpWindow = new Window { Modal = true, Icon = Icon.Help, Title = "Help", Hidden = true, Html = "This is the site tree. You can use this to view all the pages on your site. Right-click any item to edit or delete it, as well as create additional pages.<br /><br />The main branches of the root node tree are the main sections of the admin system. Each section is broken down into smaller sections, accessed by expanding the + sign. (Wherever you see a + sign, the section can be broken down into further sections).<br /><br />When you receive your admin system, you will notice the first main section (after the Root Node) will be divided into the main sections of your website. (Example sections may include: Homepage, About Us, News, Links and Contact pages.) To see these pages, as they appear on the website, simply click the relevant node – it will then appear in the right hand pane.", BodyStyle = "padding:5px", Width = 300, Height = 200, AutoScroll = true }; mainInterface.AddControl(helpWindow); Button helpButton = new Button(); helpButton.Icon = Icon.Help; helpButton.ToolTips.Add(new ToolTip { Html = "Help" }); helpButton.Listeners.Click.Handler = string.Format("{0}.show();", helpWindow.ClientID); topToolbar.Items.Add(helpButton); // Data loader. var treeLoader = new Ext.Net.TreeLoader { DataUrl = Context.Current.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(GetType().Assembly, "Zeus.Admin.Plugins.Tree.TreeLoader.ashx"), PreloadChildren = true }; treeLoader.Listeners.Load.Handler = "if (response.getResponseHeader['Content-Type'] == 'text/html; charset=utf-8') { Ext.Msg.alert('Timeout', 'Your session has timed out. Please refresh your browser to login again.'); }"; treePanel.Loader.Add(treeLoader); // Call tree modification plugins and load tree plugin user controls. foreach (ITreePlugin treePlugin in Context.Current.ResolveAll<ITreePlugin>()) { string[] requiredUserControls = treePlugin.RequiredUserControls; if (requiredUserControls != null) mainInterface.LoadUserControls(requiredUserControls); treePlugin.ModifyTree(treePanel, mainInterface); } if (!ExtNet.IsAjaxRequest) { TreeNodeBase treeNode = SiteTree.Between(Find.StartPage, Find.RootItem, true) .OpenTo(Find.StartPage) .Filter(items => items.Authorized(Context.Current.WebContext.User, Context.SecurityManager, Operations.Read)) .ToTreeNode(true); treePanel.Root.Add(treeNode); } }
protected void Application_Start(object sender, EventArgs e) { #if WST int i = 0; i++; WebServiceTest.CariKategori(); WebServiceTest.BelgeTip(); WebServiceTest.ParametrikAlan(); WebServiceTest.CariKategoriGrup(); WebServiceTest.Urun(); WebServiceTest.Bolge(); WebServiceTest.UlkeGrup(); WebServiceTest.CariYetki(); WebServiceTest.Rakip(); WebServiceTest.Satici(); WebServiceTest.AltSektor(); WebServiceTest.Belge(); WebServiceTest.Sektor(); WebServiceTest.Statu(); WebServiceTest.Sehir(); WebServiceTest.Ilce(); WebServiceTest.Ulke(); WebServiceTest.UnvanGrup(); WebServiceTest.Unvan(); WebServiceTest.Cagri(); #endif if (!Ext.Net.ResourceManager.HasFactory("mybutton")) { Ext.Net.ResourceManager.AddFactory(delegate { var b = new Ext.Net.Button { Text = "Factory button", Handler = "Ext.Msg.alert('Factory button', 'The button is clicked');", Plugins = { new Badge { Text = "20" } }, Factory = new FactoryConfig { Alias = "mybutton", Instance = "My.Button" } }; return(b); }, "mybutton", "My.Button"); } if (!Ext.Net.ResourceManager.HasFactory("mywindow")) { Ext.Net.ResourceManager.AddFactory("~/Examples/Miscellaneous/Factory/Basic/MyWindow.ascx", "mywindow", "My.Window"); } }
protected void Page_Load(object sender, EventArgs e) { tree.ID = "TreePanel1"; tree.Width = Unit.Pixel(300); tree.Height = Unit.Pixel(450); tree.Icon = Icon.BookOpen; tree.AutoScroll = true; Ext.Net.Button btnExpand = new Ext.Net.Button(); btnExpand.Text = "Expand All"; btnExpand.Listeners.Click.Handler = tree.ClientID + ".expandAll();"; Ext.Net.Button btnCollapse = new Ext.Net.Button(); btnCollapse.Text = "Collapse All"; btnCollapse.Listeners.Click.Handler = tree.ClientID + ".collapseAll();"; Toolbar toolBar = new Toolbar(); toolBar.ID = "Toolbar1"; toolBar.Items.Add(btnExpand); toolBar.Items.Add(btnCollapse); tree.TopBar.Add(toolBar); StatusBar statusBar = new StatusBar(); statusBar.AutoClear = 1000; tree.BottomBar.Add(statusBar); tree.Listeners.Click.Handler = statusBar.ClientID + ".setStatus({text: 'Node Selected: <b>' + node.text + '</b>', clear: true});"; tree.Listeners.ExpandNode.Handler = statusBar.ClientID + ".setStatus({text: 'Node Expanded: <b>' + node.text + '</b>', clear: true});"; tree.Listeners.ExpandNode.Delay = 30; tree.Listeners.CollapseNode.Handler = statusBar.ClientID + ".setStatus({text: 'Node Collapsed: <b>' + node.text + '</b>', clear: true});"; Ext.Net.TreeNode root = new Ext.Net.TreeNode("Composers"); root.Expanded = true; tree.Root.Add(root); List<Composer> composers = this.GetData(); foreach (Composer composer in composers) { Ext.Net.TreeNode composerNode = new Ext.Net.TreeNode(composer.Name, Icon.UserGray); root.Nodes.Add(composerNode); foreach (Composition composition in composer.Compositions) { Ext.Net.TreeNode compositionNode = new Ext.Net.TreeNode(composition.Type.ToString()); composerNode.Nodes.Add(compositionNode); foreach (Piece piece in composition.Pieces) { Ext.Net.TreeNode pieceNode = new Ext.Net.TreeNode(piece.Title, Icon.Music); compositionNode.Nodes.Add(pieceNode); } } } }
private Window AddEditorWindow(ContentItem contentItem) { Window editorWindow = new Window { ID = ID + "editorWindow" + _itemEditorIndex, Title = "Edit", Icon = Icon.NoteEdit, Width = 800, Height = 400, Modal = true, Hidden = true, Layout = "Fit", AutoScroll = true }; Controls.Add(editorWindow); // Item Editor ItemEditView itemEditor = new ItemEditView(); itemEditor.ID = ID + "_ie_" + _itemEditorIndex; editorWindow.ContentControls.Add(itemEditor); itemEditor.CurrentItem = contentItem; _itemEditors.Add(itemEditor); // Buttons Ext.Net.Button saveButton = new Ext.Net.Button { ID = ID + "btnSave" + _itemEditorIndex, Text = "Update", Icon = Icon.Disk }; string titleValue = itemEditor.PropertyControls.ContainsKey("Title") ? string.Format("Ext.getDom('{0}').value", itemEditor.PropertyControls["Title"].ClientID) : "'[No Title]'"; saveButton.Listeners.Click.Handler = string.Format(@" var editorWindow = Ext.getCmp('{0}editorWindow{1}'); var record = editorWindow.record; record.set('Title', {2}); editorWindow.hide(null);", ClientID, _itemEditorIndex, titleValue); editorWindow.Buttons.Add(saveButton); ++_itemEditorIndex; return editorWindow; }
private Panel CreatePanel(Control itemEditor, int id) { var panel = new Panel { ID = ID + "_panel_" + id, IDMode = IDMode.Legacy, Header = false, BodyStyle = "padding:5px", StyleSpec = "margin-bottom:10px;" }; var toolbar = new Toolbar(); panel.TopBar.Add(toolbar); //toolbar.Items.Add(new Button { Icon = Icon.ArrowNsew }); toolbar.Items.Add(new ToolbarFill()); var deleteButton = new Button { ID = ID + "_deleteButton_" + id, IDMode = IDMode.Legacy, Icon = Icon.Delete, Text = @"Delete " + ItemTitle, CausesValidation = false }; deleteButton.DirectEvents.Click.Event += OnDeleteButtonDirectClick; deleteButton.DirectEvents.Click.ExtraParams.Add(new Parameter("ID", id.ToString())); toolbar.Items.Add(deleteButton); panel.ContentControls.Add(itemEditor); return panel; }
private void AddNewItemButton() { Controls.Add(new LiteralControl("<br style=\"clear:both\" />") { ID = ID + "_literalControl2" }); var addButton = new Button { ID = ID + "_addButton", Icon = Icon.Add, Text = @"Add " + ItemTitle, CausesValidation = false }; addButton.DirectClick += OnAddButtonDirectClick; Controls.Add(addButton); }
protected override void OnLoad(EventArgs e) { if (this._nodeHelper == null) { _nodeHelper = new NodeHelper(Table); } TreeStore.Config config = new TreeStore.Config { NodeParam = "parentId" }; this._treeStore = new TreeStore(config); this._treeStore.ID = "_treeStore"; Model model = new Model { Fields = { new ModelField("Id", ModelFieldType.String), new ModelField("Name", ModelFieldType.String), new ModelField("ParentId", ModelFieldType.String) } }; model.Fields.AddRange(this._nodeHelper.CustomFields); this._treeStore.Model.Add(model); this._treeStore.Proxy.Add(new PageProxy()); this.Store.Add(this._treeStore); this._treeStore.ReadData += new TreeStoreBase.ReadDataEventHandler(this.treeStore_ReadData); base.RemoteRemove += new TreePanel.RemoteRemoveEventHandler(this.TreePanelEx_RemoteRemove); base.RemoteEdit += new TreePanel.RemoteEditEventHandler(this.TreePanelEx_RemoteEdit); base.RemoteMove += new TreePanel.RemoteMoveEventHandler(this.TreePanelEx_RemoteMove); Ext.Net.Button button = new Ext.Net.Button { Text = "刷新", Handler = "App." + this.ID + ".getStore().load();" }; Toolbar toolbar = new Toolbar(); toolbar.Items.Add(button); this.TopBar.Add(toolbar); if (!Ext.Net.X.IsAjaxRequest) { //base.Listeners.NodeDragOver.Handler = "var recs = dragData.records;var prev=-1;for(var i=0;i<recs.length;i++){var recData=recs[i].data;if(prev==-1){prev=recData.Level;}else{if(prev!=recData.Level){return false;}}}if(targetNode.data.Level>=" + this.Level + ")return false;return true;"; Parameter parameters = new Parameter { Name = "parentId", Value = "arguments[1].data.parentId", Mode = ParameterMode.Raw }; this.RemoteExtraParams.Add(parameters); this.On("beforeRemoteAction", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); JFunction fn = new JFunction("Ext.net.Mask.hide();"); this.On("remoteActionRefusal", fn); this.On("remoteActionException", fn); this.On("remoteActionSuccess", fn); this.On("remoteEditRefusal", new JFunction("Ext.Msg.alert('失败了')")); this._treeStore.On("beforeload", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); this._treeStore.On("load", new JFunction("Ext.net.Mask.hide();")); Ext.Net.Node node = new Ext.Net.Node(); node.CustomAttributes.Add(new ConfigItem("Id", "")); node.CustomAttributes.Add(new ConfigItem("Name", "根")); node.NodeID = "0"; node.Expanded = true; node.Text = "根"; this.Root.Add(node); Column column = new Column(); this.ColumnModel.Columns.Add(column); TreeColumn column2 = new TreeColumn(); this.ColumnModel.Columns.Add(column2); ActionColumn column3 = new ActionColumn(); if (this.EnableRemove) { ActionItem item2 = new ActionItem(); column3.Items.Add(item2); item2.Icon = Ext.Net.Icon.PageWhiteDelete; item2.Handler = "var record=arguments[5];var tree = App." + this.ID + ";var node = tree.getStore().getNodeById(record.data.Id) || tree.getStore().getNewRecords()[0];Ext.Msg.confirm(\"提示\", \"会删除相关的数据,无法恢复,确认删除?\", function (r) {if (r == \"yes\") {tree.removeNode(node);return;App.direct.RemoveNode(record.data.Id, {success: function (result) {if (result.Success) {node.remove();node.commit();} else {Ext.Msg.alert(\"错误\", result.Message);}},eventMask: {showMask: true,msg: \"正在删除\"}});}});"; item2.Tooltip = "删除"; } this.ColumnModel.Columns.Add(column3); column.ID = "col1"; column.DataIndex = "Id"; column.Width = 50; column.Text = "编号"; column2.ID = "col2"; column2.DataIndex = "Name"; column2.Width = 300; column2.Text = "名称"; column3.ID = "col3"; column3.Text = "操作"; column3.Width = 60; column3.Align = Alignment.Center; if (EnableEdit) { ActionItem item = new ActionItem(); column3.Items.Add(item); item.Icon = Ext.Net.Icon.PageWhiteAdd; item.Handler = "var record=arguments[5]; var tree = App." + this.ID + ";var ep = tree.editingPlugin;var node,store = tree.getStore();if (record.data.Id) {node = store.getNodeById(record.data.Id);}else{node = store.getRootNode();}node.expand(false, function () {node = node.appendChild({Name:'新节点'});setTimeout(function () {ep.startEdit(node, tree.columns[1]);}, 200);});"; item.Tooltip = "添加子节点"; CellEditing editing = new CellEditing(); editing.Listeners.CancelEdit.Handler = " if (e.record.data.Id) {e.record.reject();} else {e.record.remove(true);}"; this.Plugins.Add(editing); this.Editor.Add(new TextField()); TreeView view = new TreeView(); this.View.Add(view); TreeViewDragDrop drop = new TreeViewDragDrop { DragText = "移动到", AppendOnly = true }; view.Plugins.Add(drop); } this.Mode = TreePanelMode.Remote; } base.OnLoad(e); }
/// <summary> /// Carrega os projetos que o usuario tem permissao /// </summary> private void CarregarProjetos() { if (UsuarioLogado.Sistemas.ToList().Count > 0) { TableLayout tableProjetos = new TableLayout(); tableProjetos.Columns = UsuarioLogado.Sistemas.Count; foreach(SistemaVO s in UsuarioLogado.Sistemas) { Cell cell = new Cell(); Ext.Net.Button btn = new Ext.Net.Button(s.Nome); btn.EnableToggle = true; btn.IconAlign = IconAlign.Top; btn.Scale = ButtonScale.Large; btn.IconCls = "custom_"+s.Id; btn.AutoPostBack = true; btn.AutoWidth = true; btn.Listeners.Click.Handler = "Ext.net.DirectMethods.RedirecionarProjeto('"+ s.Url + "');"; cell.Items.Add(btn); tableProjetos.Cells.Add(cell); } pnlProjetos.Items.Add(tableProjetos); } }
private Ext.Net.NodeCollection BuildTree1(Ext.Net.NodeCollection nodes) { Ext.Net.Button btnExpand = new Ext.Net.Button(); btnExpand.Text = "展开"; btnExpand.Listeners.Click.Handler = TreePanel1.ClientID + ".expandAll();"; Ext.Net.Button btnCollapse = new Ext.Net.Button(); btnCollapse.Text = "收合"; btnCollapse.Listeners.Click.Handler = TreePanel1.ClientID + ".collapseAll();"; Ext.Net.Button btnCount = new Ext.Net.Button(); btnCount.Text = "前" + iiCNT.ToString(); btnCount.Click += btnCount_Click; btnCount.Visible = false; btnCount.AutoPostBack = true; Toolbar toolBar = new Toolbar(); //Tree Head 按鈕 toolBar.ID = "Toolbar"; toolBar.Items.Add(btnExpand); toolBar.Items.Add(btnCollapse); toolBar.Items.Add(btnCount); TreePanel1.TopBar.Add(toolBar); Ext.Net.Node root = new Ext.Net.Node(); root.Text = "PD."; root.NodeID = "__"; root.Cls = "large-font"; root.Expanded = true; //root.Expanded = false; nodes.Add(root); int iii = 0; // 加入人口分布節點 dvFhir.RowFilter = "C5 like '%PD%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; Ext.Net.Node groupNode = new Ext.Net.Node() { Text = "人口分布 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "PD" + "_", Cls = "large-font" }; root.Children.Add(groupNode); AddChild(groupNode, "PD", "PD", "PD", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; // 加入血透年限分布節點 dvFhir.RowFilter = "C5 like '%DDD%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; groupNode = new Ext.Net.Node() { Text = "血透年限分布 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "DDD" + "_", Cls = "large-font" }; root.Children.Add(groupNode); AddChild(groupNode, "DDD", "DDD", "DDD", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; // 加入死亡率節點 dvFhir.RowFilter = "C5 like '%MR%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; groupNode = new Ext.Net.Node() { Text = "死亡率 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "MR" + "_", Cls = "large-font" }; root.Children.Add(groupNode); AddChild(groupNode, "MR", "MR", "MR", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; // 加入血透品質節點 dvFhir.RowFilter = "C5 like '%DQ%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; groupNode = new Ext.Net.Node() { Text = "血液透析品质 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "DQ" + "_", Cls = "large-font" }; root.Children.Add(groupNode); AddChild(groupNode, "DQ", "DQ", "DQ", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; // 加入医事人员節點 dvFhir.RowFilter = "C5 like '%Practitioner%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; groupNode = new Ext.Net.Node() { Text = "医事人员 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "PR" + "_", Cls = "large-font" }; root.Children.Add(groupNode); //AddChild(groupNode, "PR", "PR", "PR", dtPractitioner.Columns.Count, dtPractitioner); AddChild(groupNode, "PR", "PR", "PR", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; // 加入病患基本数据節點 dvFhir.RowFilter = "C5 like '%Patient%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; groupNode = new Ext.Net.Node() { Text = "病患基本数据 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "PI" + "_", Cls = "large-font" }; root.Children.Add(groupNode); //AddChild(groupNode, "PI", "PI", "PI", dtPatient.Columns.Count, dtPatient); AddChild(groupNode, "PI", "PI", "PI", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; // 加入医嘱用药節點 dvFhir.RowFilter = "C5 like '%Medication%'"; dvFhir.Sort = "C2 DESC"; iii = dvFhir.Count; groupNode = new Ext.Net.Node() { Text = "医嘱用药 (" + iii.ToString() + ")", Icon = Icon.ReportUser, NodeID = "MO" + "_", Cls = "large-font" }; root.Children.Add(groupNode); //AddChild(groupNode, "PI", "PI", "PI", dtPatient.Columns.Count, dtPatient); AddChild(groupNode, "MO", "MO", "MO", iiCNT, dvFhir.ToTable()); groupNode.Expanded = false; //-------------------- TreePanel1.Render(); TreePanel1.Expand(false); return(nodes); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); foreach (Control control in Controls) { if (loginForm == null) { loginForm = control as HtmlForm; if (loginForm != null) { break; } } } if (loginForm == null) { throw new ArgumentException("登录页面中至少添加一个服务器端表单"); } window = new Window(); window.Title = "用户登录"; window.Closable = false; window.Icon = Icon.Key; window.Width = 320; window.Height = 185; formPanel = new FormPanel(); formPanel.BodyStyle = "padding:20px;"; formPanel.Layout = "table"; formPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); formPanel.Items.Add(new TextField() { FieldLabel = "用户名", AllowBlank = false, ColSpan = 2, Name = "Username" }); formPanel.Items.Add(new TextField() { FieldLabel = "密码", AllowBlank = false, ColSpan = 2, InputType = Ext.Net.InputType.Password, Name = "Password" }); formPanel.Items.Add(new TextField() { FieldLabel = "验证码", AllowBlank = false, ColSpan = 1, InputType = Ext.Net.InputType.Text, Name = "VerifyCode" }); imgVerify = new Ext.Net.Image() { Width = 100, ImageUrl = "login.aspx?action=VerifyImage", Height = 22, ColSpan = 1, ID = "imgVerify" }; formPanel.Items.Add(imgVerify); window.Items.Add(formPanel); loginForm.Controls.Add(window); btnChangeImage = new Ext.Net.Button(); btnChangeImage.Text = "更换验证码"; btnChangeImage.OnClientClick = "App.direct.ChangeImage();"; window.Buttons.Add(btnChangeImage); btnLogin = new KeyGoButton(); btnLogin.Text = "登录"; btnLogin.ID = "btnLogin"; btnLogin.OnClientClick = "App.direct.Login();"; window.Buttons.Add(btnLogin); }
/// <summary> /// Carrega o menu do projeto /// </summary> private void CarregarMenu() { List<MenuPaginaVO> lstMenuPai = new List<MenuPaginaVO>(); SetMenuPaginaPai(lstMenuPai, null); lstMenuPai = lstMenuPai.OrderByDescending(x=> x.Ordem).Distinct(new KeyEqualityComparer<MenuPaginaVO>(x => x.Id)).ToList(); foreach (MenuPaginaVO mp in lstMenuPai) { if (!mp.EmMenu) continue; if (mp.MenuPaginas.Count == 0) { Ext.Net.Button btn = new Ext.Net.Button(); btn.Text = mp.Descricao; btn.Icon = mp.Icone.IsNullOrEmpty() ? Icon.None : (Icon)Enum.Parse(typeof(Icon), mp.Icone); if (!String.IsNullOrEmpty(mp.Url)) btn.Listeners.Click.Handler = "window.location = '" + mp.Url + "';"; toolbarMenu.Items.Insert(0, btn); } else { Ext.Net.SplitButton btn = new Ext.Net.SplitButton(); btn.Text = mp.Descricao; if (mp.MenuPaginas.Count > 0) { Ext.Net.Menu menu = new Ext.Net.Menu(); CarregarSubMenu(menu, mp.MenuPaginas); btn.Menu.Add(menu); } btn.Icon = mp.Icone.IsNullOrEmpty() ? Icon.None : (Icon)Enum.Parse(typeof(Icon), mp.Icone); if (!String.IsNullOrEmpty(mp.Url)) btn.Listeners.Click.Handler = "window.location = '" + mp.Url + "';"; toolbarMenu.Items.Insert(0, btn); } AdicionarIcones(mp); } }
public void OpenZonesPanel(int id) { ContentItem contentItem = Engine.Persister.Get(id); TreePanel treePanel = new TreePanel { ID = "trpManageZones", Icon = Icon.ApplicationSideBoxes, Title = contentItem.Title + " Zones", Region = Region.East, AutoScroll = true, UseArrows = true, RootVisible = false, BodyStyle="padding-top:5px", Split = true, MinWidth = 150, Width = 175, MaxWidth = 300, Collapsible = true, CloseAction = CloseAction.Close, EnableDD = true }; IMainInterface mainInterface = (IMainInterface) Page; mainInterface.Viewport.Items.Add(treePanel); treePanel.Tools.Add(new Tool(ToolType.Close, "panel.hide(); " + mainInterface.Viewport.ClientID + ".doLayout();", string.Empty)); // Setup tree top toolbar. var topToolbar = new Toolbar(); treePanel.TopBar.Add(topToolbar); var addButton = new Button { ID = "addButton", Icon = Icon.Add, Disabled = true }; addButton.ToolTips.Add(new ToolTip { Html = "Add New Widget" }); addButton.Listeners.Click.Fn = "function(button) { top.zeus.reloadContentPanel('New Widget', " + treePanel.ClientID + ".getSelectionModel().getSelectedNode().attributes['newItemUrl']); }"; topToolbar.Items.Add(addButton); treePanel.Listeners.Click.Handler = "Ext.getCmp('" + addButton.ClientID + "').setDisabled(node.isLeaf());"; if (Engine.SecurityManager.IsAuthorized(contentItem, Context.User, Operations.Delete)) { var deleteButton = new Button { ID = "deleteButton", Icon = Icon.Delete, Disabled = true }; deleteButton.ToolTips.Add(new ToolTip { Html = "Delete Widget" }); deleteButton.Listeners.Click.Fn = string.Format(@" function(button) {{ var node = {0}.getSelectionModel().getSelectedNode(); stbStatusBar.showBusy('Deleting...'); Ext.net.DirectMethods.ManageZones.DeleteWidget(node.id, {{ url : '{1}', success: function() {{ node.parentNode.removeChild(node); stbStatusBar.setStatus({{ text: 'Deleted Widget', iconCls: '', clear: true }}); top.zeus.reloadContentPanel('Preview', '{2}'); }} }}); }}", treePanel.ClientID, Engine.AdminManager.GetAdminDefaultUrl(), contentItem.Url); topToolbar.Items.Add(deleteButton); treePanel.Listeners.Click.Handler += "Ext.getCmp('" + deleteButton.ClientID + "').setDisabled(!node.isLeaf());"; } treePanel.Listeners.MoveNode.Handler = string.Format(@" {0}.showBusy(); Ext.net.DirectMethods.ManageZones.MoveWidget(node.id, newParent.id, index, {{ url: '{1}', success: function() {{ {0}.setStatus({{ text: 'Moved Widget', iconCls: '', clear: true }}); }} }})", mainInterface.StatusBar.ClientID, Engine.AdminManager.GetAdminDefaultUrl()); ContentType definition = Zeus.Context.ContentTypes.GetContentType(contentItem.GetType()); var rootNode = new TreeNode { Expanded = true }; foreach (var availableZone in definition.AvailableZones) { var zoneNode = new TreeNode { NodeID = availableZone.ZoneName, Expanded = true, IconFile = Utility.GetCooliteIconUrl(Icon.ApplicationSideList), Text = availableZone.Title, Leaf = false }; zoneNode.CustomAttributes.Add(new ConfigItem("newItemUrl", GetPageUrl(typeof(ManageZonesUserControl), "Zeus.Admin.Plugins.NewItem.Default.aspx") + "?selected=" + contentItem.Path + "&zoneName=" + availableZone.ZoneName, ParameterMode.Value)); rootNode.Nodes.Add(zoneNode); foreach (var widget in GetItemsInZone(contentItem, availableZone)) { var widgetNode = new TreeNode { NodeID = widget.ID.ToString(), Leaf = true, Text = widget.Title, IconFile = widget.IconUrl, Href = string.Format("javascript: top.zeus.reloadContentPanel('Edit', '{0}');", GetPageUrl(typeof(ManageZonesUserControl), "Zeus.Admin.Plugins.EditItem.Default.aspx") + "?selected=" + widget.Path) }; zoneNode.Nodes.Add(widgetNode); } } treePanel.Root.Add(rootNode); treePanel.Render(); }
/// <summary> /// Carrega os favoritos do usuario /// </summary> private void CarregarFavoritos() { if (UsuarioLogado.Paginas.Count > 0) { UsuarioLogado.Paginas.ToList().ForEach(x=> x.QtdAcessos = UsuarioLogado.Paginas.Count(x1=> x1.MenuPagina.Id == x.MenuPagina.Id)); UsuarioLogado.Paginas = UsuarioLogado.Paginas.OrderByDescending(x => x.QtdAcessos).ToList(); UsuarioLogado.Paginas = UsuarioLogado.Paginas.Distinct(new KeyEqualityComparer<MenuPaginaUsuarioVO>(x => x.MenuPagina.Id)).ToList(); UsuarioLogado.Paginas = UsuarioLogado.Paginas.Take(6).ToList(); List<MenuPaginaVO> paginas = UsuarioLogado.Paginas.Select(x => x.MenuPagina).ToList(); TableLayout tableFavoritos = new TableLayout(); tableFavoritos.Columns = paginas.Count; foreach (MenuPaginaVO p in paginas) { Cell cell = new Cell(); Ext.Net.Button btn = new Ext.Net.Button(p.Descricao); btn.Height = 30; btn.MinWidth = 80; btn.Icon = p.Icone.IsNullOrEmpty() ? Icon.None : (Icon)Enum.Parse(typeof(Icon), p.Icone); btn.Listeners.Click.Handler = "window.location = '" + p.Url + "';"; cell.Items.Add(btn); tableFavoritos.Cells.Add(cell); } btnGroupFavoritos.Items.Add(tableFavoritos); btnGroupFavoritos.Visible = true; } else btnGroupFavoritos.Visible = false; }
public void AddCol(string StoreData, string header0string, string header1string, string header2string, string DSTN, string LeaveDate1, string LeaveDate2) { StoreSubmitDataEventArgs eSubmit = new StoreSubmitDataEventArgs(StoreData, null); XmlNode xml = eSubmit.Xml; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml.InnerXml); int dtcol = doc.SelectNodes("records").Item(0).SelectNodes("record").Item(0).ChildNodes.Count; int colc = (dtcol - 3) / 2; DataTable dt = new DataTable(); Store2.Reader[0].Fields.Add("Category", RecordFieldType.String); dt.Columns.Add(doc.SelectNodes("records").Item(0).SelectNodes("record").Item(0).ChildNodes[0].Name, typeof(String)); for (int i = 0; i < (dtcol - 3) / 2; i++) { Store2.Reader[0].Fields.Add("Station_" + i.ToString() + "_P", RecordFieldType.String); Store2.Reader[0].Fields.Add("Station_" + i.ToString() + "_C", RecordFieldType.String); dt.Columns.Add("Station_" + i.ToString() + "_P", typeof(String)); dt.Columns.Add("Station_" + i.ToString() + "_C", typeof(String)); } string fieldPNameNew = "Station_" + colc.ToString() + "_P"; Store2.Reader[0].Fields.Add(fieldPNameNew, RecordFieldType.String); string fieldCNameNew = "Station_" + colc.ToString() + "_C"; Store2.Reader[0].Fields.Add(fieldCNameNew, RecordFieldType.String); dt.Columns.Add(fieldPNameNew, typeof(String)); dt.Columns.Add(fieldCNameNew, typeof(String)); //合计列 Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String); Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String); dt.Columns.Add("TotalP", typeof(String)); dt.Columns.Add("TotalC", typeof(String)); //decimal row0Psum = 0, row0Csum = 0, row1Psum = 0, row1Csum = 0, row2Psum = 0, row2Csum = 0, row3Psum = 0, row3Csum = 0, row4Psum = 0, row4Csum = 0, row5Psum = 0, row5Csum = 0, row6Psum = 0, row6Csum = 0, row7Psum = 0, row7Csum = 0, row8Psum = 0, row8Csum = 0, row9Psum = 0, row9Csum = 0, row10Psum = 0, row10Csum = 0; for (int i = 0; i < doc.SelectNodes("records").Item(0).SelectNodes("record").Count - 1; i++) { DataRow dr = dt.NewRow(); dt.Rows.Add(dr); for (int j = 0; j < dtcol - 3; j++) { string wr = doc.SelectNodes("records").Item(0).SelectNodes("record").Item(i).ChildNodes[j].InnerText; dt.Rows[i][j] = doc.SelectNodes("records").Item(0).SelectNodes("record").Item(i).ChildNodes[j].InnerText; } } dt.Rows.Add(dt.NewRow()); dt.Rows[11][0] = "Total"; for (int i = 0; i < 11; i++) { for (int j = 1; j < dtcol - 3; j++) { if (j % 2 == 1) { dt.Rows[i][dtcol - 1] = (Convert.ToDecimal(dt.Rows[i][dtcol - 1].ToString() == "" ? "0" : dt.Rows[i][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[i][dtcol - 1].ToString() == "" ? "0" : dt.Rows[i][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString(); dt.Rows[11][dtcol - 1] = (Convert.ToDecimal(dt.Rows[11][dtcol - 1].ToString() == "" ? "0" : dt.Rows[11][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[11][dtcol - 1].ToString() == "" ? "0" : dt.Rows[11][dtcol - 1].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString(); } else { dt.Rows[i][dtcol] = (Convert.ToDecimal(dt.Rows[i][dtcol].ToString() == "" ? "0" : dt.Rows[i][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[i][dtcol].ToString() == "" ? "0" : dt.Rows[i][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString(); dt.Rows[11][dtcol] = (Convert.ToDecimal(dt.Rows[11][dtcol].ToString() == "" ? "0" : dt.Rows[11][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[11][dtcol].ToString() == "" ? "0" : dt.Rows[11][dtcol].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString(); } dt.Rows[11][j] = (Convert.ToDecimal(dt.Rows[11][j].ToString() == "" ? "0" : dt.Rows[11][j].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString() == "0" ? "" : (Convert.ToDecimal(dt.Rows[11][j].ToString() == "" ? "0" : dt.Rows[11][j].ToString()) + Convert.ToDecimal(dt.Rows[i][j].ToString() == "" ? "0" : dt.Rows[i][j].ToString())).ToString(); } } Store2.DataSource = dt; Store2.DataBind(); var TitleCol = new Column(); TitleCol.DataIndex = "Category"; TitleCol.Sortable = false; TitleCol.Resizable = false; TitleCol.MenuDisabled = true; TitleCol.Width = 180; this.GridPanel2.ColumnModel.Columns.Add(TitleCol); var Title1 = new Ext.Net.Label(); Title1.Text = "Destination:"; HeaderColumn hcTitle1 = new HeaderColumn(); hcTitle1.Component.Add(Title1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1); var Title2 = new Ext.Net.Label(); Title2.Text = "Cost Center:"; HeaderColumn hcTitle2 = new HeaderColumn(); hcTitle2.Component.Add(Title2); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2); var Title3 = new Ext.Net.Label(); Title3.Text = "Travel Period:"; HeaderColumn hcTitle3 = new HeaderColumn(); hcTitle3.Component.Add(Title3); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3); //取得出差站点列表 DataSet GetCityInfo = DIMERCO.SDK.Utilities.LSDK.GetCityInfo("", 8000); DataTable dtstation = GetCityInfo.Tables[0]; //取得成本中心列表 DataSet GetCCInfo = DIMERCO.SDK.Utilities.LSDK.getCostCenterBYStationCode("", 8000); DataTable dtCC = GetCCInfo.Tables[0]; for (int i = 0; i < colc; i++)//准备复制已有信息 { string fieldPName = "Station_" + i.ToString() + "_P"; //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float); //Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.Float); //this.Store2.AddField(field1, columncount); string fieldCName = "Station_" + i.ToString() + "_C"; //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float); //Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.Float); var txtP = new Ext.Net.NumberField(); //txtP.Listeners.Blur.Fn = "Cal"; var colP = new Column(); colP.Header = "Person Pay"; colP.DataIndex = fieldPName; colP.Sortable = false; colP.Resizable = false; colP.MenuDisabled = true; colP.Width = 110; colP.Editor.Add(txtP); this.GridPanel2.ColumnModel.Columns.Add(colP); var txtC = new Ext.Net.NumberField(); //txtC.Listeners.Blur.Fn = "Cal"; var colC = new Column(); colC.Header = "Company Pay"; colC.DataIndex = fieldCName; colC.Sortable = false; colC.Resizable = false; colC.MenuDisabled = true; colC.Width = 110; colC.Editor.Add(txtC); this.GridPanel2.ColumnModel.Columns.Add(colC); var Station = new Ext.Net.TextField(); if (header0string.Split(',')[i] != "NA") { Station.Text = header0string.Split(',')[i]; } HeaderColumn hcStation = new HeaderColumn(); hcStation.Component.Add(Station); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation); var Button = new Ext.Net.Button(); Button.Text = "Remove"; Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");"; Button.Listeners.Click.Delay = 50; HeaderColumn hcButton = new HeaderColumn(); hcButton.Component.Add(Button); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton); var CostCenter = new Ext.Net.TextField(); CostCenter.Disabled = true; CostCenter.EmptyText = "Station Code"; if (header1string.Split(',')[i] != "NA") { CostCenter.Text = header1string.Split(',')[i]; } HeaderColumn hcCostCenter = new HeaderColumn(); hcCostCenter.Component.Add(CostCenter); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter); var ButtonGetSum = new Ext.Net.Button(); ButtonGetSum.Text = "Calculate"; ButtonGetSum.Listeners.Click.Handler = "GetSum();"; ButtonGetSum.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSum = new HeaderColumn(); hcButtonGetSum.Component.Add(ButtonGetSum); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum); var datefrom = new DateField(); if (header2string.Split(',')[i * 2] != "NA") { datefrom.SetValue(header2string.Split(',')[i * 2]); } datefrom.EmptyText = "yyyy/MM/dd"; datefrom.Format = "yyyy/MM/dd"; HeaderColumn Date1 = new HeaderColumn(); Date1.Component.Add(datefrom); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1); var dateto = new DateField(); if (header2string.Split(',')[i * 2 + 1] != "NA") { dateto.SetValue(header2string.Split(',')[i * 2 + 1]); } dateto.EmptyText = "yyyy/MM/dd"; dateto.Format = "yyyy/MM/dd"; HeaderColumn Date2 = new HeaderColumn(); Date2.Component.Add(dateto); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2); } var txtPNew = new Ext.Net.NumberField(); //txtPNew.Listeners.Blur.Fn = "Cal"; var colPNew = new Column(); colPNew.Header = "Person Pay"; colPNew.DataIndex = fieldPNameNew; colPNew.Sortable = false; colPNew.Resizable = false; colPNew.MenuDisabled = true; colPNew.Width = 110; colPNew.Editor.Add(txtPNew); this.GridPanel2.ColumnModel.Columns.Add(colPNew); var txtCNew = new Ext.Net.NumberField(); //txtCNew.Listeners.Blur.Fn = "Cal"; var colCNew = new Column(); colCNew.Header = "Company Pay"; colCNew.DataIndex = fieldCNameNew; colCNew.Sortable = false; colCNew.Resizable = false; colCNew.MenuDisabled = true; colCNew.Width = 110; colCNew.Editor.Add(txtCNew); this.GridPanel2.ColumnModel.Columns.Add(colCNew); var TotalP = new Ext.Net.TextField(); TotalP.ReadOnly = true; TotalP.Cls = "custom-row"; var colTotalP = new Column(); colTotalP.DataIndex = "TotalP"; colTotalP.Sortable = false; colTotalP.Resizable = false; colTotalP.MenuDisabled = true; colTotalP.Width = 110; colTotalP.Locked = true; colTotalP.Editor.Add(TotalP); this.GridPanel2.ColumnModel.Columns.Add(colTotalP); var TotalC = new Ext.Net.TextField(); TotalC.ReadOnly = true; TotalC.Cls = "custom-row"; var colTotalC = new Column(); colTotalC.DataIndex = "TotalC"; colTotalC.Sortable = false; colTotalC.Resizable = false; colTotalC.MenuDisabled = true; colTotalC.Width = 110; colTotalC.Locked = true; colTotalC.Editor.Add(TotalC); this.GridPanel2.ColumnModel.Columns.Add(colTotalC); var StationNew = new Ext.Net.TextField(); StationNew.Text = DSTN; HeaderColumn hcStationNew = new HeaderColumn(); hcStationNew.Component.Add(StationNew); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStationNew); var ButtonNew = new Ext.Net.Button(); ButtonNew.Text = "Remove"; ButtonNew.Listeners.Click.Handler = "removecol(this," + colc.ToString() + ");"; ButtonNew.Listeners.Click.Delay = 50; HeaderColumn hcButtonNew = new HeaderColumn(); hcButtonNew.Component.Add(ButtonNew); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButtonNew); HeaderColumn hcTotal1 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1); HeaderColumn hcTotal2 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2); var CostCenterNew = new Ext.Net.TextField(); CostCenterNew.Disabled = true; CostCenterNew.EmptyText = "Station Code"; HeaderColumn hcCostCenterNew = new HeaderColumn(); hcCostCenterNew.Component.Add(CostCenterNew); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenterNew); //HeaderColumn hcCostCenter1New = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1New); var ButtonGetSumNew = new Ext.Net.Button(); ButtonGetSumNew.Text = "Calculate"; ButtonGetSumNew.Listeners.Click.Handler = "GetSum();"; ButtonGetSumNew.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSumNew = new HeaderColumn(); hcButtonGetSumNew.Component.Add(ButtonGetSumNew); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSumNew); HeaderColumn hcTotal3 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3); HeaderColumn hcTotal4 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4); var dateFromNew = new DateField(); dateFromNew.EmptyText = "yyyy/MM/dd"; dateFromNew.Format = "yyyy/MM/dd"; dateFromNew.SetValue(LeaveDate1); HeaderColumn Date1New = new HeaderColumn(); Date1New.Component.Add(dateFromNew); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1New); var datetoNew = new DateField(); datetoNew.EmptyText = "yyyy/MM/dd"; datetoNew.Format = "yyyy/MM/dd"; datetoNew.SetValue(LeaveDate2); HeaderColumn Date2New = new HeaderColumn(); Date2New.Component.Add(datetoNew); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2New); var TitleTotalP = new Ext.Net.Label(); TitleTotalP.Text = "Total(Person)"; TitleTotalP.Cls = "custom-row"; HeaderColumn hcTitleTotalP = new HeaderColumn(); hcTitleTotalP.Component.Add(TitleTotalP); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP); var TitleTotalC = new Ext.Net.Label(); TitleTotalC.Text = "Total(Comp)"; TitleTotalC.Cls = "custom-row"; HeaderColumn hcTitleTotalC = new HeaderColumn(); hcTitleTotalC.Component.Add(TitleTotalC); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC); //HeaderColumn hcTotal5 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal5); //HeaderColumn hcTotal6 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal6); this.GridPanel2.Render(); //Store store2 = this.GridPanel2.GetStore(); //this.GridPanel2.RefreshView(); GridPanel2.Reconfigure(); //string last = (dtcol - 1).ToString(); //string sf = "$(\"#\"+$('#GridPanel2 .x-grid3-col-" + last + " input')[0].id).css('font-weight','bold')"; //X.AddScript(sf); }
protected void LoadData(DataTable dt, bool CheckCopy) { string ID = dt.Rows[0]["RequestID"].ToString(); cs.DBCommand dbc = new cs.DBCommand(); //cbxOwner.SelectedItem.Value = dt.Rows[0]["PersonID"].ToString(); if (CheckCopy)//根据Copy判断是否需要判断Copy状态 { if (Request.QueryString["Copy"] != null) { if (Request.QueryString["Copy"].ToString() == "T")//Copy而已,作为新增 { hdTravelRequestID.Value = ""; hdTravelRequestNo.Value = ""; if (Request.QueryString["CopyType"] != null) { if (Request.QueryString["CopyType"].ToString() == "A") { if (dt.Rows[0]["ReportFile"].ToString() != "") { linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString(); linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString(); hdReport.Value = dt.Rows[0]["ReportFile"].ToString(); } if (dt.Rows[0]["Attach"].ToString() != "") { linkScanFile.Text = dt.Rows[0]["Attach"].ToString(); linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString(); hdScanFile.Value = dt.Rows[0]["Attach"].ToString(); } } } } else { ErrorHandle("Data Error."); } } else { //labelOwner.Text = dt.Rows[0]["Person"].ToString(); //hdOwner.Value = dt.Rows[0]["Person"].ToString(); //hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString(); //labelStation.Text = dt.Rows[0]["Station"].ToString(); //labelDepartment.Text = dt.Rows[0]["Department"].ToString(); //获取该人币种 //LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt.Rows[0]["Station"].ToString()); //hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt.Rows[0]["Station"].ToString()), 3); //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString()); //if (ds1.Tables[0].Rows.Count == 1) //{ // DataTable dt1 = ds1.Tables[0]; // LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["stationCode"].ToString()); // hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt1.Rows[0]["stationCode"].ToString()), 3); // DataTable dttemp = new DataTable(); // string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'"; // dttemp = dbc.GetData("eReimbursement", sqltemp); // if (dttemp.Rows.Count > 0) // { // LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dttemp.Rows[0]["Station"].ToString()); // hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dttemp.Rows[0]["Station"].ToString()), 3); // } //} //else //{ // ErrorHandle("Data Error."); return; //} hdTravelRequestID.Value = ID; hdTravelRequestNo.Value = dt.Rows[0]["No"].ToString(); if (dt.Rows[0]["ReportFile"].ToString() != "") { linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString(); linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString(); hdReport.Value = dt.Rows[0]["ReportFile"].ToString(); } if (dt.Rows[0]["Attach"].ToString() != "") { linkScanFile.Text = dt.Rows[0]["Attach"].ToString(); linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString(); hdScanFile.Value = dt.Rows[0]["Attach"].ToString(); } X.AddScript("btnExport.enable();"); } } else { //labelOwner.Text = dt.Rows[0]["Person"].ToString(); //hdOwner.Value = dt.Rows[0]["Person"].ToString(); //hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString(); //labelStation.Text = dt.Rows[0]["Station"].ToString(); //labelDepartment.Text = dt.Rows[0]["Department"].ToString(); //获取该人币种 //LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt.Rows[0]["Station"].ToString()); //hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt.Rows[0]["Station"].ToString()), 3); //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString()); //if (ds1.Tables[0].Rows.Count == 1) //{ // DataTable dt1 = ds1.Tables[0]; // LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["stationCode"].ToString()); // hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dt1.Rows[0]["stationCode"].ToString()), 3); // DataTable dttemp = new DataTable(); // string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'"; // dttemp = dbc.GetData("eReimbursement", sqltemp); // if (dttemp.Rows.Count > 0) // { // LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dttemp.Rows[0]["Station"].ToString()); // hdCurrency.Value = System.Math.Round(1 / DIMERCO.SDK.Utilities.LSDK.GetLatestStationUSDConvertRate(dttemp.Rows[0]["Station"].ToString()), 3); // } //} //else //{ // ErrorHandle("Data Error."); return; //} hdTravelRequestID.Value = ID; hdTravelRequestNo.Value = dt.Rows[0]["No"].ToString(); if (dt.Rows[0]["ReportFile"].ToString() != "") { linkTravelReport.Text = dt.Rows[0]["ReportFile"].ToString(); linkTravelReport.NavigateUrl = "./Upload/" + dt.Rows[0]["ReportFile"].ToString(); hdReport.Value = dt.Rows[0]["ReportFile"].ToString(); } if (dt.Rows[0]["Attach"].ToString() != "") { linkScanFile.Text = dt.Rows[0]["Attach"].ToString(); linkScanFile.NavigateUrl = "./Upload/" + dt.Rows[0]["Attach"].ToString(); hdScanFile.Value = dt.Rows[0]["Attach"].ToString(); } } //Radio1.Checked = dt.Rows[0]["Budget"].ToString() == "1" ? true : false; //Radio2.Checked = dt.Rows[0]["Budget"].ToString() != "1" ? true : false; //cbxBudget.SelectedItem.Value = dt.Rows[0]["Budget"].ToString() == "1" ? "YES" : "NO"; ////获取该人币种 //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dt.Rows[0]["PersonID"].ToString()); //if (ds1.Tables[0].Rows.Count == 1) //{ // DataTable dt1 = ds1.Tables[0]; // LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(dt1.Rows[0]["CostCenter"].ToString()); // DataTable dttemp = new DataTable(); // string sqltemp = "select * from ESUSER where Userid='" + dt.Rows[0]["PersonID"].ToString() + "'"; // dttemp = dbc.GetData("eReimbursement", sqltemp); // if (dttemp.Rows.Count > 0) // { // LabelCurrency.Text = dttemp.Rows[0]["Currency"].ToString(); // } //} //else //{ // ErrorHandle("Data Error."); return; //} //载入已经保存的基本信息 labelOwner.Text = dt.Rows[0]["Person"].ToString(); hdOwner.Value = dt.Rows[0]["Person"].ToString(); hdOwnerID.Value = dt.Rows[0]["PersonID"].ToString(); labelStation.Text = dt.Rows[0]["Station"].ToString(); labelDepartment.Text = dt.Rows[0]["Department"].ToString(); //组合数据 DataTable dtnew = new DataTable(); Store2.Reader[0].Fields.Add("Category", RecordFieldType.String); dtnew.Columns.Add("Category", typeof(String)); dtnew.Columns.Add("TotalP", typeof(String)); dtnew.Columns.Add("TotalC", typeof(String)); //默认12行 for (int i = 0; i < 12; i++) { DataRow dr = dtnew.NewRow(); dtnew.Rows.Add(dr); } //默认第一列是标题 dtnew.Rows[0][0] = "1. Air Ticket - Int'l"; dtnew.Rows[1][0] = "Air Ticket - Domestic"; dtnew.Rows[2][0] = "2. Hotel Bill"; dtnew.Rows[3][0] = "3. Meals"; dtnew.Rows[4][0] = "4. Entertainment"; dtnew.Rows[5][0] = "5. Car Rental/Transportation"; dtnew.Rows[6][0] = "6. Communication"; dtnew.Rows[7][0] = "7. Local Trip Allowance"; dtnew.Rows[8][0] = "8. Overseas Trip Allowance"; dtnew.Rows[9][0] = "9. Airport Tax/Travel Insurance"; dtnew.Rows[10][0] = "10. Others"; dtnew.Rows[11][0] = "Total"; string sqlf = "select distinct Tocity from ETraveleDetail where [No]='" + ID + "'"; DataTable dtf = dbc.GetData("eReimbursement", sqlf); string sqld = "select * from ETraveleDetail where [No]='" + ID + "' order by id"; DataTable dtall = new DataTable(); dtall = dbc.GetData("eReimbursement", sqld); LabelCurrency.Text = dtall.Rows[0]["Cur"].ToString();//读取费用明细中的本地币种显示 //140226 显示预算 DataTable dtbudget = new DataTable(); dtbudget.Columns.Add("EName", typeof(System.String)); dtbudget.Columns.Add("Type", typeof(System.String)); dtbudget.Columns.Add("Current", typeof(System.Decimal)); dtbudget.Columns.Add("PU", typeof(System.Decimal)); dtbudget.Columns.Add("PB", typeof(System.Decimal)); dtbudget.Columns.Add("PPercent", typeof(System.Decimal)); dtbudget.Columns.Add("DU", typeof(System.Decimal)); dtbudget.Columns.Add("DB", typeof(System.Decimal)); dtbudget.Columns.Add("DPercent", typeof(System.Decimal)); dtbudget.Columns.Add("SU", typeof(System.Decimal)); dtbudget.Columns.Add("SB", typeof(System.Decimal)); dtbudget.Columns.Add("SPercent", typeof(System.Decimal)); //StoreBudget添加Field StoreBudget.Reader[0].Fields.Add("EName", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("Type", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("Current", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("PU", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("PB", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("PPercent", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("DU", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("DB", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("DPercent", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("SU", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("SB", RecordFieldType.String); StoreBudget.Reader[0].Fields.Add("SPercent", RecordFieldType.String); //取得预算日期 string sqlA = "select convert(varchar(10),min(Tdate0),111) as BudgetDate from ETraveleDetail where No='" + ID + "'"; DataTable dtA = dbc.GetData("eReimbursement", sqlA); //取得4大类合计 //string sqlB = "select sum(T1) as T1,sum(T2) as T2,sum(T3) as T3,sum(T4) as T4 from (select case when AccountCode='62012000' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T1],case when AccountCode='62010900' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T2],case when AccountCode='62011900' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T3],case when AccountCode='62010500' then isnull(Pamount,0)+isnull(Camount,0) else 0 end as [T4] from ETraveleDetail where No=" + ID + ") t"; string sqlB = "select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62010900' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62012000' union all select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62011900' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62010900' union all select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62010500' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62011900' union all select sum(isnull(Pamount,0)+isnull(Camount,0)) as Amount,'62012000' as Type from ETraveleDetail where No=" + ID + " and AccountCode='62010500'"; DataTable dtB = dbc.GetData("eReimbursement", sqlB); //取得传递预算的参数 string userid = dt.Rows[0]["PersonID"].ToString(); string dpt = dt.Rows[0]["Department"].ToString(); string ostation = dt.Rows[0]["CostCenter"].ToString();//预算站点,与基本信息中的CostCenter一致(Station2) string tstation = ostation;//Etravel表中的Station2,目前与预算站点一致,不允许更改 string year = Convert.ToDateTime(dtA.Rows[0]["BudgetDate"].ToString()).Year.ToString(); string month = Convert.ToDateTime(dtA.Rows[0]["BudgetDate"].ToString()).Month.ToString(); string accountcode = ""; for (int g = 0; g < dtB.Rows.Count; g++) { if (Convert.ToDecimal(dtB.Rows[g]["Amount"].ToString()) != 0) { DataRow dr = dtbudget.NewRow(); dr["Current"] = Convert.ToDecimal(dtB.Rows[g]["Amount"].ToString()); dr["Type"] = dtB.Rows[g]["Type"].ToString(); accountcode = dtB.Rows[g]["Type"].ToString(); DataTable dtC = new DataTable(); dtC = Comm.RtnEB(userid, dpt, ostation, tstation, accountcode, year, month); for (int i = 0; i < dtC.Rows.Count; i++) { if (dtC.Rows[i]["Type"].ToString() == "全年个人") { dr["PU"] = Convert.ToDecimal(dtC.Rows[i]["Used"].ToString()); dr["PB"] = Convert.ToDecimal(dtC.Rows[i]["Budget"].ToString()); } else if (dtC.Rows[i]["Type"].ToString() == "全年部门") { dr["DU"] = Convert.ToDecimal(dtC.Rows[i]["Used"].ToString()); dr["DB"] = Convert.ToDecimal(dtC.Rows[i]["Budget"].ToString()); } else if (dtC.Rows[i]["Type"].ToString() == "全年站点") { dr["SU"] = Convert.ToDecimal(dtC.Rows[i]["Used"].ToString()); dr["SB"] = Convert.ToDecimal(dtC.Rows[i]["Budget"].ToString()); } } dtbudget.Rows.Add(dr); } } //计算%,取得名称 for (int i = 0; i < dtbudget.Rows.Count; i++) { if (Convert.ToDecimal(dtbudget.Rows[i]["PB"].ToString()) != 0)//如果Budget不为0,则计算% { dtbudget.Rows[i]["PPercent"] = System.Math.Round(Convert.ToDecimal(dtbudget.Rows[i]["PU"].ToString()) / Convert.ToDecimal(dtbudget.Rows[i]["PB"].ToString()), 4) * 100; } if (Convert.ToDecimal(dtbudget.Rows[i]["DB"].ToString()) != 0)//如果Budget不为0,则计算% { dtbudget.Rows[i]["DPercent"] = System.Math.Round(Convert.ToDecimal(dtbudget.Rows[i]["DU"].ToString()) / Convert.ToDecimal(dtbudget.Rows[i]["DB"].ToString()), 4) * 100; } if (Convert.ToDecimal(dtbudget.Rows[i]["SB"].ToString()) != 0)//如果Budget不为0,则计算% { dtbudget.Rows[i]["SPercent"] = System.Math.Round(Convert.ToDecimal(dtbudget.Rows[i]["SU"].ToString()) / Convert.ToDecimal(dtbudget.Rows[i]["SB"].ToString()), 4) * 100; } if (dtbudget.Rows[i]["Type"].ToString()=="62010900") { dtbudget.Rows[i]["EName"] = "Travel expense"; } else if (dtbudget.Rows[i]["Type"].ToString() == "62011900") { dtbudget.Rows[i]["EName"] = "Entertainment"; } else if (dtbudget.Rows[i]["Type"].ToString() == "62010500") { dtbudget.Rows[i]["EName"] = "Transportation"; } else if (dtbudget.Rows[i]["Type"].ToString() == "62012000") { dtbudget.Rows[i]["EName"] = "Communication"; } } bool PB = false, DB = false, SB = false; for (int i = 0; i < dtbudget.Rows.Count; i++) { if (Convert.ToDecimal(dtbudget.Rows[i]["PB"].ToString()) != 0)//是否显示个人预算列 { PB = true; } if (Convert.ToDecimal(dtbudget.Rows[i]["DB"].ToString()) != 0)//是否显示部门预算列 { DB = true; } if (Convert.ToDecimal(dtbudget.Rows[i]["SB"].ToString()) != 0)//是否显示站点预算列 { SB = true; } } //添加数据列 var cm = GridPanelBudget.ColumnModel; cm.Columns.Add(new Column { DataIndex = "EName", Header = "Expense Item", Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "Current", Header = "Current", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); //显示个人预算部分 if (PB) { cm.Columns.Add(new Column { DataIndex = "PU", Header = "Personal Used", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "PB", Header = "Personal Budget", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "PPercent", Header = "%(Used/Budget)", Renderer = new Renderer { Fn = "GetNumberPercent" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); } if (DB) { cm.Columns.Add(new Column { DataIndex = "DU", Header = "Department Used", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "DB", Header = "Department Budget", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "DPercent", Header = "%(Used/Budget)", Renderer = new Renderer { Fn = "GetNumberPercent" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); } if (SB) { cm.Columns.Add(new Column { DataIndex = "SU", Header = "Unit Used", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "SB", Header = "Unit Budget", Renderer = new Renderer { Fn = "GetNumber" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); cm.Columns.Add(new Column { DataIndex = "SPercent", Header = "%(Used/Budget)", Renderer = new Renderer { Fn = "GetNumberPercent" }, Sortable = false, Resizable = false, MenuDisabled = true, Width = 100 }); } StoreBudget.DataSource = dtbudget; StoreBudget.DataBind(); // if (dtf.Rows.Count == 1) { for (int i = 0; i < dtall.Rows.Count; i++) { if (i % 11 == 0) { string colname = "Station_" + (i / 11).ToString() + "_P"; Store2.Reader[0].Fields.Add(colname, RecordFieldType.String); dtnew.Columns.Add(colname, typeof(String)); colname = "Station_" + (i / 11).ToString() + "_C"; Store2.Reader[0].Fields.Add(colname, RecordFieldType.String); dtnew.Columns.Add(colname, typeof(String)); } dtnew.Rows[i % 11][3 + i / 11 * 2] = dtall.Rows[i]["Pamount"].ToString(); dtnew.Rows[i % 11][3 + i / 11 * 2 + 1] = dtall.Rows[i]["Camount"].ToString(); //列合计 string df = dtnew.Rows[11][3 + i / 11 * 2].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2].ToString(); string cf = dtall.Rows[i]["Pamount"].ToString() == "" ? "0" : dtall.Rows[i]["Pamount"].ToString(); dtnew.Rows[11][3 + i / 11 * 2] = Convert.ToDecimal(df) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df) + Convert.ToDecimal(cf)).ToString(); string bf = dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString(); string af = dtall.Rows[i]["Camount"].ToString() == "" ? "0" : dtall.Rows[i]["Camount"].ToString(); dtnew.Rows[11][3 + i / 11 * 2 + 1] = Convert.ToDecimal(bf) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf) + Convert.ToDecimal(af)).ToString(); //行合计 string df1 = dtnew.Rows[i % 11][1].ToString() == "" ? "0" : dtnew.Rows[i % 11][1].ToString(); dtnew.Rows[i % 11][1] = Convert.ToDecimal(df1) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df1) + Convert.ToDecimal(cf)).ToString(); string bf1 = dtnew.Rows[i % 11][2].ToString() == "" ? "0" : dtnew.Rows[i % 11][2].ToString(); dtnew.Rows[i % 11][2] = Convert.ToDecimal(bf1) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf1) + Convert.ToDecimal(af)).ToString(); //总合计 string tf = dtnew.Rows[11][1].ToString() == "" ? "0" : dtnew.Rows[11][1].ToString(); dtnew.Rows[11][1] = Convert.ToDecimal(tf) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(tf) + Convert.ToDecimal(cf)).ToString(); string ff = dtnew.Rows[11][2].ToString() == "" ? "0" : dtnew.Rows[11][2].ToString(); dtnew.Rows[11][2] = Convert.ToDecimal(ff) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(ff) + Convert.ToDecimal(af)).ToString(); } dtnew.Columns.Add("Station_1_P", typeof(String)); dtnew.Columns.Add("Station_1_C", typeof(String)); Store2.Reader[0].Fields.Add("Station_1_P", RecordFieldType.String); Store2.Reader[0].Fields.Add("Station_1_C", RecordFieldType.String); Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String); Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String); Store2.DataSource = dtnew; Store2.DataBind(); var TitleCol = new Column(); TitleCol.DataIndex = "Category"; TitleCol.Sortable = false; TitleCol.Resizable = false; TitleCol.MenuDisabled = true; TitleCol.Width = 180; this.GridPanel2.ColumnModel.Columns.Add(TitleCol); var Title1 = new Ext.Net.Label(); Title1.Text = "Destination:"; HeaderColumn hcTitle1 = new HeaderColumn(); hcTitle1.Component.Add(Title1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1); var Title2 = new Ext.Net.Label(); Title2.Text = "Cost Center:"; HeaderColumn hcTitle2 = new HeaderColumn(); hcTitle2.Component.Add(Title2); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2); var Title3 = new Ext.Net.Label(); Title3.Text = "Travel Period:"; HeaderColumn hcTitle3 = new HeaderColumn(); hcTitle3.Component.Add(Title3); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3); int colc = dtall.Rows.Count / 11; for (int i = 0; i < colc; i++)//准备复制已有信息 { string fieldPName = "Station_" + i.ToString() + "_P"; string fieldCName = "Station_" + i.ToString() + "_C"; var txtP = new Ext.Net.NumberField(); //txtP.Listeners.Blur.Fn = "Cal"; var colP = new Column(); colP.Header = "Person Pay"; colP.DataIndex = fieldPName; colP.Sortable = false; colP.Resizable = false; colP.MenuDisabled = true; colP.Width = 110; colP.Editor.Add(txtP); this.GridPanel2.ColumnModel.Columns.Add(colP); var txtC = new Ext.Net.NumberField(); //txtC.Listeners.Blur.Fn = "Cal"; var colC = new Column(); colC.Header = "Company Pay"; colC.DataIndex = fieldCName; colC.Sortable = false; colC.Resizable = false; colC.MenuDisabled = true; colC.Width = 110; colC.Editor.Add(txtC); this.GridPanel2.ColumnModel.Columns.Add(colC); var Station = new Ext.Net.TextField(); Station.Text = dtall.Rows[i * 11]["Tocity"].ToString(); HeaderColumn hcStation = new HeaderColumn(); hcStation.Component.Add(Station); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation); var Button = new Ext.Net.Button(); Button.Text = "Remove"; Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");"; Button.Listeners.Click.Delay = 50; HeaderColumn hcButton = new HeaderColumn(); hcButton.Component.Add(Button); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton); var CostCenter = new Ext.Net.TextField(); CostCenter.Disabled = true; CostCenter.EmptyText = "Station Code"; CostCenter.Text = dtall.Rows[i * 11]["TSation"].ToString(); HeaderColumn hcCostCenter = new HeaderColumn(); hcCostCenter.Component.Add(CostCenter); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter); //HeaderColumn hcCostCenter1 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1); var ButtonGetSum = new Ext.Net.Button(); ButtonGetSum.Text = "Calculate"; ButtonGetSum.Listeners.Click.Handler = "GetSum();"; ButtonGetSum.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSum = new HeaderColumn(); hcButtonGetSum.Component.Add(ButtonGetSum); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum); var datefrom = new DateField(); string dtfroms = dtall.Rows[i * 11]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate0"].ToString()).ToString("yyyy/MM/dd"); datefrom.SetValue(dtfroms); datefrom.EmptyText = "yyyy/MM/dd"; datefrom.Format = "yyyy/MM/dd"; HeaderColumn Date1 = new HeaderColumn(); Date1.Component.Add(datefrom); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1); var dateto = new DateField(); string datetos = dtall.Rows[i * 11]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate"].ToString()).ToString("yyyy/MM/dd"); dateto.SetValue(datetos); dateto.EmptyText = "yyyy/MM/dd"; dateto.Format = "yyyy/MM/dd"; HeaderColumn Date2 = new HeaderColumn(); Date2.Component.Add(dateto); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2); } var txtP1 = new Ext.Net.NumberField(); //txtP1.Listeners.Blur.Fn = "Cal"; //txtP1.Listeners.Blur.Delay = 50; var colP1 = new Column(); colP1.Header = "Person Pay"; colP1.DataIndex = "Station_1_P"; colP1.Sortable = false; colP1.Resizable = false; colP1.MenuDisabled = true; colP1.Width = 110; colP1.Locked = true; colP1.Editor.Add(txtP1); colP1.Hidden = true; this.GridPanel2.ColumnModel.Columns.Add(colP1); var txtC1 = new Ext.Net.NumberField(); //txtC1.Listeners.Blur.Fn = "Cal"; //txtC1.Listeners.Blur.Delay = 50; var colC1 = new Column(); colC1.Header = "Company Pay"; colC1.DataIndex = "Station_1_C"; colC1.Sortable = false; colC1.Resizable = false; colC1.MenuDisabled = true; colC1.Width = 110; colC1.Locked = true; colC1.Editor.Add(txtC1); colC1.Hidden = true; this.GridPanel2.ColumnModel.Columns.Add(colC1); var TotalP = new Ext.Net.TextField(); TotalP.ReadOnly = true; TotalP.Cls = "custom-row"; var colTotalP = new Column(); colTotalP.DataIndex = "TotalP"; colTotalP.Sortable = false; colTotalP.Resizable = false; colTotalP.MenuDisabled = true; colTotalP.Width = 110; colTotalP.Locked = true; colTotalP.Editor.Add(TotalP); this.GridPanel2.ColumnModel.Columns.Add(colTotalP); var TotalC = new Ext.Net.TextField(); TotalC.ReadOnly = true; TotalC.Cls = "custom-row"; var colTotalC = new Column(); colTotalC.DataIndex = "TotalC"; colTotalC.Sortable = false; colTotalC.Resizable = false; colTotalC.MenuDisabled = true; colTotalC.Width = 110; colTotalC.Locked = true; colTotalC.Editor.Add(TotalC); this.GridPanel2.ColumnModel.Columns.Add(colTotalC); var Station1 = new Ext.Net.TextField(); HeaderColumn hcStation1 = new HeaderColumn(); hcStation1.Component.Add(Station1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1); var CostCenter0 = new Ext.Net.TextField(); CostCenter0.Disabled = true; CostCenter0.EmptyText = "Station Code"; HeaderColumn hcCostCenter0 = new HeaderColumn(); hcCostCenter0.Component.Add(CostCenter0); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter0); HeaderColumn hcDate3 = new HeaderColumn(); var Date3 = new DateField(); Date3.EmptyText = "yyyy/MM/dd"; Date3.Format = "yyyy/MM/dd"; //Date3.SetValue("2013/11/1"); hcDate3.Component.Add(Date3); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate3); var Button1 = new Ext.Net.Button(); Button1.Text = "Remove"; Button1.Listeners.Click.Handler = "removecol(this,1);"; Button1.Listeners.Click.Delay = 50; HeaderColumn hcButton1 = new HeaderColumn(); hcButton1.Component.Add(Button1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton1); var ButtonGetSum1 = new Ext.Net.Button(); ButtonGetSum1.Text = "Calculate"; ButtonGetSum1.Listeners.Click.Handler = "GetSum();"; ButtonGetSum1.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSum1 = new HeaderColumn(); hcButtonGetSum1.Component.Add(ButtonGetSum1); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum1); HeaderColumn hcDate4 = new HeaderColumn(); var Date4 = new DateField(); Date4.EmptyText = "yyyy/MM/dd"; Date4.Format = "yyyy/MM/dd"; //Date4.SetValue("2013/11/2"); hcDate4.Component.Add(Date4); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate4); HeaderColumn hcTotal1 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1); HeaderColumn hcTotal3 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3); var TitleTotalP = new Ext.Net.Label(); TitleTotalP.Text = "Total(Person)"; TitleTotalP.Cls = "custom-row"; HeaderColumn hcTitleTotalP = new HeaderColumn(); hcTitleTotalP.Component.Add(TitleTotalP); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP); HeaderColumn hcTotal2 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2); HeaderColumn hcTotal4 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4); var TitleTotalC = new Ext.Net.Label(); TitleTotalC.Text = "Total(Comp)"; TitleTotalC.Cls = "custom-row"; HeaderColumn hcTitleTotalC = new HeaderColumn(); hcTitleTotalC.Component.Add(TitleTotalC); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC); X.AddScript("GridPanel2.colModel.setHidden(3, true);GridPanel2.colModel.setHidden(4, true);Store2.removeField('Station_1_P');Store2.removeField('Station_1_C');"); } else { //string sqld = "select * from ETraveleDetail where [No]='" + ID + "' order by id"; //DataTable dtall = new DataTable(); //dtall = dbc.GetData("eReimbursement", sqld); for (int i = 0; i < dtall.Rows.Count; i++) { if (i % 11 == 0) { string colname = "Station_" + (i / 11).ToString() + "_P"; Store2.Reader[0].Fields.Add(colname, RecordFieldType.String); dtnew.Columns.Add(colname, typeof(String)); colname = "Station_" + (i / 11).ToString() + "_C"; Store2.Reader[0].Fields.Add(colname, RecordFieldType.String); dtnew.Columns.Add(colname, typeof(String)); } dtnew.Rows[i % 11][3 + i / 11 * 2] = dtall.Rows[i]["Pamount"].ToString(); dtnew.Rows[i % 11][3 + i / 11 * 2 + 1] = dtall.Rows[i]["Camount"].ToString(); //列合计 string df = dtnew.Rows[11][3 + i / 11 * 2].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2].ToString(); string cf = dtall.Rows[i]["Pamount"].ToString() == "" ? "0" : dtall.Rows[i]["Pamount"].ToString(); dtnew.Rows[11][3 + i / 11 * 2] = Convert.ToDecimal(df) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df) + Convert.ToDecimal(cf)).ToString(); string bf = dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString() == "" ? "0" : dtnew.Rows[11][3 + i / 11 * 2 + 1].ToString(); string af = dtall.Rows[i]["Camount"].ToString() == "" ? "0" : dtall.Rows[i]["Camount"].ToString(); dtnew.Rows[11][3 + i / 11 * 2 + 1] = Convert.ToDecimal(bf) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf) + Convert.ToDecimal(af)).ToString(); //行合计 string df1 = dtnew.Rows[i % 11][1].ToString() == "" ? "0" : dtnew.Rows[i % 11][1].ToString(); dtnew.Rows[i % 11][1] = Convert.ToDecimal(df1) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(df1) + Convert.ToDecimal(cf)).ToString(); string bf1 = dtnew.Rows[i % 11][2].ToString() == "" ? "0" : dtnew.Rows[i % 11][2].ToString(); dtnew.Rows[i % 11][2] = Convert.ToDecimal(bf1) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(bf1) + Convert.ToDecimal(af)).ToString(); //总合计 string tf = dtnew.Rows[11][1].ToString() == "" ? "0" : dtnew.Rows[11][1].ToString(); dtnew.Rows[11][1] = Convert.ToDecimal(tf) + Convert.ToDecimal(cf) == 0 ? "" : (Convert.ToDecimal(tf) + Convert.ToDecimal(cf)).ToString(); string ff = dtnew.Rows[11][2].ToString() == "" ? "0" : dtnew.Rows[11][2].ToString(); dtnew.Rows[11][2] = Convert.ToDecimal(ff) + Convert.ToDecimal(af) == 0 ? "" : (Convert.ToDecimal(ff) + Convert.ToDecimal(af)).ToString(); } Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String); Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String); Store2.DataSource = dtnew; Store2.DataBind(); var TitleCol = new Column(); TitleCol.DataIndex = "Category"; TitleCol.Sortable = false; TitleCol.Resizable = false; TitleCol.MenuDisabled = true; TitleCol.Width = 180; this.GridPanel2.ColumnModel.Columns.Add(TitleCol); var Title1 = new Ext.Net.Label(); Title1.Text = "Destination:"; HeaderColumn hcTitle1 = new HeaderColumn(); hcTitle1.Component.Add(Title1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1); var Title2 = new Ext.Net.Label(); Title2.Text = "Cost Center:"; HeaderColumn hcTitle2 = new HeaderColumn(); hcTitle2.Component.Add(Title2); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2); var Title3 = new Ext.Net.Label(); Title3.Text = "Travel Period:"; HeaderColumn hcTitle3 = new HeaderColumn(); hcTitle3.Component.Add(Title3); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3); int colc = dtall.Rows.Count / 11; for (int i = 0; i < colc; i++)//准备复制已有信息 { string fieldPName = "Station_" + i.ToString() + "_P"; //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float); //Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.Float); //this.Store2.AddField(field1, columncount); string fieldCName = "Station_" + i.ToString() + "_C"; //RecordField field1 = new RecordField(fieldAName, RecordFieldType.Float); //Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.Float); var txtP = new Ext.Net.NumberField(); //txtP.Listeners.Blur.Fn = "Cal"; var colP = new Column(); colP.Header = "Person Pay"; colP.DataIndex = fieldPName; colP.Sortable = false; colP.Resizable = false; colP.MenuDisabled = true; colP.Width = 110; colP.Editor.Add(txtP); this.GridPanel2.ColumnModel.Columns.Add(colP); var txtC = new Ext.Net.NumberField(); //txtC.Listeners.Blur.Fn = "Cal"; var colC = new Column(); colC.Header = "Company Pay"; colC.DataIndex = fieldCName; colC.Sortable = false; colC.Resizable = false; colC.MenuDisabled = true; colC.Width = 110; colC.Editor.Add(txtC); this.GridPanel2.ColumnModel.Columns.Add(colC); var Station = new Ext.Net.TextField(); Station.Text = dtall.Rows[i * 11]["Tocity"].ToString(); HeaderColumn hcStation = new HeaderColumn(); hcStation.Component.Add(Station); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation); var Button = new Ext.Net.Button(); Button.Text = "Remove"; Button.Listeners.Click.Handler = "removecol(this," + i.ToString() + ");"; Button.Listeners.Click.Delay = 50; HeaderColumn hcButton = new HeaderColumn(); hcButton.Component.Add(Button); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton); var CostCenter = new Ext.Net.TextField(); CostCenter.Disabled = true; CostCenter.EmptyText = "Station Code"; CostCenter.Text = dtall.Rows[i * 11]["TSation"].ToString(); HeaderColumn hcCostCenter = new HeaderColumn(); hcCostCenter.Component.Add(CostCenter); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter); //HeaderColumn hcCostCenter1 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1); var ButtonGetSum = new Ext.Net.Button(); ButtonGetSum.Text = "Calculate"; ButtonGetSum.Listeners.Click.Handler = "GetSum();"; ButtonGetSum.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSum = new HeaderColumn(); hcButtonGetSum.Component.Add(ButtonGetSum); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum); var datefrom = new DateField(); string dtfroms = dtall.Rows[i * 11]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate0"].ToString()).ToString("yyyy/MM/dd"); datefrom.SetValue(dtfroms); datefrom.EmptyText = "yyyy/MM/dd"; datefrom.Format = "yyyy/MM/dd"; HeaderColumn Date1 = new HeaderColumn(); Date1.Component.Add(datefrom); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date1); var dateto = new DateField(); string datetos = dtall.Rows[i * 11]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtall.Rows[i * 11]["Tdate"].ToString()).ToString("yyyy/MM/dd"); dateto.SetValue(datetos); dateto.EmptyText = "yyyy/MM/dd"; dateto.Format = "yyyy/MM/dd"; HeaderColumn Date2 = new HeaderColumn(); Date2.Component.Add(dateto); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(Date2); } var TotalP = new Ext.Net.TextField(); TotalP.ReadOnly = true; TotalP.Cls = "custom-row"; var colTotalP = new Column(); colTotalP.DataIndex = "TotalP"; colTotalP.Sortable = false; colTotalP.Resizable = false; colTotalP.MenuDisabled = true; colTotalP.Width = 110; colTotalP.Locked = true; colTotalP.Editor.Add(TotalP); this.GridPanel2.ColumnModel.Columns.Add(colTotalP); var TotalC = new Ext.Net.TextField(); TotalC.ReadOnly = true; TotalC.Cls = "custom-row"; var colTotalC = new Column(); colTotalC.DataIndex = "TotalC"; colTotalC.Sortable = false; colTotalC.Resizable = false; colTotalC.MenuDisabled = true; colTotalC.Width = 110; colTotalC.Locked = true; colTotalC.Editor.Add(TotalC); this.GridPanel2.ColumnModel.Columns.Add(colTotalC); HeaderColumn hcTotal1 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1); HeaderColumn hcTotal2 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2); HeaderColumn hcTotal3 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3); HeaderColumn hcTotal4 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4); var TitleTotalP = new Ext.Net.Label(); TitleTotalP.Text = "Total(Person)"; TitleTotalP.Cls = "custom-row"; HeaderColumn hcTitleTotalP = new HeaderColumn(); hcTitleTotalP.Component.Add(TitleTotalP); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP); var TitleTotalC = new Ext.Net.Label(); TitleTotalC.Text = "Total(Comp)"; TitleTotalC.Cls = "custom-row"; HeaderColumn hcTitleTotalC = new HeaderColumn(); hcTitleTotalC.Component.Add(TitleTotalC); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC); } //根据语言设置 //string sqlp = ""; //if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") //{ // sqlp += ",[COAName]=t2.ADes"; //} //else //{ // sqlp += ",[COAName]=t2.SAccountName"; //} //string detailsql = "select t1.* from ETraveleDetail t1 where t1.No='" + ID + "' order by DetailCode"; //DataTable dtdetail = new DataTable(); //dtdetail = dbc.GetData("eReimbursement", detailsql); //DataTable dtnew = new DataTable(); //dtnew.Columns.Add("DetailID", System.Type.GetType("System.String")); //dtnew.Columns.Add("Tocity", System.Type.GetType("System.String")); //dtnew.Columns.Add("AccountCode", System.Type.GetType("System.String")); //dtnew.Columns.Add("Cur", System.Type.GetType("System.String")); //dtnew.Columns.Add("Pamount", System.Type.GetType("System.String")); //dtnew.Columns.Add("Camount", System.Type.GetType("System.String")); //dtnew.Columns.Add("TSation", System.Type.GetType("System.String")); //dtnew.Columns.Add("Tdate", System.Type.GetType("System.String")); //dtnew.Columns.Add("Tdate0", System.Type.GetType("System.String")); //dtnew.Columns.Add("Type", System.Type.GetType("System.String")); //dtnew.Columns.Add("Department1", System.Type.GetType("System.String")); //for (int i = 0; i < dtdetail.Rows.Count; i++) //{ // DataRow dr = dtnew.NewRow(); // dr["DetailID"] = dtdetail.Rows[i]["ID"].ToString(); // dr["Tocity"] = dtdetail.Rows[i]["Tocity"].ToString(); // dr["AccountCode"] = dtdetail.Rows[i]["AccountCode"].ToString(); // dr["Cur"] = dtdetail.Rows[i]["Cur"].ToString(); // dr["Pamount"] = dtdetail.Rows[i]["Pamount"].ToString(); // dr["Camount"] = dtdetail.Rows[i]["Camount"].ToString(); // dr["TSation"] = dtdetail.Rows[i]["TSation"].ToString(); // dr["Tdate"] = dtdetail.Rows[i]["Tdate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["Tdate"].ToString()).ToString("yyyy/MM/dd"); // dr["Tdate0"] = dtdetail.Rows[i]["Tdate0"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["Tdate0"].ToString()).ToString("yyyy/MM/dd"); // dr["Type"] = hdStatus.Value.ToString();//传递给子页面以判断按钮状态 0:允许修改,允许上传;1:不允许修改,允许上传;2:全不允许 // dr["Department1"] = dtdetail.Rows[i]["Department1"].ToString(); // dtnew.Rows.Add(dr); //} //Store3.DataSource = dtnew; //Store3.DataBind(); ////txtSum.Text = (psum + csum).ToString("#,##0.00"); hdSum.Value = (psum + csum).ToString(); ////txtPersonalSum.Text = psum.ToString("#,##0.00"); hdPamountSum.Value = psum.ToString(); ////txtCompanySum.Text = csum.ToString("#,##0.00"); hdCamountSum.Value = csum.ToString(); //txtRemark.Text = dt.Rows[0]["Remark"].ToString(); //if (dt.Rows[0]["CCMailList"].ToString() != "") //{ // ToolTipCC.Html = dt.Rows[0]["CCMailList"].ToString().Replace(",", "<br />"); // DataTable dtCCMailList = new DataTable(); // dtCCMailList.Columns.Add("Email", typeof(String)); // for (int i = 0; i < dt.Rows[0]["CCMailList"].ToString().Split(',').Length; i++) // { // DataRow dr = dtCCMailList.NewRow(); // dr["Email"] = dt.Rows[0]["CCMailList"].ToString().Split(',')[i]; // dtCCMailList.Rows.Add(dr); // } // StoreCCList.DataSource = dtCCMailList; // StoreCCList.DataBind(); //} }
protected override void OnInit(EventArgs e) { this._selectedIds = (List <int>) this.Context.Cache["_selectedIds"]; if (this._selectedIds == null) { this._selectedIds = new List <int>(); this.Context.Cache["_selectedIds"] = this._selectedIds; } this.Layout = "hbox"; HBoxLayoutConfig item = new HBoxLayoutConfig { Align = HBoxAlign.Middle, DefaultMargins = "0" }; this.LayoutConfig.Add(item); this._treePanelLeft = new TreePanel(); this._treePanelLeft.ID = "_treePanelLeft"; this._treePanelLeft.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.LeftItemDblClick_Event); this._treePanelLeft.Submit += new TreePanel.SubmitEventHandler(this._treePanelLeft_Submit); this._treePanelLeft.DirectEvents.Submit.EventMask.Set("正在添加"); this._treePanelLeft.Title = "可添加"; _treePanelLeft.MultiSelect = EnableBatchAdd; this._treePanelLeft.Height = this.Height; double width = (this.Width.Value - 75.0) / 2.0; this._treePanelLeft.Width = new Unit(width); this._treeStoreLeft = new TreeStore(); this._treeStoreLeft.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreLeft_ReadData); this._treeModelLeft = new Model(); this.InitTreePanel(this._treePanelLeft, this._treeStoreLeft, this._treeModelLeft); Ext.Net.Panel component = new Ext.Net.Panel { Width = 75, ButtonAlign = Alignment.Center, Layout = "vbox" }; if (!Ext.Net.X.IsAjaxRequest) { component.Border = false; } var buttons = new List <Ext.Net.Button>(); if (EnableBatchAdd) { Ext.Net.Button button = new Ext.Net.Button { Text = "全部添加 >>", TextAlign = ButtonTextAlign.Center }; button.Listeners.Click.Handler = "#{" + this._treePanelLeft.ID + "}.submitNodes();"; button.DirectEvents.Click.EventMask.Set("正在添加"); buttons.Add(button); } Ext.Net.Button button2 = new Ext.Net.Button { Text = "添 加 > ", TextAlign = ButtonTextAlign.Center }; buttons.Add(button2); button2.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnAddSelected_DirectClick); button2.DirectEvents.Click.EventMask.Set("正在添加"); this._treePanelRight = new TreePanel(); this._treePanelRight.ID = "_treePanelRight"; this._treePanelRight.Title = "已添加"; this._treePanelRight.DirectEvents.Submit.EventMask.Set("正在移除"); this._treePanelRight.Submit += new TreePanel.SubmitEventHandler(this._treePanelRight_Submit); _treePanelRight.MultiSelect = EnableBatchRemove; this._treePanelRight.Height = this.Height; this._treePanelRight.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.RightItemDblClick_Event); this._treePanelRight.Width = new Unit(width); this._treeStoreRight = new TreeStore(); this._treeStoreRight.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreRight_ReadData); this._treeModelRight = new Model(); if (EnableBatchRemove) { Ext.Net.Button button3 = new Ext.Net.Button { Text = "<< 全部移除", TextAlign = ButtonTextAlign.Center }; button3.Listeners.Click.Handler = "#{" + this._treePanelRight.ID + "}.submitNodes();"; buttons.Add(button3); } Ext.Net.Button button4 = new Ext.Net.Button { Text = "< 移 除", TextAlign = ButtonTextAlign.Center }; buttons.Add(button4); button4.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnRemoveSelected_DirectClick); button4.DirectEvents.Click.EventMask.Set("正在移除"); component.Add(buttons.ToArray()); this.Add(component); this.InitTreePanel(this._treePanelRight, this._treeStoreRight, this._treeModelRight); base.OnInit(e); }
private void CreateToolbar() { Toolbar topToolbar = new Toolbar(); Button addItemButton = new Button("Add Item") { ID = ID + "btnAdd", Icon = Icon.Add }; Menu addItemButtonMenu = new Menu(); IEnumerable<ContentType> allowedChildren = GetAllowedChildren(); foreach (ContentType definition in allowedChildren) { MenuItem menuItem = new MenuItem(definition.ContentTypeAttribute.Title) { IconUrl = definition.IconUrl }; menuItem.DirectEvents.Click.ExtraParams["Type"] = string.Format("{0},{1}", definition.ItemType.FullName, definition.ItemType.Assembly.FullName); menuItem.DirectEvents.Click.Event += OnAddItemClick; addItemButtonMenu.Items.Add(menuItem); } addItemButton.Menu.Add(addItemButtonMenu); topToolbar.Items.Add(addItemButton); _removeItemsButton = new Button("Remove Item(s)") { ID = ID + "btnRemoveItems", Icon = Icon.Delete, Disabled = true }; _removeItemsButton.DirectEvents.Click.ExtraParams.Add(new Parameter("DeletedItems", string.Format(@" (function() {{ var gridPanel = {0}; var selections = gridPanel.getSelectionModel().getSelections(); var selectedIndexes = []; for (var i = 0; i < selections.length; i++) selectedIndexes.push(gridPanel.getStore().indexOf(selections[i])); return selectedIndexes.join(','); }}).call(this)", ClientID), ParameterMode.Raw)); _removeItemsButton.DirectEvents.Click.Event += OnRemoveItemsClick; _removeItemsButton.DirectEvents.Click.Success = string.Format(@"flagRemovedItems({0});", ClientID); topToolbar.Items.Add(_removeItemsButton); TopBar.Add(topToolbar); }
protected override void OnInit(EventArgs e) { this._selectedIds = (List<int>)this.Context.Cache["_selectedIds"]; if (this._selectedIds == null) { this._selectedIds = new List<int>(); this.Context.Cache["_selectedIds"] = this._selectedIds; } this.Layout = "hbox"; HBoxLayoutConfig item = new HBoxLayoutConfig { Align = HBoxAlign.Middle, DefaultMargins = "0" }; this.LayoutConfig.Add(item); this._treePanelLeft = new TreePanel(); this._treePanelLeft.ID = "_treePanelLeft"; this._treePanelLeft.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.LeftItemDblClick_Event); this._treePanelLeft.Submit += new TreePanel.SubmitEventHandler(this._treePanelLeft_Submit); this._treePanelLeft.DirectEvents.Submit.EventMask.Set("正在添加"); this._treePanelLeft.Title = "可添加"; _treePanelLeft.MultiSelect = EnableBatchAdd; this._treePanelLeft.Height = this.Height; double width = (this.Width.Value - 75.0) / 2.0; this._treePanelLeft.Width = new Unit(width); this._treeStoreLeft = new TreeStore(); this._treeStoreLeft.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreLeft_ReadData); this._treeModelLeft = new Model(); this.InitTreePanel(this._treePanelLeft, this._treeStoreLeft, this._treeModelLeft); Ext.Net.Panel component = new Ext.Net.Panel { Width = 75, ButtonAlign = Alignment.Center, Layout = "vbox" }; if (!Ext.Net.X.IsAjaxRequest) { component.Border = false; } var buttons = new List<Ext.Net.Button>(); if (EnableBatchAdd) { Ext.Net.Button button = new Ext.Net.Button { Text = "全部添加 >>", TextAlign = ButtonTextAlign.Center }; button.Listeners.Click.Handler = "#{" + this._treePanelLeft.ID + "}.submitNodes();"; button.DirectEvents.Click.EventMask.Set("正在添加"); buttons.Add(button); } Ext.Net.Button button2 = new Ext.Net.Button { Text = "添 加 > ", TextAlign = ButtonTextAlign.Center }; buttons.Add(button2); button2.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnAddSelected_DirectClick); button2.DirectEvents.Click.EventMask.Set("正在添加"); this._treePanelRight = new TreePanel(); this._treePanelRight.ID = "_treePanelRight"; this._treePanelRight.Title = "已添加"; this._treePanelRight.DirectEvents.Submit.EventMask.Set("正在移除"); this._treePanelRight.Submit += new TreePanel.SubmitEventHandler(this._treePanelRight_Submit); _treePanelRight.MultiSelect = EnableBatchRemove; this._treePanelRight.Height = this.Height; this._treePanelRight.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.RightItemDblClick_Event); this._treePanelRight.Width = new Unit(width); this._treeStoreRight = new TreeStore(); this._treeStoreRight.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreRight_ReadData); this._treeModelRight = new Model(); if (EnableBatchRemove) { Ext.Net.Button button3 = new Ext.Net.Button { Text = "<< 全部移除", TextAlign = ButtonTextAlign.Center }; button3.Listeners.Click.Handler = "#{" + this._treePanelRight.ID + "}.submitNodes();"; buttons.Add(button3); } Ext.Net.Button button4 = new Ext.Net.Button { Text = "< 移 除", TextAlign = ButtonTextAlign.Center }; buttons.Add(button4); button4.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnRemoveSelected_DirectClick); button4.DirectEvents.Click.EventMask.Set("正在移除"); component.Add(buttons.ToArray()); this.Add(component); this.InitTreePanel(this._treePanelRight, this._treeStoreRight, this._treeModelRight); base.OnInit(e); }
protected void Test() { using (BaglantiCumlesi db = new BaglantiCumlesi()) { try { #region Layer 0 List <tbl_sbt_menu> Layer0 = (from p in db.tbl_sbt_menu where p.menu_id == 0 select p).ToList <tbl_sbt_menu>(); if (Layer0.Any()) { #region Create Null Instance Ext.Net.Menu M = null; Ext.Net.ComponentMenuItem CMI = null; Ext.Net.Container C = null; Ext.Net.MenuPanel MP = null; Ext.Net.MenuItem MI = null; Ext.Net.MenuSeparator MS = null; #endregion #region Layer 0 Loop foreach (var i in Layer0) { #region Button Ext.Net.Button B = new Ext.Net.Button(); B.ID = "Button" + i.id; B.Text = i.ad; #endregion #region Layer 1 List <tbl_sbt_menu> Layer1 = (from p in db.tbl_sbt_menu where p.menu_id == i.id select p).ToList <tbl_sbt_menu>(); if (Layer1.Any()) { #region Menu M = new Ext.Net.Menu(); M.ID = "Menu" + i.id; M.ShowSeparator = false; #endregion #region Component Menu i CMI = new Ext.Net.ComponentMenuItem(); CMI.ID = "ComponentMenuItem" + i.id; CMI.Shift = false; #endregion #region Container C = new Ext.Net.Container(); C.ID = "Container" + i.id; C.AutoWidth = true; C.AutoHeight = true; C.AnchorVertical = "100%"; C.Layout = "ColumnLayout"; #endregion #region Layer 1 Loop foreach (var t in Layer1) { #region MenuPanel MP = new Ext.Net.MenuPanel(); MP.ID = "MenuPanel" + t.id; MP.Title = t.ad; MP.Margins = "10 10 10 10"; MP.Menu.ID = "Menu" + t.id; MP.Menu.ShowSeparator = false; #endregion #region Layer 2 List <tbl_sbt_menu> Layer2 = (from p in db.tbl_sbt_menu where p.menu_id == t.id select p).ToList <tbl_sbt_menu>(); if (Layer2.Any()) { int LastID = Layer2[Layer2.Count - 1].id; #region Layer 2 Loop foreach (var y in Layer2) { #region Menu i MI = new Ext.Net.MenuItem(); MI.ID = "MenuItem" + y.id; MI.Text = y.ad; #region URL Check if (!string.IsNullOrEmpty(y.url)) { MI.Icon = Ext.Net.Icon.StarGold; MI.Listeners.Click.Handler = "TabEkle(TabPanel1, '" + MI.ID + "', '" + y.url + "', '" + MP.ID + "', '" + y.ad + "')"; } else { MI.Icon = Ext.Net.Icon.StarHalfGrey; MI.Disabled = true; } #endregion #endregion if (y.id != LastID) { #region Menu Separator MS = new Ext.Net.MenuSeparator(); MS.ID = "MenuSeparator" + y.id; #endregion } #region Adding MP.Menu.Items.Add(MI); #endregion if (y.id != LastID) { #region Adding MP.Menu.Items.Add(MS); #endregion } } #endregion } #endregion #region Adding C.Items.Add(MP); #endregion } #endregion #region Adding CMI.Component.Add(C); M.Items.Add(CMI); B.Menu.Add(M); #endregion } else { B.StandOut = true; } #endregion #region Adding MenuToolbar.Items.Add(B); #endregion } #endregion } #endregion } catch { } /* * try * { * //http://www.superstarcoders.com/blogs/posts/recursive-hierarchical-joins-in-c-sharp-and-linq.aspx * * IEnumerable<DeepNodeData> nodes = elements.RecursiveJoin( * element => element.Id, * element => element.ParentId, * (FlatData element, int index, int depth, IEnumerable<DeepNodeData> children) => * { * return new DeepNodeData() * { * Text = element.Text, * Children = children, * Depth = depth * }; * }); * * foreach (var i in nodes) * { * * } * * var q = (from p in db.tbl_sbt_menu * select new * { * ParentID = p.menu_id, * child = from c in db.tbl_sbt_menu * where c.menu_id == p.id * select new * { * ChildID = c.id, * ParentID = c.menu_id * } * }); * * //var abc = q.Select(p=>p.child).fir * * } * catch * { * * } */ } }
private void InitComponents() { #region Button and Toolbar bool display = (Status == "Open" || Status == "") ? true : false; btnSave = new Button { ID = "btnSave", Icon = Icon.Disk, Text = "Lưu", ToolTip = "Save", Visible = display }; btnDeleteCard = new Button { ID = "btnDeleteCard", Icon = Icon.Delete, Text = "Xóa", ToolTip = "Delete", Visible = display }; topBar = new Toolbar { ID = "topBar", Items = { btnSave, btnDeleteCard }, Visible = display }; #endregion Button and Toolbar #region Batch and Key txtBatch = new Ext.Net.Hidden { Name = "Batch", LabelWidth = 150, Anchor = "100%", FieldLabel = "Batch", ID = "txtBatch" }; txtKey = new Ext.Net.Hidden { DataIndex = "UID", Name = "UID", LabelWidth = 150, Anchor = "100%", FieldLabel = "UID", ID = "txtKey" }; #endregion Batch and Key #region cboNo cboNo = new ComboBoxLookup { DataIndex = "No", Name = "No", LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", ID = "cboNo", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "No", FieldTitle = "No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 250 }, new LookupFormatData { FieldName = "Base_Unit_of_Measure", FieldTitle = "Base Unit of Measure", ColWidth = 150 }, new LookupFormatData { FieldName = "Unit_Cost", FieldTitle = "Unit Cost", ColWidth = 120 } }, idProperty = "No", DisplayField = "No", ValueField = "No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemNo" }; #endregion cboNo #region cboType cboType = new ComboBox { DataIndex = "Type", Name = "Type", LabelWidth = 150, Anchor = "100%", FieldLabel = "Type", ID = "cboType", SelectOnFocus = true, AllowBlank = false, ReadOnly = true, Items = { new ListItem { Text = "G/L Account", Value = "G/L Account" }, new ListItem { Text = "Item", Value = "Item" }, } }; #endregion cboType #region cboAction_Message cboAction_Message = new ComboBox { DataIndex = "Action_Message", Name = "Action_Message", LabelWidth = 150, Anchor = "100%", FieldLabel = "Action Message", ID = "cboAction_Message", SelectOnFocus = true, ReadOnly = true, //Items = { // new ListItem {Text="", Value="" }, // new ListItem {Text="New", Value="New" }, // new ListItem {Text="Change Qty.", Value="Change Qty." }, // new ListItem {Text="Reschedule", Value="Reschedule" }, // new ListItem {Text="Resched. & Chg. Qty.", Value="Resched. & Chg. Qty." }, // new ListItem {Text="Cancel", Value="Cancel" }, //} Store = { new Store { Data = ActionMessage, AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "value" }, new ModelField { Name = "text" }, new ModelField { Name = "displaytext" } } } } } } }; #endregion cboAction_Message #region Accept Action Message and Description cboAccept_Action_Message = new Checkbox { DataIndex = "Accept_Action_Message", Name = "Accept_Action_Message", LabelWidth = 150, Anchor = "100%", FieldLabel = "Accept Action Message", ID = "cboAccept_Action_Message", ReadOnly = true }; txtDescription = new TextField { DataIndex = "Description", Name = "Description", LabelWidth = 150, Anchor = "100%", FieldLabel = "Description", ID = "txtDescription", ReadOnly = true }; txtRemark = new TextField { DataIndex = "Remark", Name = "Remark", LabelWidth = 150, Anchor = "100%", FieldLabel = "Remark", ID = "txtRemark", ReadOnly = false }; #endregion Accept Action Message and Description #region cboLocation_Code cboLocation_Code = new ComboBoxLookup { DataIndex = "Location_Code", Name = "Location_Code", LabelWidth = 150, Anchor = "100%", FieldLabel = "Location Code", ID = "cboLocation_Code", SelectOnFocus = true, AllowBlank = true, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/LocationListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Code", FieldTitle = "Code", ColWidth = 100 }, new LookupFormatData { FieldName = "Name", FieldTitle = "Name", ColWidth = 150 } }, idProperty = "Code", DisplayField = "Code", ValueField = "Code", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.Location" }; #endregion cboLocation_Code #region Original_Quantity and Quantity txtOriginal_Quantity = new NumberField { DataIndex = "Original_Quantity", Name = "Original_Quantity", LabelWidth = 150, Anchor = "100%", FieldLabel = "Original Quantity", ID = "txtOriginal_Quantity", MinValue = 0, MaxValue = 1000000, ReadOnly = true }; //1.000.000 txtQuantity = new TextField { DataIndex = "Quantity", Name = "Quantity", LabelWidth = 150, Anchor = "100%", FieldLabel = "Quantity", ID = "txtQuantity", MaskRe = @"/[0-9\.]/", }; #endregion Original_Quantity and Quantity #region cboUnit_of_Measure_Code cboUnit_of_Measure_Code = new ComboBoxLookup { DataIndex = "Unit_of_Measure_Code", Name = "Unit_of_Measure_Code", LabelWidth = 150, Anchor = "100%", FieldLabel = "Unit of Measure Code", ID = "cboUnit_of_Measure_Code", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/UOMHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Code", FieldTitle = "Code", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 150 }, new LookupFormatData { FieldName = "Qty_per_Unit_of_Measure", FieldTitle = "Qty per Unit of Measure", ColWidth = 150 } }, idProperty = "Code", DisplayField = "Code", ValueField = "Code", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.UOM" }; #endregion txtUnit_of_Measure_Code #region Direct_Unit_Cost and Due_Date txtDirect_Unit_Cost = new TextField { DataIndex = "Direct_Unit_Cost", Name = "txtDirect_Unit_Cost", LabelWidth = 150, Anchor = "100%", FieldLabel = "Direct Unit Cost", ID = "txtDirect_Unit_Cost", ReadOnly = true }; txtDue_Date = new DateField { DataIndex = "Due_Date", Name = "Due_Date", LabelWidth = 150, Anchor = "100%", FieldLabel = "Due Date", ID = "txtDue_Date", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy" }; #endregion Direct_Unit_Cost and Due_Date #region cboVendor_No cboVendor_No = new ComboBoxLookup { DataIndex = "Vendor_No", Name = "Vendor_No", LabelWidth = 150, Anchor = "100%", FieldLabel = "Vendor No.", ID = "cboVendor_No", ReadOnly = true, AllowBlank = true, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemVendorCatalogHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "Vendor_No", FieldTitle = "Vendor No", ColWidth = 100 }, new LookupFormatData { FieldName = "Vendor_Item_No", FieldTitle = "Vendor Item No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Lead_Time_Calculation", FieldTitle = "Lead Time Calculation", ColWidth = 150 } }, idProperty = "Vendor_No", DisplayField = "Vendor_No", ValueField = "Vendor_No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemVendorCatalog" }; #endregion cboVendor_No #region cboUOMHandler //cboUOMHandler = new ComboBoxLookup { // DataIndex = "Unit_of_Measure_Code", // Name = "Unit_of_Measure_Code", // LabelWidth = 150, // Anchor = "100%", // FieldLabel = "UOM", // ID = "cboUOMHandler", // ReadOnly = false, // AllowBlank = false, // MsgTarget = MessageTarget.Side, // ProxyUrl = "../../../Handler/UOMHandler.ashx", // DataTemplete = { // new LookupFormatData{FieldName = "Code", FieldTitle = "Code", ColWidth = 100}, // new LookupFormatData{FieldName = "Description", FieldTitle = "Description", ColWidth = 100}, // new LookupFormatData{FieldName = "Qty_per_Unit_of_Measure", FieldTitle = "Qty per Unit of Measure", ColWidth = 200, Format="N0"}, // }, // idProperty = "Unit_of_Measure_Code", // DisplayField = "Unit_of_Measure_Code", // ValueField = "Unit_of_Measure_Code", // PageSize = 5, // CurCompany = GlobalVariable.CompanyName, // SCOPE = "GLX.Lookup.UOM" //}; //cboUOMHandler.Store.Primary.Parameters.AddRange(new Ext.Net.StoreParameter[] { // new Ext.Net.StoreParameter{Name = "type", Value = String.Format("2|3"), Mode = ParameterMode.Value}, //}); #endregion cboUOMHandler #region Vendor_Item_No txtVendor_Item_No = new TextField { DataIndex = "Vendor_Item_No", Name = "Vendor_Item_No", LabelWidth = 150, Anchor = "100%", FieldLabel = "Vendor Item No", ID = "txtVendor_Item_No", ReadOnly = true }; #endregion Vendor_Item_No #region cboReplenishment_System cboReplenishment_System = new ComboBox { DataIndex = "Replenishment_System", Name = "Replenishment_System", LabelWidth = 150, Anchor = "100%", FieldLabel = "Replenishment System", ID = "cboReplenishment_System", ReadOnly = true, Store = { new Store { Data = ReplenishmentSystem, AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "value" }, new ModelField { Name = "text" }, new ModelField { Name = "displaytext" } } } } } } //Items = { // new ListItem { Text="Purchase", Value="Purchase"}, // new ListItem { Text="Prod. Order", Value="Prod. Order"}, // new ListItem { Text="Transfer", Value="Transfer"}, // new ListItem { Text="Assembly", Value="Assembly"} //} }; #endregion cboReplenishment_System #region cboNo cboNo = new ComboBoxLookup { DataIndex = "No", Name = "No", LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", ID = "cboNo", SelectOnFocus = true, AllowBlank = false, MsgTarget = MessageTarget.Side, ProxyUrl = "../../../Handler/ItemListHandler.ashx", DataTemplete = { new LookupFormatData { FieldName = "No", FieldTitle = "No.", ColWidth = 100 }, new LookupFormatData { FieldName = "Description", FieldTitle = "Description", ColWidth = 250 }, new LookupFormatData { FieldName = "Base_Unit_of_Measure", FieldTitle = "Base Unit of Measure", ColWidth = 150 }, new LookupFormatData { FieldName = "Unit_Cost", FieldTitle = "Unit Cost", ColWidth = 120 } }, idProperty = "No", DisplayField = "No", ValueField = "No", PageSize = 100, CurCompany = GlobalVariable.CompanyName, SCOPE = "GLX.Lookup.ItemNo" }; #endregion cboNo TextAreaChangeLogComment = new TextArea { Flex = 1, ID = "TextAreaChangeLogComment", ReadOnly = true }; hiddenConverted = new Ext.Net.Hidden { DataIndex = "Converted", Name = "Converted", ID = "hiddenConverted" }; hiddenStatus = new Ext.Net.Hidden { DataIndex = "Status", Name = "Status", ID = "hiddenStatus" }; #region frmHeader frmHeader = new FormPanel { Header = false, Region = Region.North, Icon = Ext.Net.Icon.ApplicationForm, Border = true, ID = "frmHeader", TrackResetOnLoad = true, Layout = "Hbox", Items = { new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 10 10", Border = false, //Items = { txtKey, txtBatch, cboType, cboNo, cboAction_Message, cboAccept_Action_Message, txtDescription, cboLocation_Code } //txtOriginal_Quantity Items ={ txtKey, txtBatch, hiddenConverted, hiddenStatus, cboNo, txtDescription, txtRemark, cboUnit_of_Measure_Code, txtDirect_Unit_Cost, cboLocation_Code, txtQuantity, txtDue_Date }//txtOriginal_Quantity, cboType, cboAction_Message, cboAccept_Action_Message, }, } }; frmComment = new FormPanel { ID = "frmComment", Title = "Comment", Icon = Icon.Comments, Border = false, Region = Region.South, Layout = "Fit", Height = 150, Items = { TextAreaChangeLogComment } }; #endregion frmHeader #region Windows this.ID = "winCard"; this.Maximizable = false; this.Minimizable = false; this.CloseAction = CloseAction.Destroy; this.Icon = Icon.ApplicationEdit; this.TopBar.Add(topBar); this.Layout = "Border"; this.Items.AddRange( new ItemsCollection <Ext.Net.AbstractComponent> { this.frmHeader, frmComment } ); #endregion Windows }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { this.txtNODE_ID.Hidden = true; this.txtNODE_TEXT.Hidden = true; this.TreePanel1.ID = "TreePanel1"; this.TreePanel1.Height = Unit.Pixel(400); this.TreePanel1.AutoScroll = true; Ext.Net.Button btnExpand = new Ext.Net.Button(); btnExpand.Text = "展开"; btnExpand.Listeners.Click.Handler = this.TreePanel1.ClientID + ".expandAll();"; Ext.Net.Button btnCollapse = new Ext.Net.Button(); btnCollapse.Text = "收合"; btnCollapse.Listeners.Click.Handler = this.TreePanel1.ClientID + ".collapseAll();"; Toolbar toolBar = new Toolbar(); toolBar.ID = "ToolbarT"; toolBar.Items.Add(btnExpand); toolBar.Items.Add(btnCollapse); //this.TreePanel1.TopBar.Add(toolBar); StatusBar statusBar1 = new StatusBar(); statusBar1.ID = "StatusBarT"; statusBar1.AutoClear = 1000; this.TreePanel1.BottomBar.Add(statusBar1); this.TreePanel1.Listeners.ItemClick.Handler = statusBar1.ClientID + ".setStatus({text: '点选: <b>' + record.data.text + '</b>', clear: false});"; //tree.Listeners.ItemExpand.Handler = statusBar.ClientID + ".setStatus({text: 'Node Expanded: <b>' + item.data.text + '</b>', clear: false});"; //tree.Listeners.ItemExpand.Buffer = 30; //tree.Listeners.ItemCollapse.Handler = statusBar.ClientID + ".setStatus({text: 'Node Collapsed: <b>' + item.data.text + '</b>', clear: false});"; //tree.Listeners.ItemCollapse.Buffer = 30; Ext.Net.Node root = new Ext.Net.Node(); root.Text = "新诊断信息"; root.Icon = Icon.ReportUser; root.NodeID = "__"; root.Cls = "large-font"; Ext.Net.Node rA = new Ext.Net.Node(); rA.Text = "一、临床诊断"; rA.NodeID = "A1"; rA.Cls = "large-font"; rA.Leaf = true; Ext.Net.Node rB = new Ext.Net.Node(); rB.Text = "二、合并症诊断"; rB.NodeID = "B1"; rB.Cls = "large-font"; rB.Leaf = true; Ext.Net.Node rC = new Ext.Net.Node(); rC.Text = "三、病因诊断"; rC.NodeID = "C1"; rC.Cls = "large-font"; rC.Leaf = true; Ext.Net.Node rD = new Ext.Net.Node(); rD.Text = "四、肾脏病理诊断"; rD.NodeID = "D1"; rD.Cls = "large-font"; rD.Leaf = true; root.Children.Add(rA); root.Children.Add(rB); root.Children.Add(rC); root.Children.Add(rD); root.Expanded = true; this.TreePanel1.Root.Add(root); System.Data.DataTable DT = db.Query("SELECT * FROM zinfo_a_diag WHERE PAT_NO='" + _PAT_ID + "' "); Store istore = this.GridPanel1.GetStore(); istore.DataSource = db.GetDataArray(DT); istore.DataBind(); _zInfo_Show(_TableName, _PAT_ID, info_date.Text); } }
private void InitComponent() { btnCarry_out_action_message = new Button { Icon = Icon.ControllerAdd, Text = " Carry Out Action Message", }; #region Grid + Batch strBatchs = new Store { ID = "strBatchs", AutoDataBind = true, Model = { new Model { Fields = { new ModelField { Name = "UID" }, new ModelField { Name = "Worksheet_Template_Name" }, new ModelField { Name = "Name" }, new ModelField { Name = "Description" }, new ModelField { Name = "Template_Type" }, new ModelField { Name = "Recurring", Type = ModelFieldType.Boolean }, new ModelField { Name = "Company" } } } } }; cboBatchs = new SelectBox { ID = "cboBatchs", DisplayField = "Name", ValueField = "Name", EmptyText = "Select a batch...", Width = 125 }; cboBatchs.Store.Add(strBatchs); strItems = new Store { ID = "strItems", Model = { new Model { IDProperty = "Key", Fields = { new ModelField { Name = "Type" }, new ModelField { Name = "No" }, new ModelField { Name = "Action_Message" }, new ModelField { Name = "Accept_Action_Message" }, new ModelField { Name = "Description" }, new ModelField { Name = "Description2" }, new ModelField { Name = "Description_2" }, new ModelField { Name = "Vietnamese_Description" }, new ModelField { Name = "Location_Code" }, new ModelField { Name = "Shortcut_Dimension_1_Code" }, new ModelField { Name = "Shortcut_Dimension_2_Code" }, new ModelField { Name = "Quantity" }, new ModelField { Name = "Unit_of_Measure_Code" }, new ModelField { Name = "Direct_Unit_Cost" }, new ModelField { Name = "Due_Date" }, new ModelField { Name = "Vendor_No" }, new ModelField { Name = "Vendor_Item_No" }, new ModelField { Name = "Replenishment_System" } } } }, //Sorters = { // new DataSorter { Property="Converted", Direction = SortDirection.DESC }, // new DataSorter { Property="Due_Date", Direction = SortDirection.DESC } //} }; grdItems = new GridPanel { ID = "grdItems", BodyCls = "line-body-border", CtCls = "line-border", ColumnModel = { Columns = { new Column { DataIndex = "Type", Text = "Type", Width = 90 }, new Column { DataIndex = "No", Text = "No", Width = 150 }, new Column { DataIndex = "Action_Message", Text = "Action Message", Width = 150 }, new Column { DataIndex = "Accept_Action_Message", Text = "Accept Action Message", Width = 150 }, new Column { DataIndex = "Description", Text = "Description", Width = 200, Flex = 1, MinWidth = 200 }, new Column { DataIndex = "Description_2", Text = "Description 2", Width = 200, Flex = 1, MinWidth = 200 }, new Column { DataIndex = "Vietnamese_Description", Text = "Vietnamese Description", Width = 200, Flex = 1, MinWidth = 200 }, new Column { DataIndex = "Location_Code", Text = "Location Code", Width = 120 }, new Column { DataIndex = "Shortcut_Dimension_1_Code", Text = "Entity Code", Width = 120 }, new NumberColumn { DataIndex = "Quantity", Text = "Quantity", Width = 120, Format = "0,000.00", Align = Alignment.Right }, new Column { DataIndex = "Unit_of_Measure_Code", Text = "UOM Code", Width = 100 }, new NumberColumn { DataIndex = "Direct_Unit_Cost", Text = "Direct Unit Cost", Width = 120, Format = "0,000.00", Align = Alignment.Right }, new DateColumn { DataIndex = "Due_Date", Text = "Due Date", Width = 120, Format = "dd/MM/yyyy", Align = Alignment.Left }, new Column { DataIndex = "Vendor_No", Text = "Vendor_No", Width = 150 }, new Column { DataIndex = "Vendor_Item_No", Text = "Vendor Item No", Width = 150 }, new Column { DataIndex = "Replenishment_System", Text = "Replenishment_System", Width = 100 }, } }, TopBar = { new Toolbar { Items = { cboBatchs, btnCarry_out_action_message, new ToolbarFill() } } }, Plugins = { new FilterHeader { } }, BottomBar = { new PagingToolbar { HideRefresh = true } }, SelectionModel = { new RowSelectionModel { //Mode = SelectionMode.Single Mode = SelectionMode.Multi } }, }; grdItems.Store.Add(strItems); ModelField StatusType = grdItems.Store[0].Model[0].Fields.FirstOrDefault(i => i.Name == "Action_Message"); StatusType.Convert.Fn = SCOPE + ".Convert_ActionMessage_List"; ModelField ReplenishmentSystem = grdItems.Store[0].Model[0].Fields.FirstOrDefault(i => i.Name == "Replenishment_System"); ReplenishmentSystem.Convert.Fn = SCOPE + ".Convert_ReplenishmentSystem_List"; #endregion #region Panel Panel center = new Panel { Layout = "Fit", Region = Region.Center, Items = { grdItems } }; Panel pnlLeft = new Panel { Width = 250, Title = "Menu", Collapsible = true, Collapsed = true, Region = Region.West, Layout = "VBoxLayout", Items = { new Ext.Net.HyperLink { Width = 250, Icon = Icon.Accept, Target = "_blank", NavigateUrl = "../../login.aspx", Text = "Relogin" }, new Ext.Net.HyperLink { Width = 250, Icon = Icon.PackageGo, Target = "_blank", NavigateUrl = "../PurchaseOrder", Text = "Purchase Order" }, new Ext.Net.HyperLink { Width = 250, Icon = Icon.PackageGo, Target = "_blank", NavigateUrl = "../ReqWorksheet", Text = "Req. Worksheets" } } }; #endregion #region Viewport this.ID = "pageMain"; this.Layout = "BorderLayout"; this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> { pnlLeft, center }); #endregion }
private void InitComponent() { btnSearch = new Button { Icon = Icon.Find, Text = "Find", ToolTip = "Find" }; btnAddItem = new Button { Icon = Icon.ImageAdd, Text = "Thêm", ToolTip = "Thêm" }; btnEditItem = new Button { Icon = Icon.ImageEdit, Text = "Sửa", ToolTip = "Sửa" }; btnPrint = new Button { Icon = Icon.Printer, Text = "Print", ToolTip = "Print" }; int daysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); DateTime FromDate = DateTime.Now.AddDays(-1 * daysInMonth); dfFromDate = new DateField { LabelWidth = 100, FieldLabel = "Document Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", SelectOnFocus = true, SelectedDate = FromDate, ID = "dfFromDate", EnableKeyEvents = true, Vtype = "daterange", CustomConfig = { new ConfigItem { Name = "endDateField", Value = "dfToDate", Mode = ParameterMode.Value } } }; dfToDate = new DateField { LabelWidth = 20, Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", SelectOnFocus = true, SelectedDate = DateTime.Now, ID = "dfToDate", Vtype = "daterange", EnableKeyEvents = true, CustomConfig = { new ConfigItem { Name = "startDateField", Value = "dfFromDate", Mode = ParameterMode.Value } } }; strItems = new Store { ID = "strItems", Model = { new Model { IDProperty = "Key", Fields = { new ModelField { Name = "Key" }, new ModelField { Name = "No" }, new ModelField { Name = "Buy_from_Vendor_No" }, new ModelField { Name = "Buy_from_Vendor_Name" }, new ModelField { Name = "Status" }, new ModelField { Name = "Document_Date", Type = ModelFieldType.Date }, new ModelField { Name = "Posting_Date", Type = ModelFieldType.Date }, new ModelField { Name = "Order_Date", Type = ModelFieldType.Date }, new ModelField { Name = "Vendor_Authorization_No" }, new ModelField { Name = "Vista_Order_No" }, new ModelField { Name = "Location_Code" }, new ModelField { Name = "Assigned_User_ID" }, new ModelField { Name = "Job_Queue_Status" }, new ModelField { Name = "Amount", Type = ModelFieldType.Float }, new ModelField { Name = "Amount_Including_VAT", Type = ModelFieldType.Float }, } } } }; grdItems = new GridPanel { ID = "grdItems", BodyCls = "line-body-border", CtCls = "line-border", ColumnModel = { Columns = { new Column { DataIndex = "Key", Text = "Key", Width = 0 }, new Column { DataIndex = "No", Text = "No", Width = 120, }, new Column { DataIndex = "Buy_from_Vendor_No", Text = "Vendor No.", Width = 120 }, new Column { DataIndex = "Buy_from_Vendor_Name", Text = "Buy from Vendor Name", Width = 220,Flex = 1 }, new Column { DataIndex = "Location_Code", Text = "Location_Code", Width = 120 }, new Column { DataIndex = "Status", Text = "Status", Width = 120 }, new DateColumn { DataIndex = "Document_Date", Text = "Document Date", Width = 120,Format = "dd/MM/yyyy" }, new DateColumn { DataIndex = "Posting_Date", Text = "Posting Date", Width = 120,Format = "dd/MM/yyyy" }, //new DateColumn{ DataIndex = "Order_Date", Text = "Order Date", Width = 120, Format = "dd/MM/yyyy" }, } }, TopBar = { new Toolbar { Items = { dfFromDate, dfToDate, btnSearch,//btnAddItem, btnEditItem btnPrint } } }, Plugins = { new FilterHeader { } }, BottomBar = { new PagingToolbar { HideRefresh = true } }, SelectionModel = { new RowSelectionModel { Mode = SelectionMode.Single } } }; grdItems.Store.Add(strItems); pnlCenter = new Panel { Layout = "Fit", Region = Region.Center, Items = { grdItems } }; pnlLeft = new Panel { Width = 250, Title = "Menu", Collapsible = true, Collapsed = true, Region = Region.West, Layout = "VBoxLayout", Items = { new Ext.Net.HyperLink { Width = 250, Icon = Icon.Accept, Target = "_blank", NavigateUrl = "../../Login.aspx", Text = "Relogin" }, new Ext.Net.HyperLink { Width = 250, Icon = Icon.PackageGo, Target = "_blank", NavigateUrl = "../ReqWorksheet", Text = "Req. Worksheets" }, //new Ext.Net.HyperLink { // Width = 250, // Icon = Icon.Page, // Target = "_blank", // NavigateUrl = "../ReqWorksheet2", // Text = "Req. Worksheets 2" //} } }; this.ID = "pageMain"; this.Layout = "BorderLayout"; this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> { pnlLeft, pnlCenter }); }
//private void LeftItemDblClick_Event(object sender, DirectEventArgs e) //{ // this.MoveNode(this._treePanelLeft, this._treePanelRight); //} //private void MoveNode(TreePanel source, TreePanel target) //{ // List<SubmittedNode> selectedNodes = source.SelectedNodes; // if (selectedNodes != null) // { // if (NodesAdding != null) // { // var nodeIds = selectedNodes.Select(x => Convert.ToInt32(x.NodeID)); // var args = new NodesAddEventArgs(); // args.NodeIds.AddRange(nodeIds); // NodesAdding(this, args); // if (args.CancelAdd) // { // Ext.Net.X.Msg.Alert("提示", args.ErrorMessage).Show(); // return; // } // } // foreach (SubmittedNode node in selectedNodes) // { // target.GetRootNode().InsertChild(0, node.ToProxyNode()); // source.GetNodeById(node.NodeID).Remove(); // if (target.ID.Contains("Right")) // { // //增加 // this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID)); // } // else // { // this._selectedIds.Remove(ConvertHelper.ToInt32(node.NodeID)); // } // } // } //} protected override void OnInit(EventArgs e) { base.OnInit(e); var addNodes = "function(){var nodes=App." + leftPanelId + ".getSelectionModel().getSelection();App." + rightPanelId + ".getRootNode().appendChild(nodes);App." + leftPanelId + ".getRootNode().removeChild(nodes);}"; var removeNodes = "function(){var nodes=App." + rightPanelId + ".getSelectionModel().getSelection();App." + leftPanelId + ".getRootNode().appendChild(nodes);App." + rightPanelId + ".getRootNode().removeChild(nodes);}"; this._selectedIds = (List<int>)this.Context.Cache["_selectedIds"]; if (this._selectedIds == null) { this._selectedIds = new List<int>(); this.Context.Cache["_selectedIds"] = this._selectedIds; } this.Layout = "hbox"; HBoxLayoutConfig item = new HBoxLayoutConfig { Align = HBoxAlign.Middle, DefaultMargins = "0" }; this.LayoutConfig.Add(item); this._treePanelLeft = new TreePanel(); this._treePanelLeft.ID = leftPanelId; //_treePanelLeft.DirectEvents.ItemDblClick.Url = LeftItemDblClickUrl; //this._treePanelLeft.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.LeftItemDblClick_Event); // this._treePanelLeft.SubmitUrl = LeftSubmitUrl;// += new TreePanel.SubmitEventHandler(this._treePanelLeft_Submit); //this._treePanelLeft.DirectEvents.Submit.EventMask.Set("正在添加"); this._treePanelLeft.Title = "可添加"; _treePanelLeft.MultiSelect = EnableBatchAdd; this._treePanelLeft.Height = this.Height; double width = (this.Width.Value - 75.0) / 2.0; this._treePanelLeft.Width = new Unit(width); this._treeStoreLeft = new TreeStore(); //var ajaxProxy = new AjaxProxy(); //ajaxProxy.ActionMethods.Read = HttpMethod.POST; //ajaxProxy.Reader.Add(new JsonReader()); //ajaxProxy.Url = LeftReadUrl; this._treeStoreLeft.Proxy.Add(LeftReadProxy);// += new TreeStoreBase.ReadDataEventHandler(this._treeStoreLeft_ReadData); this._treeModelLeft = new Model(); this.InitTreePanel(this._treePanelLeft, this._treeStoreLeft, this._treeModelLeft); Ext.Net.Panel component = new Ext.Net.Panel { Width = 75, ButtonAlign = Alignment.Center, Layout = "vbox" }; if (!Ext.Net.X.IsAjaxRequest) { component.Border = false; } var buttons = new List<Ext.Net.Button>(); if (EnableBatchAdd) { Ext.Net.Button button = new Ext.Net.Button { Text = "全部添加 >>", TextAlign = ButtonTextAlign.Center }; button.Listeners.Click.Handler = "function(){var nodes=Ext.Array.clone(App." + leftPanelId + ".getRootNode().childNodes);App." + leftPanelId + ".getRootNode().removeAll(false);App." + rightPanelId + ".getRootNode().appendChild(nodes);}"; buttons.Add(button); } Ext.Net.Button btnAdd = new Ext.Net.Button { Text = "添 加 > ", TextAlign = ButtonTextAlign.Center }; buttons.Add(btnAdd); //btnAdd.DirectClickUrl = AddUrl; //btnAdd.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnAddSelected_DirectClick); //btnAdd.DirectEvents.Click.EventMask.Set("正在添加"); this._treePanelRight = new TreePanel(); this._treePanelRight.ID = rightPanelId; this._treePanelRight.Title = "已添加"; //_treePanelRight.SubmitUrl = RightSubmitUrl; //this._treePanelRight.DirectEvents.Submit.EventMask.Set("正在移除"); //this._treePanelRight.Submit += new TreePanel.SubmitEventHandler(this._treePanelRight_Submit); _treePanelRight.MultiSelect = EnableBatchRemove; this._treePanelRight.Height = this.Height; _treePanelRight.Listeners.ItemDblClick.Fn = removeNodes; //this._treePanelRight.DirectEvents.ItemDblClick.Url = RightItemDblClick;//.Event += new ComponentDirectEvent.DirectEventHandler(this.RightItemDblClick_Event); this._treePanelRight.Width = new Unit(width); this._treeStoreRight = new TreeStore(); _treeStoreRight.Proxy.Add(RightReadProxy); //this._treeStoreRight.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreRight_ReadData); this._treeModelRight = new Model(); if (EnableBatchRemove) { Ext.Net.Button btnRemoveAll = new Ext.Net.Button { Text = "<< 全部移除", TextAlign = ButtonTextAlign.Center }; btnRemoveAll.Listeners.Click.Handler = "function(){var nodes=Ext.Array.clone(App." + rightPanelId + ".getRootNode().childNodes);App." + leftPanelId + ".getRootNode().removeAll(false);App." + leftPanelId + ".getRootNode().appendChild(nodes);}"; buttons.Add(btnRemoveAll); } Ext.Net.Button btnRemove = new Ext.Net.Button { Text = "< 移 除", TextAlign = ButtonTextAlign.Center }; buttons.Add(btnRemove); btnAdd.Handler = addNodes; _treePanelLeft.Listeners.ItemDblClick.Fn = addNodes; btnRemove.Listeners.Click.Fn = removeNodes; //btnRemove.DirectClickUrl = RemoveRightUrl;// += new ComponentDirectEvent.DirectEventHandler(this.btnRemoveSelected_DirectClick); //btnRemove.DirectEvents.Click.EventMask.Set("正在移除"); component.Add(buttons.ToArray()); this.Add(component); this.InitTreePanel(this._treePanelRight, this._treeStoreRight, this._treeModelRight); }
public abstract void ModifyGrid(Button button, GridPanel gridPanel);
private Ext.Net.Button __BuildControlbtnLogin() { Ext.Net.Button button = new Ext.Net.Button(); btnLogin = button; button.ApplyStyleSheetSkin(this); button.Text=("登录"); button.ID = "btnLogin"; this.__BuildControl__control19(button.DirectEvents); object[] parameters = new object[5]; parameters[0] = button; parameters[2] = 0x728; parameters[3] = 0x14d; parameters[4] = false; this.__PageInspector_SetTraceData(parameters); return button; }
public override void RenderView(ViewContext viewContext, System.IO.TextWriter writer) { writer.Write("<!DOCTYPE html>"); writer.Write("<head>"); writer.Write("<title>用户登录</title>"); var x = Html.X(); writer.Write(Html.X().ResourceManager().ToHtmlString()); var loginWindow = new Window() { Title = "用户登录", Width = 300, Height = 200, Closable = false, Modal = true, Icon = Icon.Key, Draggable = false, BodyPadding = 10, Resizable = false }; var formPanel = new ValidatedForm() { Border = true, BodyPadding = 10, ID = "loginForm", Url = Url.Action("login") }; formPanel.Layout = "table"; formPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); loginWindow.Add(formPanel); var textField = new TextField() { FieldLabel = "用户名", Name = "Username", ColSpan = 2, AllowBlank = false, BlankText = "用户名不能为空" }; var passwordField = new TextField() { FieldLabel = "密码", Name = "Password", ColSpan = 2, AllowBlank = false, InputType = Ext.Net.InputType.Password, BlankText = "密码不能为空" }; var verifyImg = new Image() { Width = 100, ImageUrl = Url.Action("VerifyImage"), Height = 22, ColSpan = 1, ID = "imgVerify" }; var verifyCodeField = new TextField() { FieldLabel = "验证码", ColSpan = 1, AllowBlank = false, BlankText = "验证码不能为空'", Name="VerifyCode" }; formPanel.Add(textField); formPanel.Add(passwordField); formPanel.Add(verifyCodeField); formPanel.Add(verifyImg); var btnLogin = new Button() { Text = "登录", Icon = Icon.KeyStart, }; var btnChangeImage = new Button() { Text = "更换验证码", Icon = Icon.ImageEdit, ID = "btnChangeImage" }; btnChangeImage.Handler = "var src='" + verifyImg.ImageUrl + "';src=src+'?'+new Date().valueOf();App.imgVerify.setImageUrl(src);"; btnLogin.Handler = @"App.loginForm.submitData(function(r){if(r.success){location.href='" + @Url.Action("index", "home") + "';}else{App.btnChangeImage.handler();}});"; loginWindow.Buttons.Add(btnChangeImage); loginWindow.Buttons.Add(btnLogin); writer.Write(loginWindow.ToBuilder().ToHtmlString()); writer.Write("</head>"); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); #region 总体布局 _viewPort = new Viewport(); _viewPort.Layout = "border"; _copyright = new Panel(); _copyright.Title = "版权"; _copyright.TitleAlign = TitleAlign.Center; _copyright.Collapsible = false; _copyright.Region = Region.South; _copyright.Split = true; _menu = new Panel(); _menu.Title = "导航菜单"; _menu.Collapsible = true; _menu.Region = Region.West; _menu.Split = true; _menu.Width = 200; _workArea = new Ext.Net.TabPanel(); _workArea.Title = "欢迎使用"; _workArea.Region = Region.Center; _workArea.ID = "tabWork"; _title = new Panel(); _title.Title = WebName; _title.Collapsible = false; _title.Region = Region.North; _title.Split = true; _viewPort.Items.Add(_title); _viewPort.Items.Add(_workArea); _viewPort.Items.Add(_copyright); _viewPort.Items.Add(_menu); #endregion #region 个人区 _personPanel = new Ext.Net.Panel(); _personPanel.Collapsed = true; _personPanel.Collapsible = true; _personPanel.Title = "欢迎使用"; _personPanel.Height = 110; _personPanel.BodyPadding = 10; _personPanel.Layout = "table"; _personPanel.LayoutConfig.Add(new TableLayoutConfig() { Columns = 2 }); Image avatarImg = new Image(); avatarImg.RowSpan = 2; avatarImg.Width = avatarImg.Height = 70; avatarImg.ImageUrl = BaseResource.avatar; _personPanel.Add(avatarImg); _personPanel.Add(new Label(userInfo.Username)); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.Width = 80; buttonGroup.Layout = "vbox"; buttonGroup.Add(new KeyButton() { Text = "修改密码", ID = "btnChangePassword", OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();" }); btnExit = new Button() { Text = "安全退出", ID = "btnExit", Icon = Icon.KeyDelete }; var clickEvent = btnExit.DirectEvents.Click; clickEvent.Event += clickEvent_Event; clickEvent.EventMask.Set("正在退出"); clickEvent.Confirmation.ConfirmRequest = true; clickEvent.Confirmation.Title = "提示"; clickEvent.Confirmation.Message = "确定退出?"; buttonGroup.Add(btnExit); _personPanel.Add(buttonGroup); _menu.Add(_personPanel); winChangePassword = new Window() { Icon = Icon.Key, BodyPadding = 10, Width = 300, Height = 210, Modal = true, Hidden = true, AutoShow = false, ID = "winChangePassword", Title = "修改密码", Loader = new ComponentLoader() { Url = ResolveClientUrl("~/user/changepassword.aspx"), Mode = LoadMode.Frame } }; winChangePassword.Loader.LoadMask.Set("正在加载"); Controls.Add(winChangePassword); #endregion _menuPanel = new TreePanel() { Title = "功能菜单", Height = 500, RootVisible = false, ID = "mainMenu" }; _menuStore = new TreeStore() { NodeParam = "parentId" }; _menuStore.ReadData += _menuStore_ReadData; _menuPanel.Store.Add(_menuStore); _menuPanel.Root.Add(new Node() { NodeID = "0", Text = "Root", Expanded = true }); _menu.Add(_menuPanel); var itemClick = _menuPanel.DirectEvents.ItemClick; itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.id);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.id).isLeaf();"; itemClick.EventMask.Set("正在加载"); itemClick.Event += itemClick_Event; itemClick.ExtraParams.Add(new Parameter("id", "record.data.id", ParameterMode.Raw)); #region 隐藏顶级窗口 _winParentWindow = new Window(); _winParentWindow.Hidden = true; _winParentWindow.Loader = new ComponentLoader(); _winParentWindow.Loader.Mode = LoadMode.Frame; _winParentWindow.Width = 800; _winParentWindow.Modal = true; _winParentWindow.Height = 600; _winParentWindow.ID = "_topWin"; Controls.Add(_winParentWindow); #endregion Controls.Add(_viewPort); }
private void InitComponents() { this.btnRefresh = new Ext.Net.Button { Icon = Icon.ArrowRefresh, Text = "Tải lại", ToolTip = "Tải lại" }; this.btnSelect = new Ext.Net.Button { Icon = Icon.Find, Text = "Chọn", ToolTip = "Chọn và đóng" }; this.storeMain = new Ext.Net.Store { ID = "storeMain", PageSize = 20, AutoLoad = true, Model = { new Model { IDProperty = "No", Fields = { new ModelField { Name = "No" }, new ModelField { Name = "Description" }, new ModelField { Name = "Base_Unit_of_Measure" } } } } }; this.grdMain = new Ext.Net.GridPanel { ID = "grdMain", ColumnModel = { Columns = { new Column { DataIndex = "No", Text = "No", Width = 100 }, new Column { DataIndex = "Description", Text = "Description", Width = 100 }, new Column { DataIndex = "Base_Unit_of_Measure", Text = "Base Unit of Measure", Width = 100 } } }, Plugins = { new FilterHeader { } }, BottomBar = { new PagingToolbar { } }, SelectionModel = { new RowSelectionModel { Mode = SelectionMode.Single } } }; this.grdMain.Store.Add(this.storeMain); this.pnlMain = new Ext.Net.Panel { Region = Region.Center, Border = false, TopBar = { new Toolbar { Items ={ this.btnRefresh, new ToolbarSeparator(), this.btnSelect } } }, ContentControls = { this.grdMain } }; this.viewPort = new Viewport { Layout = "Border", Items = { this.pnlMain } }; this.Form.Controls.Add(this.viewPort); }
public override void ModifyGrid(Button button, GridPanel gridPanel) { CheckboxSelectionModel selectionModel = (CheckboxSelectionModel) gridPanel.SelectionModel.Primary; selectionModel.Listeners.RowSelect.Handler = string.Format("{0}.enable();", button.ClientID); selectionModel.Listeners.RowDeselect.Handler = string.Format("if (!{0}.hasSelection()) {{{1}.disable();}}", gridPanel.ClientID, button.ClientID); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); GridView item = View.FirstOrDefault(); if (item == null) { item = new GridView(); item.EnableTextSelection = true; this.View.Add(item); } item.ID = this.ID + "View"; item.LoadingText = "正在加载"; item.LoadMask = true; PagingToolbar toolbar = new PagingToolbar(); Ext.Net.Button btnAdd = null; Ext.Net.Button button2 = null; if (this.EnableAdd) { if (EditorConfig == null || EditorConfig.AddWindow == null) { throw new Exception("EditorConfig的属性有误"); } btnAdd = new Ext.Net.Button { Text = "添加" }; btnAdd.Handler = string.Format("App.editWindow.setWidth({0});App.editWindow.setHeight({1});App.editWindow.setTitle('{2}');App.editWindow.show();App.editWindow.loader.load({{url:'{3}'}})", EditorConfig.AddWindow.Width, EditorConfig.AddWindow.Height, EditorConfig.AddWindow.Title, EditorConfig.AddWindow.Url); toolbar.Items.Add(btnAdd); } if (this.EnableRemove) { button2 = new Ext.Net.Button { Text = "删除" }; button2.DirectEvents.Click.EventMask.Msg = "正在删除"; button2.DirectEvents.Click.EventMask.ShowMask = true; button2.DirectEvents.Click.Confirmation.ConfirmRequest = true; button2.DirectEvents.Click.Confirmation.Message = "确认删除?"; button2.DirectEvents.Click.Confirmation.Title = "提示"; Parameter parameters = new Parameter { Name = "ids", Value = "getSelectionIds()", Mode = ParameterMode.Raw }; button2.DirectEvents.Click.ExtraParams.Add(parameters); } if (this.EditorConfig != null) { if (this.EnableAdd) { btnAdd.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.ExtraParams); btnAdd.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.AddWindow.ExtraParams); } if (this.EnableRemove) { button2.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.ExtraParams); button2.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.AddWindow.ExtraParams); } } if (this.EnableAdd) { } if (this.EnableRemove) { button2.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnRemove_DirectClick); toolbar.Items.Add(button2); } if (BottomBar.Count > 0) { toolbar.Items.AddRange(BottomBar[0].Items); BottomBar.Clear(); } this.BottomBar.Add(toolbar); this.SelectionModel.Add(new CheckboxSelectionModel()); this.InitModel(); this.InitGridCommand(); if (!Ext.Net.X.IsAjaxRequest) { this.AddScript("function getSelectionIds(){var sm=Ext.getCmp(\"" + this.ID + "\").getSelectionModel();var ids=Array();var selections=sm.getSelection();for(var i=0;i<selections.length;i++)ids.push(selections[i].data.Id);return ids.join(',');}"); } }
public void ShowDialog(string title, string subtitle, string affectedItemIDs) { var window = new Window { ID = "deleteDialog", Modal = true, Width = 500, Height = 300, Title = title, Layout = "fit", Maximizable = true }; window.Listeners.Maximize.Fn = "function(el) { var v = Ext.getBody().getViewSize(); el.setSize(v.width, v.height); }"; window.Listeners.Maximize.Scope = "this"; FormPanel formPanel = new FormPanel { BaseCls = "x-plain", Layout = "absolute" }; window.Items.Add(formPanel); formPanel.ContentControls.Add(new Label { Html = @"<div class=""x-window-dlg""><div class=""ext-mb-warning"" style=""width:32px;height:32px""></div></div>", X = 5, Y = 5 }); formPanel.ContentControls.Add(new Label { Html = subtitle, X = 42, Y = 6 }); TabPanel tabPanel = new TabPanel { ID = "deleteDialog_TabPanel", X = 0, Y = 42, Anchor = "100% 100%", AutoTabs = true, DeferredRender = false, Border = false }; formPanel.ContentControls.Add(tabPanel); TreePanel affectedItemsTreePanel = new TreePanel { Title = "Affected Items", AutoScroll = true, RootVisible = false }; tabPanel.Items.Add(affectedItemsTreePanel); TreeLoader treeLoader = new TreeLoader { DataUrl = Engine.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(typeof(DeleteUserControl).Assembly, "Zeus.Admin.Plugins.DeleteItem.AffectedItems.ashx") }; affectedItemsTreePanel.Loader.Add(treeLoader); treeLoader.Listeners.Load.Fn = "function(loader, node) { node.getOwnerTree().expandAll(); }"; affectedItemsTreePanel.Root.Add(new AsyncTreeNode { Text = "Root", NodeID = affectedItemIDs, Expanded = true }); TreePanel referencingItemsTreePanel = new TreePanel { Title = "Referencing Items", TabTip = "Items referencing the item(s) you're deleting", AutoScroll = true, RootVisible = false }; tabPanel.Items.Add(referencingItemsTreePanel); TreeLoader referencingItemsTreeLoader = new TreeLoader { DataUrl = Engine.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(typeof(DeleteUserControl).Assembly, "Zeus.Admin.Plugins.DeleteItem.ReferencingItems.ashx") }; referencingItemsTreePanel.Loader.Add(referencingItemsTreeLoader); referencingItemsTreePanel.Root.Add(new AsyncTreeNode { Text = "Root", NodeID = affectedItemIDs, Expanded = true }); Button yesButton = new Button { ID = "yesButton", Text = "Yes" }; yesButton.Listeners.Click.Handler = string.Format(@" stbStatusBar.showBusy('Deleting...'); {0}.hide(); Ext.net.DirectMethods.Delete.DeleteItems('{1}', {{ url : '{2}', success: function() {{ stbStatusBar.setStatus({{ text: 'Deleted Item(s)', iconCls: '', clear: true }}); }} }});", window.ClientID, affectedItemIDs, Engine.AdminManager.GetAdminDefaultUrl()); window.Buttons.Add(yesButton); window.Buttons.Add(new Button { ID = "noButton", Text = "No", Handler = string.Format(@"function() {{ {0}.hide(); }}", window.ClientID) }); window.Render(pnlContainer, RenderMode.RenderTo); }
protected void Page_Load(object sender, EventArgs e) { //string station = ""; string department = ""; //DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList("A0182"); //if (ds1.Tables[0].Rows.Count == 1) //{ // DataTable dt1 = ds1.Tables[0]; // station = dt1.Rows[0]["stationCode"].ToString(); // department = dt1.Rows[0]["CRPDepartmentName"].ToString(); //} if (!X.IsAjaxRequest) { //判断登录状态 cs.DBCommand dbc = new cs.DBCommand(); if (Request.Cookies.Get("eReimUserID") == null) { X.AddScript("loginWindow.show();Panel1.disable();"); return; } else { hdUser.Value = Request.Cookies.Get("eReimUserID").Value; ScriptManager.RegisterStartupScript(this, GetType(), "", "$('div.gn_person ul.q-menubox li:eq(0) a').text('" + Request.Cookies.Get("eReimUserName").Value + "');", true); X.AddScript("loginWindow.hide();Panel1.enable();"); if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { ResourceManager1.Locale = "zh-CN"; } else { ResourceManager1.Locale = "en-US"; } } //hdStatus.Value = "0"; if (Request.QueryString["ID"] != null)//判断链接地址是否正确 { string ID = Request.QueryString["ID"].ToString(); System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$"); if (reg1.IsMatch(ID)) { string sql = "select * from V_Eflow_ETravel where RequestID='" + ID + "' and [Type]='T' and (Active=1 or Active=2)"; DataTable dt = new DataTable(); dt = dbc.GetData("eReimbursement", sql); if (dt != null && dt.Rows.Count == 1) { if (Request.Cookies.Get("eReimUserID").Value == dt.Rows[0]["PersonID"].ToString())//本人 { ////准备下拉菜单内容 //Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value); //cbxOwner.Items.Add(li); //string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'"; //DataTable dtitem = dbc.GetData("eReimbursement", sqlitem); //int itemcount = 0; //for (int j = 0; j < dtitem.Rows.Count; j++) //{ // string sqlpara = sqlitem; // if (dtitem.Rows[j][5].ToString() != "") // { // sqlpara += " and getdate()>='" + dtitem.Rows[j][5].ToString() + "' "; // } // if (dtitem.Rows[j][6].ToString() != "") // { // sqlpara += " and getdate()<='" + dtitem.Rows[j][6].ToString() + "' "; // } // DataTable dtitem1 = dbc.GetData("eReimbursement", sqlpara); // for (int m = 0; m < dtitem1.Rows.Count; m++) // { // li = new Ext.Net.ListItem(dtitem.Rows[m][1].ToString(), dtitem.Rows[m][2].ToString()); // cbxOwner.Items.Add(li); // itemcount++; // } //} //更改按钮状态 if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单 { if (Request.QueryString["Copy"] != null) { if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增 { X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); } else { ErrorHandle("Data Error."); } } else//已申请数据 { string app = ""; if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString(); //读取当前状态,显示在下方文本框内 if (dt.Rows[0]["Status"].ToString() == "1") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString(); } else if (dt.Rows[0]["Status"].ToString() == "2") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } else if (dt.Rows[0]["Status"].ToString() == "3") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } if (dt.Rows[0]["Active"].ToString() == "2")//已完成 { //hdStatus.Value = "2"; app += ". 完成."; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();"); } else//待审批 { //hdStatus.Value = "1"; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); } } else { Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString(); //读取当前状态,显示在下方文本框内 if (dt.Rows[0]["Status"].ToString() == "1") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString(); } else if (dt.Rows[0]["Status"].ToString() == "2") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } else if (dt.Rows[0]["Status"].ToString() == "3") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } if (dt.Rows[0]["Active"].ToString() == "2")//已完成 { //hdStatus.Value = "2"; app += ". Complete."; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();"); } else//待审批 { //hdStatus.Value = "1"; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); } } labelInfo.Text = app; } } else//草稿 { if (Request.QueryString["Copy"] != null) { if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增 { X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); } else { ErrorHandle("Data Error."); } } else { if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString(); } else { Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString(); } X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); } } //载入通用数据 LoadData(dt, true); } else { //判断是否为代理人 bool isagent = false;//记录Session["UserID"]是否为代理人 string sqlagent = "select * from Eagent where [St]=1 and [OwnerID]='" + dt.Rows[0]["PersonID"].ToString() + "' and getdate()<=Edate and getdate()>=Bdate"; DataTable dtagent = dbc.GetData("eReimbursement", sqlagent); for (int g = 0; g < dtagent.Rows.Count; g++) { if (Request.Cookies.Get("eReimUserID").Value == dtagent.Rows[g]["PAgentID"].ToString()) { isagent = true; break; } } if (isagent)//代理人访问 { //Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString()); //cbxOwner.Items.Add(li); //更改按钮状态 if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单 { if (Request.QueryString["Copy"] != null) { if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增 { X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); } else { ErrorHandle("Data Error."); } } else { string app = ""; if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString(); //读取当前状态,显示在下方文本框内 if (dt.Rows[0]["Status"].ToString() == "1") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString(); } else if (dt.Rows[0]["Status"].ToString() == "2") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } else if (dt.Rows[0]["Status"].ToString() == "3") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } if (dt.Rows[0]["Active"].ToString() == "2")//已完成 { //hdStatus.Value = "2"; app += ". 完成."; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();"); } else//待审批 { //hdStatus.Value = "1"; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); } } else { Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString(); //读取当前状态,显示在下方文本框内 if (dt.Rows[0]["Status"].ToString() == "1") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString(); } else if (dt.Rows[0]["Status"].ToString() == "2") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } else if (dt.Rows[0]["Status"].ToString() == "3") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } if (dt.Rows[0]["Active"].ToString() == "2")//已完成 { //hdStatus.Value = "2"; app += ". Complete."; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();"); } else//待审批 { //hdStatus.Value = "1"; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); } } labelInfo.Text = app; } } else//草稿 { if (Request.QueryString["Copy"] != null) { if (Request.QueryString["Copy"].ToString() == "T")//Copy,作为新增 { X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); } else { ErrorHandle("Data Error."); } } else { if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString(); } else { Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString(); } X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); } } //载入通用数据 LoadData(dt, true); } else//判断是否有跨站权限 { bool hasright = false; string getright = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'"; DataTable dtright = dbc.GetData("eReimbursement", getright); for (int j = 0; j < dtright.Rows.Count; j++) { string[] dd = dtright.Rows[j]["Stations"].ToString().Split(','); for (int i = 0; i < dd.Length; i++) { if (dd[i] == dt.Rows[0]["Station"].ToString())//有权限 { hasright = true; break; } } } if (hasright) { //Ext.Net.ListItem li = new Ext.Net.ListItem(dt.Rows[0]["Person"].ToString(), dt.Rows[0]["PersonID"].ToString()); //cbxOwner.Items.Add(li); //更改按钮状态 if (dt.Rows[0]["Step"].ToString() != "0")//正式申请单 { string app = ""; if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { Panel3.Title = "差旅费申请单: " + dt.Rows[0]["No"].ToString(); //读取当前状态,显示在下方文本框内 if (dt.Rows[0]["Status"].ToString() == "1") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 等待审批: " + dt.Rows[0]["Approver"].ToString(); } else if (dt.Rows[0]["Status"].ToString() == "2") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 完成审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } else if (dt.Rows[0]["Status"].ToString() == "3") { app += "提单人: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", 拒绝审批: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } if (dt.Rows[0]["Active"].ToString() == "2")//已完成 { //hdStatus.Value = "2"; app += ". 完成."; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();"); } else//待审批 { //hdStatus.Value = "1"; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); } } else { Panel3.Title = "Travel Expense Form: " + dt.Rows[0]["No"].ToString(); //读取当前状态,显示在下方文本框内 if (dt.Rows[0]["Status"].ToString() == "1") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Waiting for approval By: " + dt.Rows[0]["Approver"].ToString(); } else if (dt.Rows[0]["Status"].ToString() == "2") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Approved by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } else if (dt.Rows[0]["Status"].ToString() == "3") { app += "Applied by: " + dt.Rows[0]["CreadedBy"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["CreadedDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); app += ", Rejected by: " + dt.Rows[0]["Approver"].ToString() + " " + Convert.ToDateTime(dt.Rows[0]["ApproveDate"].ToString()).ToString("yyyy/MM/dd hh:mm"); } if (dt.Rows[0]["Active"].ToString() == "2")//已完成 { //hdStatus.Value = "2"; app += ". Complete."; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnUploadReport.disable();btnUploadScanFile.disable();Button1.disable();Button2.disable();btnCC.disable();"); } else//待审批 { //hdStatus.Value = "1"; X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); } } labelInfo.Text = app; } else//草稿 { if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { Panel3.Title = "差旅费申请单草稿: " + dt.Rows[0]["No"].ToString(); } else { Panel3.Title = "Travel Expense Draft: " + dt.Rows[0]["No"].ToString(); } //X.AddScript("btnSaveAndSend.enable();"); } //hdStatus.Value = "2";//不允许传递到子页面时修改或者上传 X.AddScript("btnAddDSTN.disable();btnGeteLeave.disable();Radio1.disable();Radio2.disable();btnSaveDraft.disable();btnCC.disable();"); //无需判断Copy //载入通用数据 LoadData(dt, false); } else { ErrorHandle("No right."); } } } } else { ErrorHandle("Data Error."); } } else { ErrorHandle("Data Error."); } } else//新增申请 { ////准备下拉菜单内容 //Ext.Net.ListItem li = new Ext.Net.ListItem(Request.Cookies.Get("eReimUserName").Value, Request.Cookies.Get("eReimUserID").Value); //cbxOwner.Items.Add(li); //string sqlitem = "select * from Eagent where [St]=1 and [PAgentID]='" + Request.Cookies.Get("eReimUserID").Value + "'"; //DataTable dtitem = dbc.GetData("eReimbursement", sqlitem); //for (int j = 0; j < dtitem.Rows.Count; j++) //{ // string sqlpara = sqlitem; // bool d1 = true; // bool d2 = false; // if (dtitem.Rows[j][5].ToString() != "") // { // //sqlpara += " and getdate()>='" + dtitem.Rows[j]["Bdate"].ToString() + "' "; // if (DateTime.Now >= Convert.ToDateTime(dtitem.Rows[j][5].ToString())) // { // d1 = true; // } // else // { // d1 = false; // } // } // if (dtitem.Rows[j][6].ToString() != "") // { // //sqlpara += " and getdate()<='" + dtitem.Rows[j]["Edate"].ToString() + "' "; // if (DateTime.Now <= Convert.ToDateTime(dtitem.Rows[j][6].ToString())) // { // d2 = true; // } // else // { // d2 = false; // } // } // if (d1 && d2) // { // li = new Ext.Net.ListItem(dtitem.Rows[j]["Owner"].ToString(), dtitem.Rows[j]["OwnerID"].ToString()); // cbxOwner.Items.Add(li); // } //} ////新增记录时,默认为登录用户 //cbxOwner.SelectedItem.Value = Request.Cookies.Get("eReimUserID").Value; //cbxOwner.SelectedItem.Text = Request.Cookies.Get("eReimUserName").Value; //hdOwner.Value = Request.Cookies.Get("eReimUserName").Value; //hdOwnerID.Value = Request.Cookies.Get("eReimUserID").Value; //labelOwner.Text = Request.Cookies.Get("eReimUserName").Value; //labelStation.Text = Request.Cookies.Get("eReimStation").Value; //labelDepartment.Text = Request.Cookies.Get("eReimDepartment").Value; //LabelCurrency.Text = DIMERCO.SDK.Utilities.LSDK.GetStationCurrencyByCode(Request.Cookies.Get("eReimCostCenter").Value); //LabelText.Text = "Please load eLeave Data."; ////检查是否已经为该申请人设置过审批人 //string sqlCheckFlow = ""; //sqlCheckFlow = "select * from GroupFlow where [Type]!=2 and GID=(select GID from GroupUsers where UserID='" + Request.Cookies.Get("eReimUserID").Value + "')"; //DataTable dtGroupFlowData = dbc.GetData("eReimbursement", sqlCheckFlow); //if (dtGroupFlowData.Rows.Count < 1) //{ // if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") // { // ErrorHandle("请先设置审批人."); // } // else // { // ErrorHandle("Not set Approve flow,please contact with Local MIS."); // } // return; //} X.AddScript("btnSaveAndSend.enable();Radio1.enable();Radio2.enable();"); DataTable dttest = new DataTable(); Store2.Reader[0].Fields.Add("Category", RecordFieldType.String); dttest.Columns.Add("Category", typeof(String)); string fieldPName = "Station_0_P"; Store2.Reader[0].Fields.Add(fieldPName, RecordFieldType.String); string fieldCName = "Station_0_C"; Store2.Reader[0].Fields.Add(fieldCName, RecordFieldType.String); dttest.Columns.Add("Station_0_P", typeof(String)); dttest.Columns.Add("Station_0_C", typeof(String)); // Store2.Reader[0].Fields.Add("Station_1_P", RecordFieldType.String); Store2.Reader[0].Fields.Add("Station_1_C", RecordFieldType.String); dttest.Columns.Add("Station_1_P", typeof(String)); dttest.Columns.Add("Station_1_C", typeof(String)); //合计列 Store2.Reader[0].Fields.Add("TotalP", RecordFieldType.String); Store2.Reader[0].Fields.Add("TotalC", RecordFieldType.String); dttest.Columns.Add("TotalP", typeof(String)); dttest.Columns.Add("TotalC", typeof(String)); DataRow dr = dttest.NewRow(); dr[0] = "1. Air Ticket - Int'l"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "Air Ticket - Domestic"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "2. Hotel Bill"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "3. Meals"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "4. Entertainment"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "5. Car Rental/Transportation"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "6. Communication"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "7. Local Trip Allowance"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "8. Overseas Trip Allowance"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "9. Airport Tax/Travel Insurance"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "10. Others"; dttest.Rows.Add(dr); dr = dttest.NewRow(); dr[0] = "Total"; dttest.Rows.Add(dr); Store2.DataSource = dttest; Store2.DataBind(); var TitleCol = new Column(); TitleCol.DataIndex = "Category"; TitleCol.Sortable = false; TitleCol.Resizable = false; TitleCol.MenuDisabled = true; TitleCol.Width = 180; this.GridPanel2.ColumnModel.Columns.Add(TitleCol); var txtP = new Ext.Net.NumberField(); //txtP.Listeners.Blur.Fn = "Cal"; //txtP.Listeners.Blur.Delay = 50; var colP = new Column(); colP.Header = "Person Pay"; colP.DataIndex = fieldPName; colP.Sortable = false; colP.Resizable = false; colP.MenuDisabled = true; colP.Width = 110; colP.Locked = true; colP.Editor.Add(txtP); this.GridPanel2.ColumnModel.Columns.Add(colP); var txtC = new Ext.Net.NumberField(); //txtC.Listeners.Blur.Fn = "Cal"; //txtC.Listeners.Blur.Delay = 50; var colC = new Column(); colC.Header = "Company Pay"; colC.DataIndex = fieldCName; colC.Sortable = false; colC.Resizable = false; colC.MenuDisabled = true; colC.Width = 110; colP.Locked = true; colC.Editor.Add(txtC); this.GridPanel2.ColumnModel.Columns.Add(colC); // var txtP1 = new Ext.Net.NumberField(); //txtP1.Listeners.Blur.Fn = "Cal"; //txtP1.Listeners.Blur.Delay = 50; var colP1 = new Column(); colP1.Header = "Person Pay"; colP1.DataIndex = "Station_1_P"; colP1.Sortable = false; colP1.Resizable = false; colP1.MenuDisabled = true; colP1.Width = 110; colP1.Locked = true; colP1.Editor.Add(txtP1); colP1.Hidden = true; this.GridPanel2.ColumnModel.Columns.Add(colP1); var txtC1 = new Ext.Net.NumberField(); //txtC1.Listeners.Blur.Fn = "Cal"; //txtC1.Listeners.Blur.Delay = 50; var colC1 = new Column(); colC1.Header = "Company Pay"; colC1.DataIndex = "Station_1_C"; colC1.Sortable = false; colC1.Resizable = false; colC1.MenuDisabled = true; colC1.Width = 110; colC1.Locked = true; colC1.Editor.Add(txtC1); colC1.Hidden = true; this.GridPanel2.ColumnModel.Columns.Add(colC1); // var TotalP = new Ext.Net.TextField(); TotalP.ReadOnly = true; var colTotalP = new Column(); colTotalP.DataIndex = "TotalP"; colTotalP.Sortable = false; colTotalP.Resizable = false; colTotalP.MenuDisabled = true; colTotalP.Width = 110; colTotalP.Locked = true; colTotalP.Editor.Add(TotalP); this.GridPanel2.ColumnModel.Columns.Add(colTotalP); var TotalC = new Ext.Net.TextField(); TotalC.ReadOnly = true; var colTotalC = new Column(); colTotalC.DataIndex = "TotalC"; colTotalC.Sortable = false; colTotalC.Resizable = false; colTotalC.MenuDisabled = true; colTotalC.Width = 110; colTotalC.Locked = true; colTotalC.Editor.Add(TotalC); this.GridPanel2.ColumnModel.Columns.Add(colTotalC); var Title1 = new Ext.Net.Label(); Title1.Text = "Destination:"; HeaderColumn hcTitle1 = new HeaderColumn(); hcTitle1.Component.Add(Title1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTitle1); var Station = new Ext.Net.TextField(); HeaderColumn hcStation = new HeaderColumn(); hcStation.Component.Add(Station); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation); //var Station = new Ext.Net.ComboBox(); //Station.DisplayField = "CityCode"; //Station.ValueField = "CityCode"; //Station.TypeAhead = true; //Station.ForceSelection = true; //Station.MinChars = 2; //Station.Mode = DataLoadMode.Local; //var storeStation = new Ext.Net.Store(); //storeStation.Reader.Add(new Ext.Net.JsonReader()); //DataSet GetCityInfo = DIMERCO.SDK.Utilities.LSDK.GetCityInfo("", 8000); //DataTable dtstation = GetCityInfo.Tables[0]; //storeStation.Reader[0].Fields.Add("CityCode", RecordFieldType.String); //Station.Store.Add(storeStation); //storeStation.DataSource = dtstation; //storeStation.DataBind(); //HeaderColumn hcStation = new HeaderColumn(); //hcStation.Component.Add(Station); //this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation); var Button = new Ext.Net.Button(); Button.Text = "Remove"; Button.Listeners.Click.Handler = "removecol(this,0);"; Button.Listeners.Click.Delay = 50; HeaderColumn hcButton = new HeaderColumn(); hcButton.Component.Add(Button); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton); // var Station1 = new Ext.Net.TextField(); HeaderColumn hcStation1 = new HeaderColumn(); hcStation1.Component.Add(Station1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1); //var Station1 = new Ext.Net.ComboBox(); //Station1.DisplayField = "CityCode"; //Station1.ValueField = "CityCode"; //Station1.TypeAhead = true; //Station1.MinChars = 2; //Station1.ForceSelection = true; //Station1.Mode = DataLoadMode.Local; //var storeStation1 = new Ext.Net.Store(); //storeStation1.Reader.Add(new Ext.Net.JsonReader()); //DataTable dtStation1 = new DataTable(); //dtStation1.Columns.Add("CityCode", typeof(String)); //for (int i = 0; i < 20; i++) //{ // DataRow dr2 = dtStation1.NewRow(); // if (i < 5) // { // dr2[0] = "CN" + i.ToString(); // } // else if (i >= 5 && i < 10) // { // dr2[0] = "GCR" + i.ToString(); // } // else // { // dr2[0] = "CRP" + i.ToString(); // } // dtStation1.Rows.Add(dr2); //} //storeStation1.Reader[0].Fields.Add("CityCode", RecordFieldType.String); //Station1.Store.Add(storeStation1); //storeStation1.DataSource = dtstation; //storeStation1.DataBind(); //HeaderColumn hcStation1 = new HeaderColumn(); //hcStation1.Component.Add(Station1); //this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcStation1); var Button1 = new Ext.Net.Button(); Button1.Text = "Remove"; Button1.Listeners.Click.Handler = "removecol(this,1);"; Button1.Listeners.Click.Delay = 50; HeaderColumn hcButton1 = new HeaderColumn(); hcButton1.Component.Add(Button1); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcButton1); // HeaderColumn hcTotal1 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal1); HeaderColumn hcTotal2 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[0].Columns.Add(hcTotal2); var Title2 = new Ext.Net.Label(); Title2.Text = "Cost Center:"; HeaderColumn hcTitle2 = new HeaderColumn(); hcTitle2.Component.Add(Title2); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTitle2); var CostCenter = new Ext.Net.TextField(); CostCenter.Disabled = true; CostCenter.EmptyText = "Station Code"; HeaderColumn hcCostCenter = new HeaderColumn(); hcCostCenter.Component.Add(CostCenter); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter); //var CostCenter = new Ext.Net.ComboBox(); //CostCenter.DisplayField = "StationCode"; //CostCenter.ValueField = "StationCode"; //CostCenter.TypeAhead = true; //CostCenter.ForceSelection = true; //CostCenter.MinChars = 2; //CostCenter.Mode = DataLoadMode.Local; //var storeCostCenter = new Ext.Net.Store(); //storeCostCenter.Reader.Add(new Ext.Net.JsonReader()); //DataSet GetCostCenterInfo = DIMERCO.SDK.Utilities.LSDK.getCostCenterBYStationCode("", 8000); //DataTable dtCostCenter = GetCostCenterInfo.Tables[0]; //storeCostCenter.Reader[0].Fields.Add("StationCode", RecordFieldType.String); //CostCenter.Store.Add(storeCostCenter); //storeCostCenter.DataSource = dtCostCenter; //storeCostCenter.DataBind(); //HeaderColumn hcCostCenter = new HeaderColumn(); //hcCostCenter.Component.Add(CostCenter); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter); //HeaderColumn hcCostCenter1 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1); var ButtonGetSum = new Ext.Net.Button(); ButtonGetSum.Text = "Calculate"; ButtonGetSum.Listeners.Click.Handler = "GetSum();"; ButtonGetSum.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSum = new HeaderColumn(); hcButtonGetSum.Component.Add(ButtonGetSum); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum); // var CostCenter0 = new Ext.Net.TextField(); CostCenter0.Disabled = true; CostCenter0.EmptyText = "Station Code"; HeaderColumn hcCostCenter0 = new HeaderColumn(); hcCostCenter0.Component.Add(CostCenter0); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter0); //var CostCenter1 = new Ext.Net.ComboBox(); //CostCenter1.DisplayField = "StationCode"; //CostCenter1.ValueField = "StationCode"; //CostCenter1.TypeAhead = true; //CostCenter1.ForceSelection = true; //CostCenter1.MinChars = 2; //CostCenter1.Mode = DataLoadMode.Local; //var storeCostCenter1 = new Ext.Net.Store(); //storeCostCenter1.Reader.Add(new Ext.Net.JsonReader()); //storeCostCenter1.Reader[0].Fields.Add("StationCode", RecordFieldType.String); //CostCenter1.Store.Add(storeCostCenter1); //storeCostCenter1.DataSource = dtCostCenter; //storeCostCenter1.DataBind(); //HeaderColumn hcCostCenter1 = new HeaderColumn(); //hcCostCenter1.Component.Add(CostCenter1); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter1); //HeaderColumn hcCostCenter01 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcCostCenter01); var ButtonGetSum1 = new Ext.Net.Button(); ButtonGetSum1.Text = "Calculate"; ButtonGetSum1.Listeners.Click.Handler = "GetSum();"; ButtonGetSum1.Listeners.Click.Delay = 50; HeaderColumn hcButtonGetSum1 = new HeaderColumn(); hcButtonGetSum1.Component.Add(ButtonGetSum1); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcButtonGetSum1); // HeaderColumn hcTotal3 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal3); HeaderColumn hcTotal4 = new HeaderColumn(); this.GridPanel2.GetView().HeaderRows[1].Columns.Add(hcTotal4); var Title3 = new Ext.Net.Label(); Title3.Text = "Travel Period:"; HeaderColumn hcTitle3 = new HeaderColumn(); hcTitle3.Component.Add(Title3); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitle3); HeaderColumn hcDate1 = new HeaderColumn(); var Date1 = new DateField(); Date1.EmptyText = "yyyy/MM/dd"; Date1.Format = "yyyy/MM/dd"; //Date1.SetValue("2013/11/1"); hcDate1.Component.Add(Date1); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate1); HeaderColumn hcDate2 = new HeaderColumn(); var Date2 = new DateField(); Date2.EmptyText = "yyyy/MM/dd"; Date2.Format = "yyyy/MM/dd"; //Date2.SetValue("2013/11/2"); hcDate2.Component.Add(Date2); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate2); // HeaderColumn hcDate3 = new HeaderColumn(); var Date3 = new DateField(); Date3.EmptyText = "yyyy/MM/dd"; Date3.Format = "yyyy/MM/dd"; //Date3.SetValue("2013/11/1"); hcDate3.Component.Add(Date3); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate3); HeaderColumn hcDate4 = new HeaderColumn(); var Date4 = new DateField(); Date4.EmptyText = "yyyy/MM/dd"; Date4.Format = "yyyy/MM/dd"; //Date4.SetValue("2013/11/2"); hcDate4.Component.Add(Date4); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcDate4); // //HeaderColumn hcTotal5 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal5); //HeaderColumn hcTotal6 = new HeaderColumn(); //this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTotal6); var TitleTotalP = new Ext.Net.Label(); TitleTotalP.Text = "Total(Person)"; TitleTotalP.Cls = "custom-row"; HeaderColumn hcTitleTotalP = new HeaderColumn(); hcTitleTotalP.Component.Add(TitleTotalP); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalP); var TitleTotalC = new Ext.Net.Label(); TitleTotalC.Text = "Total(Comp)"; TitleTotalC.Cls = "custom-row"; HeaderColumn hcTitleTotalC = new HeaderColumn(); hcTitleTotalC.Component.Add(TitleTotalC); this.GridPanel2.GetView().HeaderRows[2].Columns.Add(hcTitleTotalC); X.AddScript("GridPanel2.colModel.setHidden(3, true);GridPanel2.colModel.setHidden(4, true);Store2.removeField('Station_1_P');Store2.removeField('Station_1_C');"); } //DataSet dsdep = DIMERCO.SDK.Utilities.LSDK.getCRPDepartment(); //DataTable dtdep = new DataTable(); //dtdep.Columns.Add(new DataColumn("Depart", typeof(String))); //for (int i = 0; i < dsdep.Tables[0].Rows.Count; i++) //{ // DataRow dr = dtdep.NewRow(); // dr[0] = dsdep.Tables[0].Rows[i][2].ToString(); // dtdep.Rows.Add(dr); //} //StoreDepartment.DataSource = dtdep; //StoreDepartment.DataBind(); } }