public ActionResult Patch([FromBody] EditInfo info) { if (info.CarRequest) { List <int> carIds = new List <int>(); CarIds.updateCarIds(carIds); return(Json(carIds)); } var empty = new List <Person>(); if (Edit.editPerson(info) == false) { return(Json(empty)); } if (lastFilter != null && Filter.filterPersons(lastFilter) == false) { return(Json(empty)); } else if (Select.updatePersons(selectStr) == false) { return(Json(empty)); } return(Json(persons)); }
public void OnKeyDown(int keyCode, int shift) { if (keyCode == 0x1b) { this.ClearUp(); } if ((keyCode == 8) || ((shift == 2) && (keyCode == 90))) { int count = this._editInfoList.Count; if (count == 0) { this.ClearUp(); } else { EditInfo info = this._editInfoList[count - 1] as EditInfo; int vertexIndex = info.VertexIndex; IPoint oldPoint = info.OldPoint; (Editor.UniqueInstance.LinageShape as IPointCollection).UpdatePoint(vertexIndex, oldPoint); this._editInfoList.RemoveAt(count - 1); this._feedBack.Start((Editor.UniqueInstance.LinageShape as IGeometryCollection).get_Geometry(0) as IPath, vertexIndex, false); this._feedBack.Refresh(this._viewMap.ScreenDisplay.hDC); this._viewMap.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } } }
static void createFolder(string folder, string actFolder) { EditInfo ed = conn.Ix.createSord(actFolder, "", EditInfoC.mbSord); ed.sord.name = folder; ed.sord.id = conn.Ix.checkinSord(ed.sord, SordC.mbAll, LockC.NO); }
public void init(IXConnection ix, EditInfo ed) { this.ix = ix; this.ed = ed; this.CONST = ix.CONST; for (int i = 0; i < ed.sordTypes.Length; i++) { bool hasValidIcon = false; if (ed.sordTypes[i].icon != null) { try { System.IO.Stream strm = new System.IO.MemoryStream(ed.sordTypes[i].icon.data); System.Drawing.Image img = Image.FromStream(strm); imageListSordTypes.Images.Add(img); hasValidIcon = true; } catch (Exception) { } } if (!hasValidIcon) { System.Drawing.Image img = Image.FromFile("..\\..\\App.ico"); imageListSordTypes.Images.Add(img); } cbSordType.Items.Add(ed.sordTypes[i].name); } }
public IActionResult EditInfo(EditInfo model, int UserId) { if (ModelState.IsValid) { User EmailCheck = _userDashboardContext.User.SingleOrDefault(User => User.Email == model.Email); User ActiveUser = _userDashboardContext.User.SingleOrDefault(User => User.UserId == HttpContext.Session.GetInt32("ActiveUserId")); if (EmailCheck == null || model.Email == ActiveUser.Email) { User editUser = _userDashboardContext.User .Where(u => u.UserId == UserId) .SingleOrDefault(); { editUser.FirstName = model.FirstName; editUser.LastName = model.LastName; editUser.Email = model.Email; editUser.UpdatedAt = DateTime.Now; }; _userDashboardContext.Update(editUser); _userDashboardContext.SaveChanges(); return(RedirectToAction("Show", new { ProfileId = UserId })); } else { ViewBag.RegisterMessages = "Email Taken!"; } } User showEditUser = _userDashboardContext.User .Where(u => u.UserId == UserId) .SingleOrDefault(); ViewBag.showEditUser = showEditUser; return(View("Edit")); }
/// <summary> /// This function shows how to checkout a document using encryption functionality of /// It does not set the ix.Ix.cryptDocuments session option. It assigns "&crypt=true" /// to the URL to direct IndexServer to decrypt the document. /// Using this method does not require an extra call to DM. But the file size and file extension /// in the DocVersion object comes from the encrypted document (ETF-file) rather the /// original document. /// </summary> /// <param name="ix"></param> /// <param name="CONST"></param> /// <param name="ci"></param> /// <param name="objId"></param> private void checkoutDocDecryptedUsingUrlExt(IXConnection ix, IXServicePortC CONST, string objId) { // Tell IndexServer not to encrypt/decrypt. setSessionOptionEncrypt(ix, false); // Provide external password of encryption set. string encrPwd = ix.EncryptPassword(encryptionPassword); ix.Ix.provideCryptPassword("" + encryptionSet, encrPwd); EditInfo ed = ix.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO); Logger.instance().log("encrypted.ext=" + ed.document.docs[0].ext); Logger.instance().log("encrypted.size=" + ed.document.docs[0].size); String tempName2 = internalMakeTempFileName(".tmp"); // append the special parameter to the URL String urlDecr = ed.document.docs[0].url + "&crypt=true"; Logger.instance().log("prepared download URL=" + urlDecr); // ------------------------------------------------------------------------------- // The URL to download the document should be a HTTPS URL in production environments! // IndexServer configuration option "ixUrlBase" might be helpful here. // ------------------------------------------------------------------------------- ix.Download(urlDecr, tempName2); // Show document in notepad: System.Diagnostics.Process.Start("notepad.exe", tempName2); System.Threading.Thread.Sleep(3000); System.IO.File.Delete(tempName2); }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // Create a root folder based on keywording form "Email". // Parent is the "imaginary" archive entry with object ID = 1. String parentId = "1"; String maskId = "email"; EditInfo ed = ix.Ix.createSord(parentId, maskId, EditInfoC.mbAll); ed.sord.name = "New Sord"; ViewAndEditSordDlg dlg = new ViewAndEditSordDlg(); dlg.init(ix, ed); dlg.ShowDialog(null); // CHECKIN int objId = ix.Ix.checkinSord(dlg.getSord(), SordC.mbAll, LockC.NO); Logger.instance().log("Created sord successfully, objId=" + objId); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public static bool CreateEI(EditInfo e) { if (InformationBUS.CreateEI(e) == true) { return(true); } return(false); }
public static bool CreateEI(EditInfo e) { if (EditInfoDAO.CreateEI(e) == true) { return(true); } return(false); }
/// <summary> /// This function shows how to checkin a document using encryption functionality of /// </summary> /// <param name="ix"></param> /// <param name="CONST"></param> /// <param name="ci"></param> /// <returns></returns> private string checkinDocEncrypted(IXConnection ix, IXServicePortC CONST) { // Tell IndexServer to encrypt/decrypt. setSessionOptionEncrypt(ix, true); // Provide external password of encryption set. // This password must be encrpyted for security reasons. // Administrators should not know it! string encrPwd = ix.EncryptPassword(encryptionPassword); ix.Ix.provideCryptPassword("" + encryptionSet, encrPwd); // Create document EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDoc); ed.sord.name = "C# example CheckinOutDocEncrypted"; ed.sord.details.encryptionSet = encryptionSet; // Create file for document version String testFile = internalCreateTestFile("CheckinDocEncrypted example file", "txt"); // Supply the extension of the document ed.document.docs = new DocVersion[1]; ed.document.docs[0] = new DocVersion(); ed.document.docs[0].ext = ix.GetFileExt(testFile); ed.document.docs[0].pathId = ed.sord.path; ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet; // CheckinDocBegin: let IndexServer generate an URL to upload the document // This URL addresses always the IndexServer and not the Document Manager. ed.document = ix.Ix.checkinDocBegin(ed.document); // ------------------------------------------------------------------------------- // The URL to upload the document should be a HTTPS URL in production environments! // IndexServer configuration option "ixUrlBase" might be helpful here. // ------------------------------------------------------------------------------- Logger.instance().log("prepared upload URL=" + ed.document.docs[0].url + ", doc-guid=" + ed.document.docs[0].guid); // Upload document version. // IndexServer encrypts the document. ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, testFile); Logger.instance().log("upload document version succeeded"); // CheckinDocEnd: uploadResult contains the document information from ELODM. // Pass this information to ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO); Logger.instance().log("inserted document:"); Logger.instance().log(" objId=" + ed.document.objId); Logger.instance().log(" docId=" + ed.document.docs[0].id); Logger.instance().log(" doc-guid=" + ed.document.docs[0].guid); Logger.instance().log(" URL=" + ed.document.docs[0].url); System.IO.File.Delete(testFile); return(ed.document.objId); }
/// <summary> /// Read the working version of the document and attachment. /// </summary> protected virtual void readWorkVersion() { if (haveReadWorkVersion) { return; } haveReadWorkVersion = true; // Existing object? if (sordVal.id >= 0) { // read versions long editC = EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers; EditInfoZ editZ = new EditInfoZ(editC, new SordZ(0)); EditInfo ed = Conn.Ix.checkoutDoc(sordVal.guid, null, editZ, LockC.NO); // object has versions and/or attachments if (ed.document != null) { // The current working versions might have been set by // a previsious call to Version.File=c:/hello.txt. // Thus do not overwrite the current working versions. FWDocVersion wver = docs.WorkVersion; FWDocVersion watt = atts.WorkVersion; if (ed.document.docs != null && ed.document.docs.Length != 0) { DocVersion dv = ed.document.docs[0]; if (wver == null) { // ANPASSUNG if (dv.workVersion) // <-- Diese Zeile wurde eingefügt { wver = docs.InternalAdd(dv); } } else if (wver.Signature == null) { wver.Signature = ClassFactory.NewDocVersion(dv.sig, this, FWDocVersionType.TYPE_SIGNATURE); } } if (watt == null) { if (ed.document.atts != null && ed.document.atts.Length != 0) { DocVersion dv = ed.document.atts[0]; watt = atts.InternalAdd(dv); } } } } }
public static SortedDictionary <string, bool> GetRules(IXConnection ixConn, List <string> jsTexts, string package) { String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/ELOas Base/Direct"; if (package.Equals("")) { parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/ELOas Base/Direct"; } List <Sord> sordRuleInfo = RepoUtils.FindChildren(parentId, ixConn, true); SortedDictionary <string, bool> dicRules = new SortedDictionary <string, bool>(); foreach (Sord s in sordRuleInfo) { string objId = s.id + ""; EditInfo editInfo = ixConn.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO); if (editInfo.document.docs.Length > 0) { DocVersion dv = editInfo.document.docs[0]; string url = dv.url; Stream inputStream = ixConn.Download(url, 0, -1); string xmlText = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd(); try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlText); string rulesetname = ""; foreach (XmlNode nameNode in doc.SelectNodes("ruleset/base/name")) { foreach (XmlNode subNode in nameNode.ChildNodes) { switch (subNode.Name) { case "#text": rulesetname = subNode.InnerText; break; } } } if (!dicRules.ContainsKey(rulesetname)) { bool match = Unittests.Match(ixConn, rulesetname, package, jsTexts); dicRules.Add(rulesetname, match); } } catch (XmlException e) { Debug.WriteLine("Exception: {0}", e.Message); } } } ; return(dicRules); }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // Create a document EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc); ed.sord.name = "document with sticky notes"; ed.document = new Document(); ed.document.docs = new DocVersion[1] { new DocVersion() }; ed.document.docs[0].ext = "tif"; ed.document.docs[0].pathId = ed.sord.path; ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet; ed.document = ix.Ix.checkinDocBegin(ed.document); ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF"); ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO); Note[] notes = new Note[3]; // Create a normal sticky note notes[0] = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_NORMAL, null); notes[0].desc = "This is a normal sticky note"; // Create a personal note notes[1] = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_PERSONAL, null); notes[1].desc = "This is a personal note"; // Create a stamp note notes[2] = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_STAMP, null); notes[2].desc = "This is a stamp note"; int[] noteIds = ix.Ix.checkinNotes(null, notes, NoteC.mbAll, LockC.NO); Logger.instance().log("noteIds=" + noteIds); } finally { ix.Logout(); } }
public static void Select() { if (AppData.MainWindow.FrameEditView.Content is EditViewPage page) { EditInfo info = new EditInfo() { Folder = AppData.EditBranchFolder }; page.Select(info); } }
public static bool CreateEI(EditInfo e) { DBWikiEntities we = new DBWikiEntities(); we.EditInfoes.Add(e); if (we.SaveChanges() > 0) { return(true); } return(false); }
public bool CreateEI(EditInfoContract newEdit) { EditInfo e = new EditInfo { contentEdit = newEdit.contentEdit, idInfo = newEdit.idInfo, idUser = newEdit.idUser, newEI = newEdit.newEI }; if (Repositories.CreateEI(e) == true) { return(true); } return(false); }
public override void InitPage() { using (DbManager mgr = new DbManager()) { foreach (Library l in mgr.Query <Library>("SELECT * FROM library WHERE userid = '" + CurrentUser.UserID + "'")) { existing.Items.Add(new ListItem(l.Name, l.ID.ToString())); } } HttpCookie c = Request.Cookies["edits"]; if (c != null) { List <string> list = c.Value.Split(',').ToList(); if (list.Count == 0) { warning.Text += "Your current library is empty."; saveButton.Visible = false; } foreach (string s in list.ToList()) { EditInfo e = new EditInfo(); if (!e.Load(s.ToInt(), CurrentUser)) { list.Remove(s); warning.Text += "Invalid edit id " + s + "<br />"; warning.Visible = true; list.Remove(s); } if (!e.Public) { list.Remove(s); warning.Text += e.Name + " is not public, cannot add to pack. <br />"; warning.Visible = true; list.Remove(s); } if (e.UserID != CurrentUser.UserID) { warning.Visible = true; warning.Text += e.Name + " is not your edit, cannot add to pack. <br />"; list.Remove(s); } } c.Value = list.ToDelimitedString(","); Context.Response.Cookies.Add(c); } }
/// <summary> /// Read all versions. /// </summary> /// <returns></returns> protected virtual void readAllVersions() { if (haveReadAll) { return; } haveReadAll = true; if (sordVal.id < 0) { return; } FWDocVersion wdoc = Version; FWDocVersion watt = Attachment; EditInfoZ editZ = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbAttachmentMembers, new SordZ(0)); EditInfo ed = Conn.Ix.checkoutDoc(sordVal.guid, "-1", editZ, LockC.NO); if (ed.document.docs != null) { foreach (DocVersion dv in ed.document.docs) { if (wdoc != null) { if (wdoc.Id == dv.id) { continue; } dv.workVersion = false; } docs.InternalAdd(dv); } } else if (ed.document.atts != null) { foreach (DocVersion dv in ed.document.atts) { FWDocVersion xdv = ClassFactory.NewDocVersion(dv, this, FWDocVersionType.TYPE_ATTACHMENT); if (watt != null) { if (watt.Id == dv.id) { continue; } dv.workVersion = false; } atts.InternalAdd(dv); } } }
public ActionResult EditInfo(EditInfo model) { if (ModelState.IsValid) { string connection = ConfigurationManager.AppSettings["InternalAPIURL"]; var ctx = Request.GetOwinContext(); ClaimsIdentity identity = new ClaimsIdentity(Request.GetOwinContext().Authentication.User.Identity); string accessToken = identity.FindFirst("AccessToken").Value; Guid userID = new Guid(identity.FindFirst(ClaimTypes.NameIdentifier).Value); string currentUserName = identity.FindFirst(ClaimTypes.Name).Value; EditUserRequest request = new EditUserRequest(connection, accessToken, userID); request.FirstName = model.FirstName; request.LastName = model.LastName; request.Nicknane = model.Nicknane; EditUserResponse response = request.Send(); if (response.StatusCode == System.Net.HttpStatusCode.OK) { //TODO: If Nickname is changed, change it in the user claim if (request.Nicknane != currentUserName) { identity.RemoveClaim(identity.FindFirst(ClaimTypes.Name)); identity.AddClaim(new Claim(ClaimTypes.Name, request.Nicknane)); var authenticationManager = HttpContext.GetOwinContext().Authentication; authenticationManager.SignOut(); AuthenticationProperties properties = new AuthenticationProperties { IsPersistent = Convert.ToBoolean(identity.FindFirst(ClaimTypes.IsPersistent).Value) }; authenticationManager.SignIn(properties, identity); ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(identity); HttpContext.User = claimsPrincipal; } TempData["Success"] = "You have successfully updated your info"; return(RedirectToAction("Index", "Account")); } else { TempData["Errors"] = "There was an error processing your request. Please try again."; return(View(model)); } } else { return(View(model)); } }
/// <summary> /// 保存css /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SaveButton_Click(object sender, EventArgs e) { try { string type = RequestHelper.Get <string>("type"); string modelName = RequestHelper.Get <string>("model"); modelInfo = ModelHelper.GetModelInfo(modelName); if (modelInfo != null && modelInfo.Layout != null && modelInfo.Layout.Panels.Count > 0) { UxStyleCssFile = String.Format("{0}/{1}/{2}/{3}", ModelConfig.ModelsDirectory.Replace("~/", "/"), modelInfo.GroupName, modelInfo.Name, "GenerateLayout." + type + ".css"); if (!string.IsNullOrEmpty(editorValue.Value)) { string msg = FileHelper.WriteFileWithEncoding(Server.MapPath(UxStyleCssFile), editorValue.Value, FileMode.Append, new UTF8Encoding(true)); EditInfo info = modelInfo.Layout.Panels["edit"].EditInfo; if (info != null) { if (string.IsNullOrEmpty(msg)) { switch (type) { case "EditCss": info.EditCss = UxStyleCssFile; break; case "ViewerCss": info.ViewerCss = UxStyleCssFile; break; case "UcCss": info.UcCss = UxStyleCssFile; break; } modelInfo.Layout.Panels["edit"].EditInfo = info; ModelHelper.SaveModelInfo(modelInfo, modelInfo.ModelName); strScript = "window.parent.CloseChild('已保存!');"; } } msgLabel.Text = msg; } } } catch (Exception ex) { strScript = "window.parent.CloseChild('添加失败,错误消息:" + ex.Message + "!');"; } }
// handles Edit person request public static bool editPerson(EditInfo info) { // query to execute edition, transaction handled StringBuilder query = new StringBuilder("BEGIN TRANSACTION BEGIN TRY UPDATE OSOBY SET "); // setting query fields using info instance // making name and surname parametrized to prevent sql injection query.Append(string.Format("imie=@name, ", info.Name)); query.Append(string.Format("nazwisko=@surname, ", info.Surname)); if (info.Date.Length > 0) { var date = Convert.ToDateTime(info.Date).Date; query.Append(string.Format("data_prod='{0}-{1}-{2}', ", date.Year, date.Month, date.Day)); } else { query.Append(string.Format("data_prod=NULL, ")); } query.Append(string.Format("samochod_id={0} ", info.CarId)); // which record should be updated is chosen based on osoba_id query.Append(string.Format("WHERE osoba_id={0}", info.PersonId)); query.Append(" END TRY BEGIN CATCH ROLLBACK TRANSACTION THROW END CATCH COMMIT TRANSACTION"); bool res = false; try { using (var conn = new SqlConnection(HomeController.connString)) { res = true; conn.Open(); var cmd = new SqlCommand(query.ToString(), conn); // setting query parameters cmd.Parameters.Add("@name", System.Data.SqlDbType.VarChar).Value = info.Name; cmd.Parameters.Add("@surname", System.Data.SqlDbType.VarChar).Value = info.Surname; if (cmd.ExecuteNonQuery() < 1) { res = false; } ; } } catch (Exception ex) { Console.WriteLine(ex.Message); res = false; } return(res); }
public void SaveEdit() { try { Editor.UniqueInstance.StartEditOperation(); object before = new object(); object missing = Type.Missing; foreach (LinkArgs args in this._las) { if (args.PartIndex >= 0) { IFeature feature = args.feature; IGeometryCollection shapeCopy = feature.ShapeCopy as IGeometryCollection; IPointCollection points = shapeCopy.get_Geometry(args.PartIndex) as IPointCollection; for (int i = 0; i < this._editInfoList.Count; i++) { EditInfo info = this._editInfoList[i] as EditInfo; int index = args.VertexIndex[i]; IPoint p = (info.NewPoint as IClone).Clone() as IPoint; if (p.SpatialReference != (EditTask.EditLayer.FeatureClass as IGeoDataset).SpatialReference) { p.Project((EditTask.EditLayer.FeatureClass as IGeoDataset).SpatialReference); p.SpatialReference = (EditTask.EditLayer.FeatureClass as IGeoDataset).SpatialReference; } if (index == 0) { points.UpdatePoint(0, p); } else { points.ReplacePoints(index, 1, 1, ref p); } } shapeCopy.RemoveGeometries(args.PartIndex, 1); before = args.PartIndex; shapeCopy.AddGeometry(points as IGeometry, ref before, ref missing); IGeometry geometry = (IGeometry)shapeCopy; feature.Shape = geometry; feature.Store(); } } Editor.UniqueInstance.StopEditOperation("Linkage Edit"); } catch (Exception exception) { Editor.UniqueInstance.AbortEditOperation(); this._mErrOpt.ErrorOperate(this._mSubSysName, "ShapeEdit.LinkageEdit", "SaveEdit", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", ""); } }
public ActionResult EditInfo(EditInfo editInfo) { if (ModelState.IsValid) { var UserID = User.Identity.GetUserId(); var user = db.Users.Find(UserID); user.BloodType = editInfo.BloodType; user.Gender = editInfo.Gender; user.Weight = editInfo.Weight; user.Height = editInfo.Height; db.SaveChanges(); return(RedirectToAction("ProfileInformation", "Account")); } return(View(editInfo)); }
private void lbMasks_SelectedIndexChanged(object sender, System.EventArgs e) { if (lockChangeMaskIndex) { return; } saveIndexingInfo(); String maskName = lbMasks.Items[lbMasks.SelectedIndex].ToString(); ed = ix.Ix.changeSordMask(ed.sord, maskName, EditInfoC.mbAll); loadIndexingInfo(); }
// adds new person based on information saved in info instance public static bool addPerson(EditInfo info) { // query holds insert command in transaction StringBuilder query = new StringBuilder("BEGIN TRANSACTION BEGIN TRY "); if (info.Date.Length > 0) { var date = Convert.ToDateTime(info.Date).Date; query.Append("INSERT INTO OSOBY (imie, nazwisko, samochod_id, data_prod) "); query.Append(string.Format("VALUES(@name, @surname, {0}, '{1}-{2}-{3}')", info.CarId, date.Year, date.Month, date.Day)); } else { query.Append("INSERT INTO OSOBY (imie, nazwisko, samochod_id) "); // name and surname are parametrized to prevent sql injection query.Append(string.Format("VALUES(@name, @surname, {0})", info.CarId)); } query.Append(" END TRY BEGIN CATCH ROLLBACK TRANSACTION THROW END CATCH COMMIT TRANSACTION"); bool res = false; try { using (var conn = new SqlConnection(HomeController.connString)) { res = true; conn.Open(); var cmd = new SqlCommand(query.ToString(), conn); // setting parameters to adequate values cmd.Parameters.Add("@name", System.Data.SqlDbType.VarChar).Value = info.Name; cmd.Parameters.Add("@surname", System.Data.SqlDbType.VarChar).Value = info.Surname; if (cmd.ExecuteNonQuery() < 1) { res = false; } ; } } catch (Exception ex) { Console.WriteLine(ex.Message); // if any error occured, res set to false and returned later res = false; } return(res); }
private Sord readSord(IXConnection conn, int objId, SordZ sordZ) { Sord ret = null; try { EditInfoZ editZ = new EditInfoZ(0, sordZ); EditInfo ed = conn.Ix.checkoutSord(Convert.ToString(objId), editZ, LockC.IF_FREE); ret = ed.sord; } catch (Exception e) { throw new IOException("Cannot read sord, sord.id=" + objId, e); } return(ret); }
public ActionResult EditInfo() { EditInfo editInfo = new EditInfo(); var UserID = User.Identity.GetUserId(); var user = db.Users.Find(UserID); if (user.Height != 0) { editInfo.BloodType = user.BloodType; editInfo.Gender = user.Gender; editInfo.Weight = user.Weight; editInfo.Height = user.Height; return(View(editInfo)); } return(View()); }
public static SortedDictionary <string, bool> GetRFs(IXConnection ixConn, List <string> jsTexts, string package) { String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/IndexServer Scripting Base"; if (package.Equals("")) { parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/IndexServer Scripting Base/_ALL/business_solutions"; } List <Sord> sordRFInfo = RepoUtils.FindChildren(parentId, ixConn, true); SortedDictionary <string, bool> dicRFs = new SortedDictionary <string, bool>(); foreach (Sord s in sordRFInfo) { string objId = s.id + ""; EditInfo editInfo = ixConn.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO); if (editInfo.document.docs.Length > 0) { DocVersion dv = editInfo.document.docs[0]; string url = dv.url; Stream inputStream = ixConn.Download(url, 0, -1); string jsText = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd(); string[] jsLines = jsText.Split('\n'); foreach (string line in jsLines) { if (line.Contains("function RF_")) { string[] rf = line.Split(); string rfName = rf[1]; string[] rfNames = rfName.Split('('); rfName = rfNames[0]; if (!rfName.Equals("*")) { if (!dicRFs.ContainsKey(rfName)) { bool match = Unittests.Match(ixConn, rfName, package, jsTexts); dicRFs.Add(rfName, match); } } } } } } ; return(dicRFs); }
public ActionResult Put([FromBody] EditInfo info) { var empty = new List <Person>(); if (Add.addPerson(info) == false) { return(Json(empty)); } if (lastFilter != null && Filter.filterPersons(lastFilter) == false) { return(Json(empty)); } else if (Select.updatePersons(selectStr) == false) { return(Json(empty)); } return(Json(persons)); }
void Select(EditInfo info) { foreach (var item in StackPanel1.Children) { if (item is EditItemView view) { if (view.EditInfo == info) { view.BorderThickness = new Thickness(2); view.BorderBrush = Brushes.Orange; } else { view.BorderThickness = new Thickness(0); } } } }