public string GetUserByAccountName(Stream stream) { string accountName = string.Empty; string passWord = string.Empty; StreamReader sr = new StreamReader(stream); try { IPInfoModel iPInfo = RequestHelper.RequestInfo(); string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); accountName = nvc["accountName"]; passWord = nvc["passWord"]; string str = UserBill.GetUserByAccountName(accountName, passWord, iPInfo.Address, iPInfo.Port); return(str); // sr.Dispose(); //NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); //accountName = nvc["accountName"]; //passWord = nvc["passWord"]; } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } // ResponseHelper.SetHeaderInfo(); // string str = UserBill.GetUserByAccountName(accountName, passWord); // return str; }
public List <UserBill> GetWorkshopBills(int workshop_id) { ServicesQuery serviceQuery = new ServicesQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(serviceQuery.GetWorkshopBill(workshop_id)); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } List <UserBill> UserBills = new List <UserBill>(); foreach (System.Data.DataRow row in dataTable.Rows) { UserBill userBill = new UserBill(); userBill.id = Convert.ToInt32(row["ID"].ToString()); userBill.PLATENUMBER = row["PLATENUMBER"].ToString(); userBill.ACCIDENTDATE = Convert.ToDateTime(row["ACCIDENTDATE"].ToString()).ToString("yyyy-mm-dd"); userBill.USER_ID = Convert.ToInt32(row["USER_ID"].ToString()); userBill.FIX_PRICE = Convert.ToDouble(row["FIX_PRICE"].ToString()); userBill.SPARE_PRICE = Convert.ToDouble(row["SPARE_PRICE"].ToString()); userBill.RENT_PRICE = Convert.ToDouble(row["RENT_PRICE"].ToString()); userBill.TRANSCAR_PRICE = Convert.ToDouble(row["TRANSCAR_PRICE"].ToString()); userBill.note = row["NOTE"].ToString(); userBill.workshop_id = Convert.ToInt32(row["workshop_id"].ToString()); UserBills.Add(userBill); } return(UserBills); }
public string GetNoticeItemById(Stream stream) { string Code = string.Empty; StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); Helper.ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); Code = nvc["Code"]; string Token = nvc["Token"]; UserBill.CheckToken(Token); string str = NoticeBill.GetNoticeItemById(Code); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string SetMenuRole(Stream stream) { string menuIds = string.Empty; string roleIds = string.Empty; string menuStr = string.Empty; StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); roleIds = nvc["roleId"]; menuStr = nvc["menuStr"]; string Token = nvc["Token"]; UserBill.CheckToken(Token); int roleId = Convert.ToInt32(roleIds); string str = RoleBill.SetMenuRole(roleId, menuStr); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string GetFlowInfoByMenuId(Stream stream) { string MenuId = string.Empty; StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); Helper.ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); MenuId = nvc["MenuId"]; string Token = nvc["Token"]; UserBill.CheckToken(Token); int id = Convert.ToInt32(MenuId); string str = FlowBill.GetFlowInfoByMenuId(id); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public IActionResult DeleteBill(UserBill billdata) { var data = myContext.UserBills.Where(x => x.id == billdata.id).FirstOrDefault(); myContext.UserBills.Remove(data); myContext.SaveChanges(); return(RedirectToAction("BillList")); }
public bool update(UserBill u) { bool isSuccess = false; SqlConnection conn = new SqlConnection(connstring1); try { string sql = "UPDATE users set first_name =@first_name,last_name=@last_name,email=@email,username=@username,password=@password,contact=@contact,address=@address,gender=@gender,user_type=@user_type,address_date=@added_date,added_by =@added_by where id = @id"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@first_name", u.first_name); cmd.Parameters.AddWithValue("@last_name", u.first_name); cmd.Parameters.AddWithValue("@email", u.first_name); cmd.Parameters.AddWithValue("@username", u.first_name); cmd.Parameters.AddWithValue("@password", u.first_name); cmd.Parameters.AddWithValue("@contact", u.contact); cmd.Parameters.AddWithValue("@address", u.address); cmd.Parameters.AddWithValue("@gender", u.gender); cmd.Parameters.AddWithValue("@user_type", u.user_type); cmd.Parameters.AddWithValue("@added_date", u.added_date); cmd.Parameters.AddWithValue("@added_by", u.added_by); cmd.Parameters.AddWithValue("@id", u.id); conn.Open(); int rows = cmd.ExecuteNonQuery(); //if the query success it will give sucess message if (rows > 0) { isSuccess = true; } else { isSuccess = false; } } catch (Exception e) { MessageBox.Show(e.Message); } finally { conn.Close(); } return(isSuccess); }
public bool Insert(UserBill u) { bool isSuccess = false; SqlConnection conn = new SqlConnection(connstring1); try { String sql = "insert into users(first_name,last_name,email,username,password,contact,address,gender,user_type,address_date,added_by) values(@first_name,@last_name,@email,@username,@password,@contact,@address,@gender,@user_type,@added_date,@added_by)"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@first_name", u.first_name); cmd.Parameters.AddWithValue("@last_name", u.last_name); cmd.Parameters.AddWithValue("@email", u.email); cmd.Parameters.AddWithValue("@username", u.username); cmd.Parameters.AddWithValue("@password", u.password); cmd.Parameters.AddWithValue("@contact", u.contact); cmd.Parameters.AddWithValue("@address", u.address); cmd.Parameters.AddWithValue("@gender", u.gender); cmd.Parameters.AddWithValue("@user_type", u.user_type); cmd.Parameters.AddWithValue("@added_date", u.added_date); cmd.Parameters.AddWithValue("@added_by", u.added_by); conn.Open(); int rows = cmd.ExecuteNonQuery(); //if the query is excecuted succesfully then the value to rows will greater than 0 else it will less than 0 if (rows > 0) { isSuccess = true; } else { isSuccess = false; } } catch (Exception e) { MessageBox.Show(e.Message); } finally { conn.Close(); } return(isSuccess); }
public IActionResult Bill(UserBill data) { if (ModelState.IsValid) { myContext.UserBills.Add(data); myContext.SaveChanges(); return(RedirectToAction("BillList")); } return(View(data)); }
public IActionResult Editbill(UserBill data) { if (ModelState.IsValid) { var updata = myContext.UserBills.Where(x => x.id == data.id).FirstOrDefault(); updata.bill = data.bill; updata.userID = data.userID; myContext.SaveChanges(); return(RedirectToAction("BillList")); } return(View(data)); }
public string UpLoadFile(Stream stream, string Token, string DirName, string No) { try { UserBill.CheckToken(Token); string str = FileBill.UpLoadFile(stream, DirName, No); ResponseHelper.SetHeaderInfo(); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string GetAllDeptForTransfer(Stream stream) { StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); ResponseHelper.SetHeaderInfo(); string Token = nvc["Token"]; UserBill.CheckToken(Token); string str = DeptBill.GetAllDeptForTransfer(); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string DeleteFlow(Stream stream) { StreamReader sr = new StreamReader(stream); try { Helper.ResponseHelper.SetHeaderInfo(); string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); string Token = nvc["Token"]; UserBill.CheckToken(Token); string delStr = nvc["str"]; string[] list = delStr.Split(','); string str = FlowBill.DeleteFlow(list); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string GetMenuByRoleIdForTree(Stream stream) { StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); string Ids = nvc["Id"]; int Id = Convert.ToInt32(Ids); string Token = nvc["Token"]; UserBill.CheckToken(Token); string str = RoleBill.GetMenuByRoleIdForTree(Id); return(str); } catch (Exception ex) { return(BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public IActionResult AddUserBill(UserBillDTO userBill) { //鉴权 var userid = _utils.VerifyRequest(userBill.token); if (userid is null) { return(StatusCode(403)); } //存储 UserBill userBill1 = new UserBill(); userBill1.amount = userBill.amount; userBill1.category = userBill.category; userBill1.datetime = userBill.datetime; userBill1.type = userBill.type; userBill1.remark = userBill.remark; userBill1.userid = int.Parse(userid); _context.UserBill.Add(userBill1); _context.SaveChanges(); return(StatusCode(201)); }
public string GetAllFlowInfo(Stream stream) { StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); Helper.ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); string ParameterStr = nvc["ParameterStr"]; int PageSize = Convert.ToInt32(nvc["PageSize"]); int CurrentPage = Convert.ToInt32(nvc["CurrentPage"]); string Token = nvc["Token"]; UserBill.CheckToken(Token); string str = FlowBill.GetAllFlowInfo(ParameterStr, PageSize, CurrentPage); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string UpdateFlowStatus(Stream stream) { StreamReader sr = new StreamReader(stream); try { Helper.ResponseHelper.SetHeaderInfo(); string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); string Code = nvc["Code"]; string oldStatus = nvc["oldStatus"]; string newStatus = nvc["newStatus"]; string Token = nvc["Token"]; string UpdateBy = nvc["UpdateBy"]; UserBill.CheckToken(Token); string str = FlowBill.UpdateFlowStatus(Code, Convert.ToInt32(oldStatus), Convert.ToInt32(newStatus), UpdateBy); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public string GetButtonByMenuIdAndUserId(Stream stream) { StreamReader sr = new StreamReader(stream); try { string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s); ResponseHelper.SetHeaderInfo(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s); string menuIds = nvc["menuId"]; int menuId = Convert.ToInt32(menuIds); string userIds = nvc["userId"]; int userId = Convert.ToInt32(userIds); string Token = nvc["Token"]; UserBill.CheckToken(Token); string str = ButtonBLL.GetButtonByMenuIdAndUserId(menuId, userId); return(str); } catch (Exception ex) { return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, "")); } }
public bool Delete(UserBill u) { bool isSuccess = false; SqlConnection conn = new SqlConnection(connstring1); try { string sql = "DELETE FROM users where id = @id"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("@id", u.id); conn.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { isSuccess = true; } else { isSuccess = false; } } catch (Exception e) { MessageBox.Show(e.Message); } finally { conn.Close(); } return(isSuccess); }