You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using BookingWeb.DB;
|
|
using BookingWeb.DB.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace BookingWeb.Controllers
|
|
{
|
|
public class ManageController : BaseController
|
|
{
|
|
private static readonly string ManagerId = ConfigurationManager.AppSettings["managerId"];
|
|
|
|
private BookingDB bookingDB = new BookingDB();
|
|
|
|
[HttpGet]
|
|
public ActionResult ClientList()
|
|
{
|
|
if(ManagerId.IndexOf(CurrentUser.GID)==-1)
|
|
{
|
|
return Content("非管理员用户");
|
|
}
|
|
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
public ActionResult ClientListData(int offset = 1, int limit = 10)
|
|
{
|
|
var list = bookingDB.Clients.OrderBy(c => c.CODE).Skip(offset).Take(limit).ToList();
|
|
var rtnObj = new
|
|
{
|
|
Total = bookingDB.Clients.Count(),
|
|
DataList = list
|
|
};
|
|
return Json(list);
|
|
}
|
|
|
|
|
|
|
|
[HttpGet]
|
|
public ActionResult ClientEdit(string gid)
|
|
{
|
|
if (ManagerId.IndexOf(CurrentUser.GID) == -1)
|
|
{
|
|
return Content("非管理员用户");
|
|
}
|
|
|
|
var client = bookingDB.Clients.FirstOrDefault(c => c.GID == gid);
|
|
return View(client);
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
public ActionResult ClientSave(SysClient model)
|
|
{
|
|
var client = bookingDB.Clients.FirstOrDefault(c => c.GID == model.GID);
|
|
client.NAME = model.NAME;
|
|
client.CODE = model.CODE;
|
|
client.URL = model.URL;
|
|
client.BANK_NAME_RMB = model.BANK_NAME_RMB;
|
|
client.BANK_ACCOUNT_RMB = model.BANK_ACCOUNT_RMB;
|
|
client.BANK_NAME_USD = model.BANK_NAME_USD;
|
|
client.BANK_ACCOUNT_USD = model.BANK_ACCOUNT_USD;
|
|
client.ADDRESS = model.ADDRESS;
|
|
client.TEL = model.TEL;
|
|
client.REMARK = model.REMARK;
|
|
client.EMAIL = model.EMAIL;
|
|
client.SMTP_SERVER = model.SMTP_SERVER;
|
|
client.SMTP_PORT = model.SMTP_PORT;
|
|
client.SMTP_SSL = model.SMTP_SSL;
|
|
client.MAIL_ACCOUNT = model.MAIL_ACCOUNT;
|
|
client.MAIL_PASSWORD = model.MAIL_PASSWORD;
|
|
bookingDB.SaveChanges();
|
|
return Json(new { Success = true, Message = "保存成功" });
|
|
}
|
|
}
|
|
} |