private void AddUserInfo(HttpContext context) { BLL.UserInfo bll = new BLL.UserInfo(); string UserName = context.Request["U_username"]; int ExistRes = bll.Exist(string.Format("U_username='******'", UserName)); if (ExistRes > 0) { context.Response.Write("exist"); return; } Model.UserInfo model = new Model.UserInfo(); model.U_username = UserName; model.U_password = model.U_username; model.U_power = context.Request["U_power"]; model.U_nickname = context.Request["U_nickname"]; model.U_mailbox = context.Request["U_mailbox"]; model.U_Role = context.Request["U_Role"]; model.U_Comments = context.Request["U_Comments"]; model.U_CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); model.U_IsDelete = 0; if (bll.Add(model) > 0) { context.Response.Write("success"); } else { context.Response.Write("fail"); } }
private void UpdateUserInfo(HttpContext context) { BLL.UserInfo bll = new BLL.UserInfo(); string UserName = context.Request["U_username"]; string ID = context.Request["U_ID"]; int ExistRes = bll.Exist(string.Format("U_username='******' and U_ID not in ({1})", UserName, ID)); if (ExistRes > 0) { context.Response.Write("exist"); return; } Model.UserInfo model = new Model.UserInfo(); model.U_ID = Convert.ToInt32(ID); model.U_username = UserName; model.U_power = context.Request["U_power"]; model.U_nickname = context.Request["U_nickname"]; model.U_mailbox = context.Request["U_mailbox"]; model.U_Role = context.Request["U_Role"]; model.U_Comments = context.Request["U_Comments"]; if (bll.Update(model)) { context.Response.Write("success"); } else { context.Response.Write("fail"); } }