public void Init() { try { string setting = File.ReadAllText(path); List <JobInfoCloudHis> list = JsonConvert.DeserializeObject <List <JobInfoCloudHis> >(setting); if (list == null || list.Count <= 0) { return; } foreach (JobInfoCloudHis job in list) { job.createtmp = EncodeHelper.DecodeBase64(job.createtmp); job.targetsql = EncodeHelper.DecodeBase64(job.targetsql); job.targetdbstring = EncodeAndDecode.Decode(job.targetdbstring); job.requestxml = EncodeHelper.DecodeBase64(job.requestxml); job.SettingInterface = this; job.CreatJob(); _Default.Add(job); } } catch (Exception ex) { Log4netUtil.Error("加载定时同步任务配置失败,请检查,原因:" + ex.Message, ex); } }
public void Save() { try { if (Default == null || Default.Count <= 0) { return; } List <JobInfoSyncData> list = Tools.CloneByJson <List <JobInfoSyncData> >(Default); foreach (JobInfoSyncData job in list) { job.createtmp = EncodeHelper.EncodeBase64(job.createtmp); job.targetsql = EncodeHelper.EncodeBase64(job.targetsql); job.sourcesql = EncodeHelper.EncodeBase64(job.sourcesql); job.sourcedbstring = EncodeAndDecode.Encode(job.sourcedbstring); job.targetdbstring = EncodeAndDecode.Encode(job.targetdbstring); job.xmlconfig = EncodeHelper.EncodeBase64(job.xmlconfig); } File.WriteAllText(path, JsonConvert.DeserializeObject(JsonConvert.SerializeObject(list)).ToString()); } catch (Exception ex) { Log4netUtil.Error("定时同步任务配置保存失败,请检查,原因:" + ex.Message, ex); } }
public ActionResult Edit(UserVM viewModel) { var UserProfile = (UserProfileSessionData)this.Session["UserProfile"]; if (UserProfile != null) { tbl_User userItem = new tbl_User() { ID = viewModel.Id, UserName = viewModel.UserName, UserType_EVID = viewModel.UserTypeEvID, AccountLocked = viewModel.LockType, Password = EncodeAndDecode.Base64Encode(viewModel.Password), UpdateUser = UserProfile.UserId, }; CRUDOperation CRUDOperation = new CRUDOperation(); string responseMsj = string.Empty; tbl_User userDB = CRUDOperation.UpdateUser(userItem); if (userDB != null) { TempData["success"] = "Ok"; TempData["message"] = "Məlumatlar uğurla dəyişdirildi"; return(RedirectToAction("Index")); } else { TempData["success"] = "notOk"; TempData["message"] = "Məlumatlar dəyişdirilərkən xəta baş verdi"; return(RedirectToAction("Index")); } } return(RedirectToAction("Index")); }
public ActionResult Edit(UserVM viewModel) { var UserProfile = (UserProfileSessionData)this.Session["UserProfile"]; if (UserProfile != null) { tbl_User userItem = new tbl_User() { ID = viewModel.Id, UserName = viewModel.UserName, EmployeeID = viewModel.EmployeeID, AccountLocked = viewModel.LockType, Password = EncodeAndDecode.Base64Encode(viewModel.Password), UpdateUser = UserProfile.UserId, }; DataOperations dataOperations = new DataOperations(); string responseMsj = string.Empty; bool updated = dataOperations.UpdateUser(userItem, out responseMsj); if (updated) { TempData["success"] = "Ok"; TempData["title"] = "Uğurlu"; TempData["message"] = responseMsj; return(RedirectToAction("Index")); } else { TempData["title"] = "Uğursuz cəhd!"; TempData["success"] = "notOk"; TempData["message"] = responseMsj; } } return(RedirectToAction("Index")); }
public ActionResult Create(UserVM viewModel) { try { var UserProfile = (UserProfileSessionData)this.Session["UserProfile"]; if (UserProfile != null) { if (ModelState.IsValid) { tbl_User userItem = new tbl_User() { UserName = viewModel.UserName, //FirstName = viewModel.FirstName, //LastName = viewModel.LastName, EmployeeID = viewModel.EmployeeID, AccountLocked = viewModel.LockType, Password = EncodeAndDecode.Base64Encode(viewModel.Password), InsertDate = DateTime.Now, InsertUser = UserProfile.UserId }; DataOperations dataOperations = new DataOperations(); string responseMsj = string.Empty; bool saved = dataOperations.AddUser(userItem, out responseMsj); if (saved) { TempData["success"] = "Ok"; TempData["title"] = "Uğurlu"; TempData["message"] = responseMsj; return(RedirectToAction("Index")); } else { TempData["title"] = "Uğursuz cəhd!"; TempData["success"] = "notOk"; TempData["message"] = responseMsj; } } } } catch (ApplicationException ex) { viewModel = poulateDropDownList(viewModel); return(View(viewModel)); } viewModel = poulateDropDownList(viewModel); return(View(viewModel)); }
public ActionResult Create(UserVM viewModel) { try { var UserProfile = (UserProfileSessionData)this.Session["UserProfile"]; if (UserProfile != null) { if (ModelState.IsValid) { tbl_User userItem = new tbl_User() { UserName = viewModel.UserName, //FirstName = viewModel.FirstName, //LastName = viewModel.LastName, UserType_EVID = viewModel.UserTypeEvID, AccountLocked = viewModel.LockType, Password = EncodeAndDecode.Base64Encode(viewModel.Password), InsertDate = DateTime.Now, InsertUser = UserProfile.UserId }; CRUDOperation CRUDOperation = new CRUDOperation(); string responseMsj = string.Empty; tbl_User userDB = CRUDOperation.AddUser(userItem); if (userDB != null) { TempData["success"] = "Ok"; TempData["message"] = "Məlumatlar uğurla əlavə olundu"; return(RedirectToAction("Index")); } else { TempData["success"] = "notOk"; TempData["message"] = "Məlumatlar əlavə olunarkən xəta baş verdi"; return(RedirectToAction("Index")); } } } } catch (ApplicationException ex) { viewModel = poulateDropDownList(viewModel); return(View(viewModel)); } viewModel = poulateDropDownList(viewModel); return(View(viewModel)); }
public ActionResult Login(UserVM uvm) { if (ModelState.IsValid) { string IPAddress = GetIPAddress(); LoginRepository repository = new LoginRepository(); DataOperations dataOperation = new DataOperations(); string result = repository.DoLogin(uvm.UserName, EncodeAndDecode.Base64Encode(uvm.Password), IPAddress); if (result == "Uğurlu") { tbl_User userObj = dataOperation.GetUserByUserName(uvm.UserName); tbl_Employee employeeObj = dataOperation.GetEmployeeById(userObj.EmployeeID == null ? 0 : (Int64)userObj.EmployeeID); UserProfile = new UserProfileSessionData() { UserId = userObj.ID, EmployeeID = employeeObj.ID, UserName = userObj.UserName, FirstName = employeeObj.FirstName, LastName = employeeObj.LastName, }; this.Session["UserProfile"] = UserProfile; UrlSessionData CurrentUrl = new UrlSessionData { Controller = "Home", Action = "Index" }; this.Session["CurrentUrl"] = CurrentUrl; return(RedirectToAction("Index", "Home")); } else if (result == "İstifadəçi adı tapılmadı") { ViewBag.NotValidUser = result; } else { ViewBag.Failedcount = result; } return(View("Index")); } else { return(View("Index", uvm)); } }