public ActionResult Delete(int id, int count) { ReturnData<string> ret = new ReturnData<string>(); ReturnData<string> check = new ReturnData<string>(); IList<ChannelJoinGoods> cModel = cbll.GetCGListByGId(id, LoginUser.UserBasic.EnterpriseID); if (cModel.Count != 0) { return Content("存在关联!不能删除!请先取消关联!"); } GoodsGroup model = bll.GetModelById(id); if (count == 0) { ret = bll.DeleteGoodsGroup(model); } else { return Content("当前分组下存在商品,请先移除商品!"); } if (ret.Status == true && check.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
public ReturnData autoCodeByTableName(string xmlpara) { ReturnData rr = new ReturnData(); try { BLL.BLLBase bll = new BLL.BLLBase(); DataTable dt = Util.JsonHelper.Json2Dtb(xmlpara); string PreName = dt.Rows[0]["PreName"].ToString(); string dtTime = dt.Rows[0]["dtTime"].ToString(); string TableName = dt.Rows[0]["TableName"].ToString(); string Filter = dt.Rows[0]["Filter"].ToString(); string strCode = bll.GetAutoCodeByTableName(PreName, TableName, DateTime.Parse(dtTime), Filter); rr.data = strCode; rr.type = "" + strCode.GetType(); } catch (Exception ex) { } return rr; }
public ActionResult Index(AgentInfoView model) { ReturnData<string> ret=new ReturnData<string>(); AgentInfoViewBll bll=new AgentInfoViewBll(); ret=bll.EditAgent(model); return Json(ret); }
public static string _host = ".kerlaii.com";//从数据库动态获取 public void OnActionExecuting(ActionExecutingContext filterContext) { bool isajax = filterContext.HttpContext.Request.IsAjaxRequest(); UserPC user = filterContext.HttpContext.Session["user"] as UserPC; string host = filterContext.HttpContext.Request.Url.Host; string key = host.Replace(_host, ""); //本地调试,模拟e0001企业 opera if (host.ToLower() == "localhost") { key = "e0001"; } EnterpriseBll bll = new EnterpriseBll(); string[] keys = bll.GetAllEnteriseKey(); if (key !="opera" && !keys.Contains(key)) { filterContext.Result = new HttpNotFoundResult(); return; //没有该企业 } filterContext.HttpContext.Session["enterpriseKey"] = key; if (check) { if (user == null) { ReturnData<string> ret = new ReturnData<string>(); if (isajax) { ret.Status = false; Dictionary<string, object> Identify = new Dictionary<string, object>(); Identify.Add("expired", true); ret.Identify = Identify; filterContext.Result = new ContentResult() { Content = ret.GetJson() }; return; } //跳转页面 filterContext.Result = new ContentResult() { Content = "<script>window.top.location.href ='/';</script>" }; return ; } LogAdapter.Write(user.UserBasic.EnterpriseID+" "+key, LogAdapter.LogMode.ERROR); //当前用户不是当前企业 if (user.UserBasic.EnterpriseID != key) { filterContext.HttpContext.Response.Redirect("/Login"); } } }
private void DeleteData(HttpContext context) { string pk = context.Request["pk"]; bool success = true; Object obj = pk; string msg = "删除成功"; ReturnData resd = new ReturnData(obj, success,msg); string jsonStrResult = resd.Res(); context.Response.Write(jsonStrResult); }
/// <summary> /// /// </summary> /// <param name="filterContext"></param> public void OnActionExecuting(ActionExecutingContext filterContext) { return; ReturnData<string> returndata = new ReturnData<string>(); UserPC user = filterContext.HttpContext.Session["user"] as UserPC; //string controllerName = (string)filterContext.RouteData.Values["controller"]; //control //string actionName = (string)filterContext.RouteData.Values["action"]; //action if (check) { if (user == null) { //跳转页面 filterContext.HttpContext.Response.Redirect("/Login/index"); return; } //权限验证! bool hasCount = false; if (Autorizs == null) { returndata.Status = false; returndata.Message = "没有该权限!"; filterContext.Result = new ContentResult() { Content = returndata.GetJson() }; return; } foreach (var val in Autorizs) { if (user.RolePowerList !=null && user.RolePowerList.Where(x => x.PowerID == val.GetDescriptionN(0)).Count() > 0) { hasCount = true; break; } } if (!hasCount) { //验证失败后 调 用 returndata.Message = "没有该权限!"; filterContext.Result = new ContentResult() { Content = returndata.GetJson() }; return; } } }
public ActionResult Add(GoodsGroup model) { model.EnterpriseID = LoginUser.UserBasic.EnterpriseID; ReturnData<string> ret = new ReturnData<string>(); ret = bll.AddGoodsGroup(model); if (ret.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
public override void OnException(HttpActionExecutedContext context) { log.ErrorFormat("[{0}]: {1}", context.Request.RequestUri, context.Exception.Message); log.ErrorFormat("[{0}]: {1}", context.Request.RequestUri, context.Exception.StackTrace); //base.OnException(context); var data = new ReturnData <string>(); data.success = false; data.error = 10; context.Response = new HttpResponseMessage(HttpStatusCode.OK); context.Response.Content = new StringContent(JsonConvert.SerializeObject(data), System.Text.Encoding.UTF8, "application/json"); }
public ActionResult Add(GoodsGroup model) { model.EnterpriseID = LoginUser.UserBasic.EnterpriseID; ReturnData <string> ret = new ReturnData <string>(); ret = bll.AddGoodsGroup(model); if (ret.Status == true) { return(Content(ret.Message)); } return(Content(ret.Message)); }
public HttpResponseMessage signOutUser(string userId, string token) { ReturnData rd = new ReturnData(); UserAccess u = new UserAccess(); rd = u.delete_token(userId, token); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public HttpResponseMessage makePayments(string studentID, double totalFineAmount, string reason, string TransactionID, string branchName, bool PaymentApproved) { ReturnData rd = new ReturnData(); paymentDetails c = new paymentDetails(); rd = c.makePayments(studentID, totalFineAmount, reason, TransactionID, branchName, PaymentApproved); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public HttpResponseMessage deleteRequestBook(string requestID) { ReturnData rd = new ReturnData(); requestedBook c = new requestedBook(); rd = c.deleteRequestBook(requestID); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public HttpResponseMessage deleteBookCodeDetailsFromBookID(string bookCode) { ReturnData rd = new ReturnData(); BookCodeDetails u = new BookCodeDetails(); rd = u.deleteBookCodeDetailsFromBookID(bookCode); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public HttpResponseMessage copyFromBookIssueTemp(string bookCode) { ReturnData rd = new ReturnData(); bookIssuingDetailsTempory u = new bookIssuingDetailsTempory(); rd = u.copyFromBookIssueTemp(bookCode); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
/// <summary> /// /// </summary> /// <param name="filterContext"></param> public void OnActionExecuting(ActionExecutingContext filterContext) { return; ReturnData <string> returndata = new ReturnData <string>(); UserPC user = filterContext.HttpContext.Session["user"] as UserPC; //string controllerName = (string)filterContext.RouteData.Values["controller"]; //control //string actionName = (string)filterContext.RouteData.Values["action"]; //action if (check) { if (user == null) { //跳转页面 filterContext.HttpContext.Response.Redirect("/Login/index"); return; } //权限验证! bool hasCount = false; if (Autorizs == null) { returndata.Status = false; returndata.Message = "没有该权限!"; filterContext.Result = new ContentResult() { Content = returndata.GetJson() }; return; } foreach (var val in Autorizs) { if (user.RolePowerList != null && user.RolePowerList.Where(x => x.PowerID == val.GetDescriptionN(0)).Count() > 0) { hasCount = true; break; } } if (!hasCount) { //验证失败后 调 用 returndata.Message = "没有该权限!"; filterContext.Result = new ContentResult() { Content = returndata.GetJson() }; return; } } }
public ReturnData GetConfig() { Trace.WriteLine(string.Format("{0} GetConfig(): Call", DateTime.Now.ToString("yyyyMMdd HH:mm:ss.fff"))); ReturnData returnData = new ReturnData { ReturnCode = ReturnCode.Successful, ReturnValue = _parameterHandler.GetCurrentParameters() }; Trace.WriteLine(string.Format("{0} GetConfig(): Return", DateTime.Now.ToString("yyyyMMdd HH:mm:ss.fff"))); return(returnData); }
public override void OnException(HttpActionExecutedContext context) { log.ErrorFormat("[{0}]: {1}", context.Request.RequestUri, context.Exception.Message); log.ErrorFormat("[{0}]: {1}", context.Request.RequestUri, context.Exception.StackTrace); //base.OnException(context); var data = new ReturnData<string>(); data.success = false; data.error = 10; context.Response = new HttpResponseMessage(HttpStatusCode.OK); context.Response.Content = new StringContent(JsonConvert.SerializeObject(data), System.Text.Encoding.UTF8, "application/json"); }
public HttpResponseMessage extendTheBook(bookIssuingDetails bookIssuing) { ReturnData rd = new ReturnData(); bookIssuingDetails bookIssuingDetails = new bookIssuingDetails(); rd = bookIssuingDetails.extendTheBook(bookIssuing); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public void Constructor_GivenSubmittedBy_SubmittedPropertiesShouldBeSet() { var returnData = new ReturnData() { SubmittedBy = "submittedBy", SubmittedDate = new DateTime(2019, 1, 1, 11, 1, 2), Quarter = GetQuarter(), QuarterWindow = GetQuarterWindow() }; var model = new ReturnViewModelTest(returnData); model.SubmittedBy.Should().Be("submittedBy"); model.SubmittedDate.Should().Be("01/01/2019 11:01:02"); }
public async Task <HttpResponseMessage> ForgotPassword(ForgotPasswordViewModel model, bool IsSMSEnabled) { if (ModelState.IsValid) { ReturnData code = await _repo.ForgotPassword(model, IsSMSEnabled, Language); return(OkResponse <ReturnData>(code)); } // If we got this far, something failed, redisplay form return(NotFoundResponse("Error", "Invalid Data")); }
public HttpResponseMessage changePassword(string userID, string new_pass) { ReturnData rd = new ReturnData(); UserAccess u = new UserAccess(); rd = u.changePassword(userID, new_pass); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public string UpdateThankCardReply(string paramList) { //Accepting data from var arr = JObject.Parse(paramList); int id = (int)arr["Id"]; string status = (string)arr["status"]; string reply_text = (string)arr["reply"]; //Checking Data Have or Not in ThanksCards Table var thankcards = _context.ThankCards.Where(e => e.Id == id && e.isActive == true); ////Creating Objects for Json Returns IDictionary <string, List <object> > result = new Dictionary <string, List <object> >(); List <object> returndata = new List <object>(); List <object> emprdata = new List <object>(); List <object> returnstatus = new List <object>(); ReturnData retdata = new ReturnData(); //Checking Data Have or Not in ThankCards Table if (thankcards.Count() > 0) { // Updating Row data with Client Update Data List <object> thankcardlist = _thankcardservice.updateThankCardReply(id, status, reply_text); // Get employee data from Employee if (thankcardlist.Count() > 0) { ThankCard objcard1 = new ThankCard(); objcard1 = (ThankCard)thankcardlist[0]; List <object> fromempdata1 = _thankcardservice.getEmployee("%", "%", objcard1.From_Employee_Id.ToString(), objcard1.To_Employee_Id.ToString()); emprdata.Add(fromempdata1); result["fromEmpData"] = emprdata; } //Return Updated Result to Client with JSON format returndata.Add(thankcardlist); retdata.statuscode = "200"; retdata.status = "Success"; returnstatus.Add(retdata); result["status"] = returnstatus; result["thankcards"] = returndata; } else { // There is no data to update retdata.statuscode = "304"; retdata.status = "No Data To Update"; returnstatus.Add(retdata); result["status"] = returnstatus; result["thankcards"] = returndata; } return(JsonConvert.SerializeObject(result)); }
public HttpResponseMessage updateBookDueDate(string studentID) { ReturnData rd = new ReturnData(); bookIssuingDetails u = new bookIssuingDetails(); rd = u.updateBookDueDate(studentID); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public HttpResponseMessage SendMail() { ReturnData result = new ReturnData(); MyPlatform.Common.Mail.MailConfig mailConfig = new Common.Mail.MailConfig(); MyPlatform.Common.Mail.MailHelper mailHelper = new Common.Mail.MailHelper(); mailHelper.config = mailConfig; mailHelper.SendMail(); result.M = "邮件发送成功!"; result.S = true; return(MyResponseMessage.SuccessJson <ReturnData>(result)); }
public string CheckUser(String paramsList) { // var user = await _context.Users.FindAsync(id); var arr = JObject.Parse(paramsList); string name = (string)arr["user_name"]; string password = (string)arr["password"]; var user = _context.Users.Where(e => e.User_Name == name && e.Password == password && e.isActive == true); IDictionary <string, List <object> > result = new Dictionary <string, List <object> >(); List <object> returndata = new List <object>(); List <object> returnEmpdata = new List <object>(); List <object> returnstatus = new List <object>(); ReturnData retdata = new ReturnData(); try { if (user.Count() > 0) { retdata.statuscode = "200"; retdata.status = "Success"; returnstatus.Add(retdata); } } catch (ArgumentException e) { Console.WriteLine(e.Message); } if (user.Count() > 0) { retdata.statuscode = "200"; retdata.status = "Success"; returnstatus.Add(retdata); returndata = _userService.getData(name, password); returnEmpdata = _empService.getEmployeeByUser(name); result["status"] = returnstatus; result["menu"] = returndata; result["emp"] = returnEmpdata; //result["message"] = "Success"; } else { retdata.statuscode = "401"; retdata.status = "Unauthorized"; returnstatus.Add(retdata); result["status"] = returnstatus; //result["message"] = "Failed"; result["menu"] = returndata; } return(JsonConvert.SerializeObject(result)); }
public HttpResponseMessage RejectPayments(string paymentID) { ReturnData rd = new ReturnData(); paymentDetails c = new paymentDetails(); rd = c.RejectPayments(paymentID); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
//protected void Session_Start(object sender, EventArgs e) //{ // Response.Cookies["LoginUser"].Domain = "myUser.com"; //} //protected void Session_End(object sender, EventArgs e) //{ //} protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); ReturnData <string> ret = new ReturnData <string>(); //if (HttpContext.Current.Server.GetLastError() is HttpRequestValidationException) //{ // ret.Status = false; // ret.Message = "您输入的有危险HTML字符!"; // throw new Exception(ret.GetJson()); //} }
public ActionResult Index(ParishEventUI parishEvent) { if (Request.Files.Count > 0 || !string.IsNullOrEmpty(Request.Files[0]?.FileName)) { var directory = System.Web.Hosting.HostingEnvironment.MapPath("~/Images/Events/"); if (Directory.Exists(directory) == false) { Directory.CreateDirectory(directory); } var fileName = $"{DateTime.Now:dd_MM_yyyy_hh_mm_ss}_{parishEvent.Name}_" + Request.Files[0].FileName; var filePath = directory + "_" + fileName; Request.Files[0].SaveAs(filePath); parishEvent.EventImage = filePath; } try { var pevent = new ParishEvent { EventName = parishEvent.Name, EventDescription = parishEvent.Description, Image = parishEvent.EventImage, Active = 1, Deleted = 0, CreateDate = DateTime.Now }; if (_eventRepository.AddEvent(pevent) > 0) { var returnData = new ReturnData { HasValue = true, Message = "Event was successfully created" }; TempData["returnMessage"] = returnData; return(Redirect("Event")); } } catch (Exception e) { var returnData = new ReturnData { HasValue = true, Message = "There was an error creating the event" }; TempData["returnMessage"] = returnData; return(Redirect("Event")); } return(View()); }
public ReturnData Register(string UserName, string Password, string Email, string PhoneNumber, string Logtit, string Latitle) /// get list of notes { int IsAdded = 1; string Message = ""; // check if we have this account already Users myUsers = new Users(); if (myUsers.IsAvailable(UserName, Email) == 0) { // saving into db try { using (SqlConnection connection = new SqlConnection(DBConnection.ConnectionString)) { SqlCommand cmd = new SqlCommand("INSERT INTO Users (UserName, Password, Email,PhoneNumber,Logtit,Latitle) VALUES (@UserName, @Password, @Email,@PhoneNumber,@Logtit,@Latitle)"); cmd.CommandType = CommandType.Text; cmd.Connection = connection; cmd.Parameters.AddWithValue("@UserName", UserName); cmd.Parameters.AddWithValue("@Password", Password); cmd.Parameters.AddWithValue("@Email", Email); cmd.Parameters.AddWithValue("@PhoneNumber", PhoneNumber); cmd.Parameters.AddWithValue("@Logtit", Logtit); cmd.Parameters.AddWithValue("@Latitle", Latitle); connection.Open(); cmd.ExecuteNonQuery(); connection.Close(); } Message = "your account is created succefully"; } catch (Exception ex) { IsAdded = 0; Message = ex.Message;// "Cannot add your inforamtion"; } } else { IsAdded = 0; Message = "User name or email is reserved"; } ReturnData rt = new ReturnData(); rt.Message = Message; rt.UserID = IsAdded; return(rt); }
public ReturnData AJAX_Insert(int?idCustomer, string name, string code, string description, string voucherType, decimal value, int totalAvailable, decimal minimumAmount, string startDate, string endDate, bool active) { try { DataClassesDataContext db = new DataClassesDataContext(); List <TBVoucher> vouchers = db.TBVouchers.Where(x => !x.Deflag).ToList(); CultureInfo us = new CultureInfo("en-US"); DateTime _startDate = DateTime.ParseExact(startDate, "yyyy MM dd HH:mm", us); DateTime _endDate = DateTime.ParseExact(endDate, "yyyy MM dd HH:mm", us); if (vouchers.Where(x => x.Code == code).FirstOrDefault() != null) { return(ReturnData.MessageFailed("Voucher with code '" + code + "' is already exists", null)); } if (_startDate > _endDate) { return(ReturnData.MessageFailed("Start date cannot less than end date", null)); } if (_endDate < DateTime.Now) { return(ReturnData.MessageFailed("Start date cannot past time", null)); } TBVoucher _newVoucher = new TBVoucher { IDCustomer = idCustomer, Name = name.Trim(), Code = code.Trim(), Description = description, VoucherType = voucherType.Trim(), Value = value, TotalAvailable = totalAvailable, Used = 0, MinimumAmount = minimumAmount, StartDate = _startDate, EndDate = _endDate, Deflag = false, Active = active, DateInsert = DateTime.Now, DateLastUpdate = DateTime.Now }; db.TBVouchers.InsertOnSubmit(_newVoucher); db.SubmitChanges(); return(ReturnData.MessageSuccess("Voucher has been successfully inserted", null)); } catch (Exception ex) { Class_Log_Error log = new Class_Log_Error(); log.Insert(ex.Message, ex.StackTrace); return(ReturnData.MessageFailed(ex.Message, null)); } }
public HttpResponseMessage getBookReturnDate() { ReturnData rd = new ReturnData(); string dt = ""; bookIssuingDetails c = new bookIssuingDetails(); dt = c.getBookReturnDate(); string yourJson = JsonConvert.SerializeObject(dt);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public SelectReportOptionsViewModel( Guid organisationId, Guid returnId, List <ReportOnQuestion> reportOnQuestions, ReturnData returnData, int year) { OrganisationId = organisationId; ReturnId = returnId; ReportOnQuestions = reportOnQuestions; ReturnData = returnData; Year = year.ToString(); }
/// <summary> /// 删除管理员 /// </summary> /// <param name="Id"></param> /// <returns></returns> public async Task <ReturnData <bool> > DeleteAsync(string id) { var result = new ReturnData <bool>(); var admin = await _context.Admins.FirstOrDefaultAsync(i => i.Id == id); if (admin != null) { _context.Admins.Remove(admin); } result.Result = await _context.SaveChangesAsync() > 0; return(result); }
public HttpResponseMessage UserRegistration(Users users) { //login(dynamic para_user_id, dynamic para_password) ReturnData rd = new ReturnData(); rd = users.UserRegistration(); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }
public NonObligatedValuesViewModelValidator(ReturnData returnData) { this.returnData = returnData; RuleForEach(o => o.CategoryValues) .Custom((o, context) => { var instance = context.InstanceToValidate as NonObligatedValuesViewModel; if (instance != null && instance.Dcf) { var returnTonnage = returnData.NonObligatedData.Where(r => r.CategoryId == o.CategoryId && r.Dcf == false).Select(r => r.Tonnage).FirstOrDefault(); var value = 0.000m; if (o.Tonnage != null) { decimal.TryParse(o.Tonnage, out value); if (value > returnTonnage) { var categoryFocus = o.CategoryId - 1; context.AddFailure(new ValidationFailure($"CategoryValues[{categoryFocus}].Tonnage", $"Category {o.CategoryId} tonnage must be less than or equal to {returnTonnage}")); } } } else if (instance != null && !instance.Dcf) { var returnTonnage = returnData.NonObligatedData.Where(r => r.CategoryId == o.CategoryId && r.Dcf == true).Select(r => r.Tonnage).FirstOrDefault(); var value = 0.000m; if (o.Tonnage != null) { decimal.TryParse(o.Tonnage, out value); if (value < returnTonnage) { var categoryFocus = o.CategoryId - 1; context.AddFailure(new ValidationFailure($"CategoryValues[{categoryFocus}].Tonnage", $"Category {o.CategoryId} tonnage must be greater than or equal to {returnTonnage}")); } } else if (o.Tonnage == null && returnTonnage != null) { var categoryFocus = o.CategoryId - 1; context.AddFailure(new ValidationFailure($"CategoryValues[{categoryFocus}].Tonnage", $"Category {o.CategoryId} tonnage must be greater than or equal to {returnTonnage}")); } } }); }
public ActionResult CreateBaptism(BaptismViewModel model) { if (!ModelState.IsValid) { return(View(model)); } try { var baptism = new Baptism { BapitsmNumber = model.BaptismNumber, BaptismPlace = model.BaptismPlace, BaptismDate = DateTime.Parse(model.BaptismDate), BaptismName = model.BaptismName, BaptismType = model.BaptismType, Othername = model.Othername, Surname = model.Surname, DateOfBirth = DateTime.Parse(model.DateOfBirth), PlaceOfBirth = model.PlaceOfBirth, HomeTown = model.HomeTown, FathersName = model.FathersName, MothersName = model.MothersName, NameOfGodParent1 = model.NameOfGodParent1, NameOfGodParent2 = model.NameOfGodParent2, NameOfMinister = model.NameOfMinister, Remarks = model.Remarks, Deleted = 0, CreateDate = DateTime.Now }; if (_sacramentRepository.AddBaptism(baptism)) { var returnData = new ReturnData { HasValue = true, Message = "Baptismal record was successfully created" }; TempData["returnMessage"] = returnData; return(Redirect("Baptism")); } ModelState.AddModelError(string.Empty, "There was an error completing the registration, Please check if the bapismal number is correct"); return(View(model)); } catch (Exception e) { //error occured ModelState.AddModelError(string.Empty, "There was an error completing the registration, Please try again later"); ErrorUtil.LogError(e); return(View(model)); } }
public void Map_GivenSource_ReturnDisplayOptionsListShouldBeMapped() { var quarterWindow = QuarterWindowTestHelper.GetDefaultQuarterWindow(); var returnData = new ReturnData() { ReturnStatus = ReturnStatus.Created, QuarterWindow = quarterWindow, SystemDateTime = DateTime.Now }; var result = mapper.Map(returnData); var expectedTuple = (returnData.ReturnStatus, returnData.QuarterWindow, returnData.SystemDateTime); A.CallTo(() => genericMapper.Map <ReturnsListDisplayOptions>(expectedTuple)).MustHaveHappened(Repeated.Exactly.Once); }
public void Map_GivenNoNonObligatedDcfDisplayOptions_ShowDownloadNonObligatedLinkShouldBeFalse() { var returnData = new ReturnData() { Id = mapperTestId, Quarter = mapperTestQuarter, QuarterWindow = mapperTestQuarterWindow, ReturnReportOns = new List <ReturnReportOn>() }; var result = map.Map(returnData); result.ShowDownloadNonObligatedDataLink.Should().BeFalse(); }
//protected void Session_Start(object sender, EventArgs e) //{ // Response.Cookies["LoginUser"].Domain = "myUser.com"; //} //protected void Session_End(object sender, EventArgs e) //{ //} protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); ReturnData<string> ret = new ReturnData<string>(); //if (HttpContext.Current.Server.GetLastError() is HttpRequestValidationException) //{ // ret.Status = false; // ret.Message = "您输入的有危险HTML字符!"; // throw new Exception(ret.GetJson()); //} }
public ActionResult Login(UserPC model, bool isAuto = false) { ReturnData<string> ret = new ReturnData<string>(); //Bll实例化放action里面 为了不让每次都实例化 产生废代码 UserPCBll bll = new UserPCBll(); //只要找得到记住的密码就去匹配记住的密码 if (Request.Cookies["remember"] != null) { if (Request.Cookies["remember"]["uname"] != "" && model.PassWord == "********") { model.Status = 99; model.PassWord = Request.Cookies["remember"]["pwd"]; } } //ReturnData 是值类型 不需要ref来赋值传递 当传入方法里时返回时还是带有值的 var user = bll.Login(ret, model, EnterpriseKey); if (user != null) { //登录成功了 才记住用户名和密码 if (isAuto) { Response.Cookies["remember"]["uname"] = user.UserName; Response.Cookies["remember"]["pwd"] = Convert.ToBase64String(YYYCommon.Encryption.SymmetricEncryption.Encrypt(user.PassWord + "\r" + DateTime.Now.ToString())); Response.Cookies["remember"].Expires = DateTime.Now.AddDays(7); } else { Response.Cookies["remember"]["uname"] = ""; } //保存登录信息 Session["user"] = user; //设置跳转路径 Dictionary<string, object> Identify = new Dictionary<string, object>(); if (EnterpriseKey.ToLower() == "opera") { Identify.Add("url", "/Operate/Areas/Index"); } else { //return RedirectToAction("WellCome"); Identify.Add("url", "/Login/Welcome"); } ret.Identify = Identify; } return Content(ret.GetJson()); }
public ActionResult CreateChannelGroup(ChannelGroup model) { string msg; ReturnData<string> returnData = new ReturnData<string>(); if (!ModelState.IsValid) { msg = "数据验证失败"; return Json(new { Status = false, Message = msg }); } model.EnterpriseID = LoginUser.UserBasic.EnterpriseID; bool success = bll.AddChannelGroup(model, out msg); if (success) { return Json(new { Status = true, Message = msg }); } return Json(new { Status = false, Message = msg }); }
private void QueryData(HttpContext context, bool p) { if (p) { } else { string Mzzybz = context.Request["Mzzybz"];//0 门诊 1住院 string Mzhzyh = context.Request["Mzhzyh"];//住院号或门诊号 BLL.EmpiInfo EmpiInfo = new BLL.EmpiInfo(); bool success; object obj = EmpiInfo.GetDataByCode(Mzhzyh, Mzzybz, out success); ReturnData state = new ReturnData(obj,success); string jsonStrResult = state.Res(); context.Response.Write(jsonStrResult); } }
public ActionResult Edit(Enterprise model) { ReturnData<string> ret = new ReturnData<string>(); Model.Enterprise check = ebll.GetModelById(model.ID); string img = model.EIMG; check.EIMG = img; check.TitleLogo = model.TitleLogo; check.Contact = model.Contact; check.ContactTel = model.ContactTel; check.AreasID = model.AreasID; check.Address = model.Address; ret = ebll.Update(check); if (ret.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
private void QueryData(HttpContext context, bool p) { if (p) { } else { //查询数据 //string Mzzybz = context.Request["Mzzybz"];//0 门诊 1住院 string code = context.Request["code"];//住院号或门诊号 string cxrq00 = context.Request["cxrq00"]; BLL.PatientDiagnose n = new BLL.PatientDiagnose(); bool success; object obj = n.GetData(code, cxrq00,out success); ReturnData resd = new ReturnData(obj,success); string jsonStrResult = resd.Res(); context.Response.Write(jsonStrResult); } }
public ReturnData doJsDAOMode(string xmlpara) { ReturnData rr = new ReturnData(); try { DataTable dt = Js.Com.JsonHelper.Json2Dtb(xmlpara); // Get the constructor and create an instance of MagicClass object[] arr = new object[] { }; System.Reflection.Assembly aa = System.Reflection.Assembly.Load("Js.DAO"); Type magicType = aa.GetType("" + dt.Rows[0]["dll_className"]); object magicClassObject = Activator.CreateInstance(magicType, new object[] {dt.Columns.IndexOf("FormID") != -1 ? "" + dt.Rows[0]["FormID"] :"", dt.Columns.IndexOf("cnKey") != -1 ? "" + dt.Rows[0]["cnKey"]:"" }); System.Reflection.MethodInfo magicMethod = magicType.GetMethod("" + dt.Rows[0]["dll_ModeName"]); System.Reflection.ParameterInfo[] parainfo = magicMethod.GetParameters(); arr = new object[parainfo.Length]; //參數 for (int i = 0; i < parainfo.Length; i++) { if (parainfo[i].ParameterType == typeof(byte)) { arr[i] = byte.Parse("" + dt.Rows[0][parainfo[i].Name]); } else if (parainfo[i].ParameterType == typeof(bool)) { arr[i] = bool.Parse("" + dt.Rows[0][parainfo[i].Name]); } else if (parainfo[i].ParameterType == typeof(DateTime)) { arr[i] = DateTime.Parse("" + dt.Rows[0][parainfo[i].Name]); } else if (parainfo[i].ParameterType == typeof(int)) { arr[i] = int.Parse("" + dt.Rows[0][parainfo[i].Name]); } else if (parainfo[i].ParameterType == typeof(decimal)) { arr[i] = decimal.Parse("" + dt.Rows[0][parainfo[i].Name]); } else arr[i] = "" + dt.Rows[0][parainfo[i].Name]; } if (magicMethod.ReturnType == typeof(void)) { magicMethod.Invoke(magicClassObject, arr); return null; } object magicValue = magicMethod.Invoke(magicClassObject, arr); if (magicValue.GetType() == typeof(DataTable)) { dt = (DataTable)magicValue; rr.data = Js.Com.JsonHelper.Dtb2Json(dt); rr.type = "" + dt.GetType(); } else { rr.data = "" + magicValue; rr.type = "" + magicValue.GetType(); } return rr; } catch (Exception ex) { rr.data = "doJsDAOMode ErrMsg:" + ex.Message; rr.type = "ErrMsg"; return rr; } }
public ReturnData GetCellInfo(string xmlpara) { ReturnData rr = new ReturnData(); try { DataTable dt = Util.JsonHelper.Json2Dtb(xmlpara); string CellCode = dt.Rows[0]["CellCode"].ToString(); BLL.BLLBase bll = new BLL.BLLBase(); DataTable dtCell = bll.FillDataTable("CMD.SelectWareHouseCellInfoByCell", new DataParameter[] { new DataParameter("@CellCode", CellCode) }); string str = Util.JsonHelper.Dtb2Json(dtCell); rr.data = str; rr.type = "" + dtCell.GetType(); } catch (Exception ex) { } return rr; }
public ActionResult Shield(int id) { //返回结果用标准的ReturnData ReturnData<string> returnData = new ReturnData<string>(); //Bll要在这里实例化 不要在action外面 避免生成很多废代码 CommentsBll bll = new CommentsBll(); return Content(bll.UpdateStatus(id, LoginUser.UserBasic.EnterpriseID)); }
public ReturnData strBaseData(string xmlpara) { ReturnData rr = new ReturnData(); DataTable dt = Util.JsonHelper.Json2Dtb(xmlpara); string strWhere = Microsoft.JScript.GlobalObject.unescape(dt.Rows[0]["strWhere"].ToString()); string strFieldName = Microsoft.JScript.GlobalObject.unescape(dt.Rows[0]["strFieldName"].ToString()); string TableName = Microsoft.JScript.GlobalObject.unescape(dt.Rows[0]["TableName"].ToString()); ; if (strFieldName == "") strFieldName = "*"; BLL.BLLBase bll = new BLL.BLLBase(); dt = bll.FillDataTable("Security.SelectFieldValue", new DataParameter[] { new DataParameter("{0}", TableName), new DataParameter("{1}", strFieldName), new DataParameter("{2}", strWhere) }); rr.data = Util.JsonHelper.Dtb2Json(dt); rr.type = "" + dt.GetType(); return rr; }
private static void ProcessGenerated(Snapshot snapshot, GeneratedEvents.Configuration gec, Instance currentInstanceData, ReturnData currentData) { var e = gec.Events.Find(x => x.Name.ToLower() == snapshot.Link.ToLower()); if (e != null) { Return returnValue = e.Process(currentInstanceData); if (snapshot.Value != returnValue.Value) { if (returnValue != null) { var value = e.Values.Find(x => x.Result.NumVal == returnValue.NumVal); if (value != null) { snapshot.PreviousTimestamp = GetTimestampFromCurrent(value, currentData); } } snapshot.PreviousValue = snapshot.Value; snapshot.Value = returnValue.Value; } snapshot.Timestamp = returnValue.TimeStamp; } }
public ActionResult Edit(GoodsGroup model) { ReturnData<string> ret = new ReturnData<string>(); GoodsGroup check = bll.GetModelById(model.ID); check.GroupName = model.GroupName; check.Remarks = model.Remarks; ret = bll.UpdateGoodsGroup(check); if (ret.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
public ActionResult CancelThis(int gid, int cid) { ReturnData<string> ret = new ReturnData<string>(); ret = cbll.DeleteByTwoId(gid, cid); if (ret.Status == true) { return Content("取消关联成功!"); } return Content("取消关联失败!"); }
public ActionResult DeleteList(string ids,string counts) { string[] id = ids.Substring(0, ids.Length - 1).Split(','); string[] count = counts.Substring(0, counts.Length - 1).Split(','); ReturnData<string> ret = new ReturnData<string>(); ReturnData<string> ret1 = new ReturnData<string>(); IList<ChannelJoinGoods> list = new List<ChannelJoinGoods>(); for (int j = 0; j < count.Length; j++) { if (Convert.ToInt32(count[j])!=0) { return Content("分组下存在商品,请先移除商品!"); } } for (int i = 0; i < id.Length; i++) { IList<ChannelJoinGoods> cModel = cbll.GetCGListByGId(Convert.ToInt32(id[i]), LoginUser.UserBasic.EnterpriseID); if (cModel.Count != 0) { return Content("存在关联!不能删除!请先取消关联!"); } GoodsGroup model = bll.GetModelById(Convert.ToInt32(id[i])); ret = bll.DeleteGoodsGroup(model); ret = bll.DeleteById(Convert.ToInt32(id[i])); list = cbll.GetCGListByGId(Convert.ToInt32(id[i]), LoginUser.UserBasic.EnterpriseID); if (list.Count != 0) { ret1 = cbll.DeleteByGId(Convert.ToInt32(id[i])); } } if (ret.Status == true && ret1.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
private static bool ProcessCollected(Snapshot snapshot, ReturnData currentData) { bool result = false; if (currentData.DeviceStreams != null) { var dataItems = currentData.DeviceStreams[0].GetAllDataItems(); bool found = false; // Seach Conditions found = ProcessCollectedCondtion(snapshot, dataItems); // Search Events if (!found) found = ProcessCollectedEvent(snapshot, dataItems); // Search Samples if (!found) found = ProcessCollectedSample(snapshot, dataItems); result = found; } return result; }
void AddDevices(ReturnData returnData) { MTCDeviceList.Clear(); foreach (Device device in returnData.Devices) { RadioButton radio = new RadioButton(); radio.Content = device.Name; radio.GroupName = "MTCDevices"; radio.Margin = new Thickness(0, 5, 0, 5); radio.Checked += radio_Checked; MTCDeviceList.Add(radio); if (MTCDeviceList.Count == 1) radio.IsChecked = true; } }
public ReturnData Run(int num1, int num2, int num3) { Console.WriteLine("recieved data"+num1); Console.WriteLine("recieved data"+num2); Console.WriteLine("recieved data"+num3); for (int i =0; i<6; i+=2) { if (i == 0) { neurons [0 + i].RecieveData (num1); } if (i == 2) { neurons [0 + i].RecieveData (num2); } if (i == 4) { neurons [0 + i].RecieveData (num3); } neurons [1 + i].RecieveData (1); } // Console.WriteLine("Finished is " + neurons[neurons.Count-1].GetOutput()); float [] returns = new float[2]; returns [0] = neurons [neurons.Count - 1].GetOutput (); returns [1] = neurons [neurons.Count - 2].GetOutput (); ReturnData r1 = new ReturnData(0,returns); return r1; }
public ActionResult AddGuan(int gid, string id) { string[] ids = id.Substring(0, id.Length - 1).Split(','); ReturnData<string> ret = new ReturnData<string>(); IList<ChannelJoinGoods> list = cbll.GetCGListByGId(gid, LoginUser.UserBasic.EnterpriseID); ChannelJoinGoods model = new ChannelJoinGoods(); if (list.Count != 0) { cbll.Delete(gid); for (int i = 0; i < ids.Length; i++) { model.AddTime = DateTime.Now; model.ChannelGroupID = Convert.ToInt32(ids[i]); model.GoodsGroupID = gid; ret = cbll.Add(model); } } else { for (int i = 0; i < ids.Length; i++) { model.AddTime = DateTime.Now; model.ChannelGroupID = Convert.ToInt32(ids[i]); model.GoodsGroupID = gid; ret = cbll.Add(model); } } if (ret.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
public ActionResult BasicInfo(long id, string name, string img, int sex) { ReturnData<string> ret = new ReturnData<string>(); ret = ubBll.UpdateBasic(id, name, sex, img); var user = ubBll.GetModel(id); LoginUser.UserBasic.IMG = user.IMG; if (ret.Status == true) { return Content(ret.Message); } return Content(ret.Message); }
public ActionResult FirstLogin(string name, string pwd, string num) { ReturnData<string> ret = new ReturnData<string>(); AgentBll aBll = new AgentBll(); UserBasicBll uBll = new UserBasicBll(); UserPCBll pcBll = new UserPCBll(); Agent aModel = aBll.GetModelByPhone(num); UserBasic uModel = new UserBasic(); UserPC pcModel = new UserPC(); uModel.NickName = name; uModel.UserType = 1; uModel.EnterpriseID = aModel.EnterpriseID; uModel.AddTime = DateTime.Now; long id = uBll.AddAndGetId(uModel); pcModel.UserBasicID = id; pcModel.PassWord = SimpleEncrypt.SaltMD5(pwd.Replace(" ", "")); pcModel.PCType = 2; pcModel.RoleID = aModel.ID; pcModel.Status = 0; pcModel.UserName = name; pcModel.AddTime = DateTime.Now; pcModel.AddUserBasicID = 0; ret = pcBll.AddUserPc(pcModel); if (ret.Status == true) { aModel.Status = 0; aBll.EditAgent(aModel); return Content(ret.Message); } return Content(ret.Message); }
private static DateTime GetTimestampFromCurrent(Value value, ReturnData currentData) { var result = DateTime.MinValue; var dataItems = currentData.DeviceStreams[0].GetAllDataItems(); foreach (var trigger in value.Triggers) { var timestamp = GetTimestampFromTrigger(trigger, dataItems); if (timestamp > result) result = timestamp; } foreach (var multitrigger in value.MultiTriggers) { foreach (var trigger in multitrigger.Triggers) { var timestamp = GetTimestampFromTrigger(trigger, dataItems); if (timestamp > result) result = timestamp; } } return result; }
private void ComPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { string buffer = ComPort.ReadLine(); buffer = buffer.TrimEnd('\r'); switch (buffer) //kijk wat er binnenkomt { case "ERROR": //wanneer "Error" returnData = ReturnData.ERROR; handleError(); break; case "ACK": // ACK betekent acknowledged. returnData = ReturnData.ACK; break; case "RUN": returnData = ReturnData.RUN; break; default: // alle andere waarden. returnData = ReturnData.STATUS; handleBikeValues(buffer); break; } }