Example #1
0
        public bool CreateRecord(Object Communicationobj)
        {
            Boolean flag = false;
            CommunicationMaster commun = (CommunicationMaster)Communicationobj;
            try
            {
                Communication _commun = new Communication();
                if (commun.CommunicationName != null)
                {
                    _commun.CommunicationName = commun.CommunicationName.Trim();
                }
                if (commun.Description != null)
                {
                    _commun.Description = commun.Description.Trim();
                }

                _commun.CreateBy = commun.CreateBy;
                _commun.CreateDate = DateTime.Now;
                if (_commun.CommunicationName != null)
                {
                    flag = DAL.DALCommunication.CreateCommunication(_commun);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return flag;
        }
Example #2
0
 public bool UpdateRecord(Object Communicationobj)
 {
     Boolean flag = false;
     CommunicationMaster commun = (CommunicationMaster)Communicationobj;
     try
     {
         Communication _commun = new Communication();
         _commun.ID = Convert.ToInt32(commun.ID);
         if (commun.CommunicationName != null)
         {
             _commun.CommunicationName = commun.CommunicationName.Trim();
         }
         if (commun.Description != null)
         {
             _commun.Description = commun.Description.Trim();
         }
         _commun.ModifyBy = commun.modifyBy;
         _commun.ModifyDate = DateTime.Now;
         if (_commun.ID != null)
         {
             flag = DAL.DALCommunication.UpdateCommunication(_commun);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     return flag;
 }
Example #3
0
 public Object ViewRecord(Int64 communID)
 {
     Communication vwCommunication = new Communication();
     try
     {
         vwCommunication = DAL.DALCommunication.ViewCommunicationRecord(Convert.ToInt32(communID));
     }
     catch (Exception ex)
     {
         throw;
     }
     return vwCommunication;
 }
Example #4
0
        public static Boolean UpdateCommunication(Communication communication)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.Communications.Where(c => c.ID == communication.ID);
                       foreach (Communication p in Update)
                       {
                           if (communication.CommunicationName != null)
                           {
                               p.CommunicationName = communication.CommunicationName;
                           }
                           if (communication.Description != null)
                           {
                               p.Description = communication.Description;
                           }
                           p.ModifyBy = communication.ModifyBy;
                           p.ModifyBy = communication.ModifyBy;
                       }//
                       context.SaveChanges();
                       context.AcceptAllChanges();
                       scope.Complete();
                       context.Dispose();
                       bol = true;
                   }
                   catch (Exception ex)
                   {
                       context.Dispose();
                       throw;
                   }

               }// using
               return bol;
               } //trans
        }
Example #5
0
 public static Communication ViewCommunicationRecord(Int32 CommunicationID)
 {
     Communication objCommunication = new Communication();
        using (var context = new SycousCon())
        {
        try
        {
            // Int32 CurrenctID = Int32.Parse(currencyID);
            objCommunication = context.Communications.SingleOrDefault(p => p.ID == CommunicationID);
            if (objCommunication != null)
            { return objCommunication; }
            else
            {
                objCommunication = null;
                return objCommunication;
            }
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
 }
Example #6
0
 public static bool IsExistingCommunication(Communication communication)
 {
     using (var context = new SycousCon())
        {
        try
        {
            Communication objcommun = context.Communications.SingleOrDefault(p => p.CommunicationName.ToUpper() == communication.CommunicationName.ToUpper());
            if (objcommun != null)
            { return true; }
            else
            {
                return false;
            }
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
 }
Example #7
0
 public static Communication EditCommunication(Int32 communicationID)
 {
     Communication communication = new Communication();
        using (var context = new SycousCon())
        {
        try
        {
            communication = context.Communications.SingleOrDefault(s => s.ID == communicationID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return communication;
 }
Example #8
0
        public static Boolean CreateCommunication(Communication communication)
        {
            Boolean flag = false;
               if (!(IsExistingCommunication(communication)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.Communications.AddObject(communication);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }
 /// <summary>
 /// Create a new Communication object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static Communication CreateCommunication(global::System.Int32 id, global::System.Int32 isDeleted)
 {
     Communication communication = new Communication();
     communication.ID = id;
     communication.IsDeleted = isDeleted;
     return communication;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Communications EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCommunications(Communication communication)
 {
     base.AddObject("Communications", communication);
 }