Boolean IMapping.CreateMapping(Object Mappingobj) { Boolean flag = false; UserInClientClass mapping = (UserInClientClass)Mappingobj; try { UserInClient _mapping = new UserInClient(); if (mapping.ClientID != null) { _mapping.ClientID = Convert.ToInt64(mapping.ClientID); } if (mapping.UserID != null) { _mapping.UserID = Convert.ToInt64(mapping.UserID); } if (mapping.AssignDate != null) { _mapping.AssignDate = Common.DateGB(mapping.AssignDate); } if (mapping.ReleaseDate != null) { _mapping.ReleaseDate = Common.DateGB(mapping.ReleaseDate); } _mapping.TransDate = DateTime.Now; _mapping.CreateBy = mapping.CreateBy; _mapping.CreateDate = DateTime.Now; if ((_mapping.ClientID != null) && (_mapping.UserID != null)) { flag = DAL.DALClient.CreateUserInClient(_mapping); } } catch (Exception ex) { throw; } return flag; }
Boolean IMapping.UpdateMapping(Object Mappingobj) { Boolean flag = false; UserInClientClass mapping = (UserInClientClass)Mappingobj; try { UserInClient _mapping = new UserInClient(); if (mapping.MapID != null) { _mapping.ID = Convert.ToInt64(mapping.MapID); } if (mapping.ReleaseDate != null) { _mapping.ReleaseDate = Common.DateGB(mapping.ReleaseDate); } _mapping.IsDeleted = 2; _mapping.ModifyBy = mapping.modifyBy; _mapping.ModifyDate = DateTime.Now; if ((_mapping.ID != null)) { flag = DAL.DALClient.UpdateUserInClient(_mapping); } } catch (Exception ex) { throw; } return flag; }
public static Boolean UpdateUserInClient(UserInClient client) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.UserInClients.Where(c => c.ID == client.ID); foreach (UserInClient p in Update) { if (client.ReleaseDate != null) { p.ReleaseDate = client.ReleaseDate; } if (client.IsDeleted != null) { p.IsDeleted = client.IsDeleted; } p.ModifyDate = DateTime.Now; p.ModifyBy = client.ModifyBy; }// context.SaveChanges(); context.AcceptAllChanges(); scope.Complete(); context.Dispose(); bol = true; } catch (Exception ex) { context.Dispose(); throw; } }// using return bol; } //trans }
public static bool IsExistingUserInClient(UserInClient client) { using (var context = new SycousCon()) { try { UserInClient objclient = context.UserInClients.SingleOrDefault(p => p.ClientID == client.ID && p.UserID == client.UserID && p.IsDeleted == 0); if (objclient != null) { return false; } else { return true; } } catch (Exception ex) { context.Dispose(); throw; } } }
public static Boolean CreateUserInClient(UserInClient client) { Boolean flag = false; if ((IsExistingUserInClient(client))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.UserInClients.AddObject(client); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } } } } return flag; }
/// <summary> /// Create a new UserInClient object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static UserInClient CreateUserInClient(global::System.Int64 id, global::System.Int32 isDeleted) { UserInClient userInClient = new UserInClient(); userInClient.ID = id; userInClient.IsDeleted = isDeleted; return userInClient; }
/// <summary> /// Deprecated Method for adding a new object to the UserInClients EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserInClients(UserInClient userInClient) { base.AddObject("UserInClients", userInClient); }