public IHttpActionResult UpdateUser(UserTab model) { try { if (model != null) { var effectRow = Db.Context(APP.DB_DEFAULT_CONN_NAME).Update("UserTab"). Column("name", model.name). Column("role", model.role). Column("isclosed", model.isclosed). Column("avatar", model.avatar). Column("introduction", model.introduction).Where("userId", model.userId).Execute(); if (effectRow > 0) { return(Success("操作成功!")); } else { return(Error("操作失败!")); } } else { return(Error("操作失败!")); } } catch (Exception e) { return(Exception(e.Message)); } }
/// <summary> /// Creates a tab btn in the tab panel for the given user tab /// the button is store as an attribute in the usertab class /// </summary> /// <param name="tab">The user tab to create a button for</param> public void AddTabButton(UserTab tab) { btn = CreateTabButton(tab.ToString()); tab.SetTabButton(btn); grid_addTabs.Children.Add(btn); tabButtonsList.Add(btn); // tabPanel.Children.Add(btn); lbl_tabName.Content = tab.ToString(); grid_summary.Background = tab.GetTabButton().Background; Storyboard sb = Resources["sbShowTab"] as Storyboard; sb.Begin(btn); lbl_tabTotal.Content = "Total: $" + tab.amountOwing.ToString("F"); this.focusedTab = tab; }
public IHttpActionResult CreateUser(UserTab model) { try { if (model != null) { string userId = Guid.NewGuid().ToString().ToLower(); model.userId = userId; if (Db.Context(APP.DB_DEFAULT_CONN_NAME).Sql(string.Format(@"select top 1 * from usertab where username ='******'", model.username)).QuerySingle <dynamic>() == null) { var effectRow = Db.Context(APP.DB_DEFAULT_CONN_NAME).Insert("UserTab"). Column("userId", model.userId). Column("name", model.name). Column("username", model.username). Column("password", CommonMethod.MD5Encrypt32("123456")). Column("role", model.role). Column("isclosed", model.isclosed). Column("avatar", model.avatar). Column("introduction", model.introduction).Execute(); if (effectRow > 0) { return(Success("success", model)); } else { return(Error("新增用户失败!")); } } else { return(Error("当前用户名已经存在!")); } } else { return(Error("未能查询到表单!")); } } catch (Exception e) { return(Exception(e.Message)); } }
private void btn_payNow_Click(object sender, RoutedEventArgs e) { ms.allTabs.RemoveTab(ms.focusedTab); ms.grid_addTabs.Children.Remove(ms.focusedTab.GetTabButton()); ms.tabButtonsList.Remove(ms.focusedTab.GetTabButton()); ms.newTabThickness -= 75; int marginTop = 150; int i = 0; bool foundButton = false; foreach (Button btn in ms.tabButtonsList) { //if (btn == ms.focusedTab.GetTabButton()) //{ // foundButton = true; //} //if (foundButton) //{ btn.Margin = new Thickness(0, marginTop, 0, 0); i++; marginTop += 75; //} } if (ms.allTabs.GetTabs().Count > 0) { UserTab ut = ms.allTabs.GetTabs()[0]; ms.lbl_tabTotal.Content = "Total: $" + ut.amountOwing; ms.lbl_tabName.Content = ut.ToString(); ms.grid_summary.Background = ut.GetTabButton().Background; ms.focusedTab = ut; this.Close(); } else { //that was the last tab this.Close(); ClosingScreen cs = new ClosingScreen(3000); ms.Close(); MainScreen mainScreen = new MainScreen(); } }
private void btn_submit_Click(object sender, RoutedEventArgs e) { string theText = txtbox_name.Text.Trim(); if (theText.Equals("") || theText == null) { if (ms.allTabs == null) { theText = "0"; } else { theText = (ms.allTabs.GetTabs().Count).ToString(); } } else { theText = theText.First().ToString().ToUpper() + String.Join("", theText.Skip(1)); } //pass textbox input into MainScreen UserTab tab = new UserTab(theText); //create a new user tab if (ms.isStartup) { ActiveTabs allTabs = new ActiveTabs(tab); ms.allTabs = allTabs; ms.OpenWindow(); this.Close(); homeScreen.Close(); } else { ms.allTabs.AddTab(tab); ms.AddTabButton(ms.allTabs.GetTabs()[ms.allTabs.GetTabs().Count - 1]); this.Close(); } }
private void AsyncInititalize(object sender, DoWorkEventArgs e) { try { // Execute the following code on the GUI thread. this.Invoke(new MethodInvoker(delegate { RenderLoading(true); })); }catch { } Sell = new Sell(); SellRegister = new SellRegister(); SalesLedger = new SalesLedger(); Reporting = new Reporting(); Products = new ProductsTab(); Customers = new UserControls.Dashboard.Customers(); Settings = new Settings(); UserTabSlider = new UserTab(); NotificationsTabSlider = new NotificationsTab(); }
void Awake() { I = this; }