public static Boolean CreateCorresPondenceDocument(Correspondence Corress) { Boolean flag = false; using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.Correspondences.AddObject(Corress); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } } } return flag; }
/// <summary> /// Create a new Correspondence object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="issueDate">Initial value of the IssueDate property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static Correspondence CreateCorrespondence(global::System.Int64 id, global::System.DateTime issueDate, global::System.Int32 isDeleted) { Correspondence correspondence = new Correspondence(); correspondence.ID = id; correspondence.IssueDate = issueDate; correspondence.IsDeleted = isDeleted; return correspondence; }
public Boolean AddRecord(Object Correspondenceobj) { Boolean flag = false; CorrespondenceDocumentMaster Document = (CorrespondenceDocumentMaster)Correspondenceobj; try { Correspondence _Corres = new Correspondence(); if (Document.FileName != null) { _Corres.FileName = Document.FileName; } if (Document.DocumentName != null) { _Corres.DocumentName = Document.DocumentName.Trim(); } if (Document.IssueDate != null) { _Corres.IssueDate = Common.DateGB(Document.IssueDate.Trim()); } if (Document.DocumentType != null) { _Corres.DocumentType = Document.DocumentType.Trim(); } if (Document.ClientID != null) { _Corres.ClientID = Convert.ToInt64(Document.ClientID.Trim()); } if (Document.SiteID != null) { _Corres.SiteID = Convert.ToInt64(Document.SiteID.Trim()); } if (Document.PropertyID != null) { _Corres.PropertyID = Convert.ToInt64(Document.PropertyID.Trim()); } if (Document.OwnerID != null) { _Corres.OwnerID = Convert.ToInt64(Document.OwnerID.Trim()); } if (Document.ConsumerID != null) { _Corres.ConsumerID = Convert.ToInt64(Document.ConsumerID.Trim()); } _Corres.CreateBy = Document.CreateBy; _Corres.CreateDate = DateTime.Now; if ((_Corres.ClientID != null) && (_Corres.SiteID != null) && (_Corres.PropertyID != null) && (_Corres.OwnerID != null) && (_Corres.ConsumerID != null) && (_Corres.FileName != null)) { flag = DAL.DALCorrespondence.CreateCorresPondenceDocument(_Corres); } } catch (Exception ex) { throw; } return flag; }
/// <summary> /// Deprecated Method for adding a new object to the Correspondences EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCorrespondences(Correspondence correspondence) { base.AddObject("Correspondences", correspondence); }