public String AddRecord(Object _clientobj) { String Id = String.Empty; Client client = (Client)_clientobj; try { ClientMaster _client = new ClientMaster(); if (client.Name != null) { _client.Name = client.Name; } if (client.Address != null) { _client.Address = Common.RemoveSpecialCharacters(client.Address); } if (client.Address2 != null) { _client.Address2 = Common.RemoveSpecialCharacters(client.Address2); } if (client.city != null) { _client.City = client.city; } if (client.Zipcode != null) { _client.ZipCode = client.Zipcode; } if (client.County != null) { _client.County = client.County; } if (client.CompNumber != null) { _client.CompNumber = client.CompNumber; } if (client.Vat != null) { _client.Vat = client.Vat; } if (client.Notification != null) { _client.NotificationID = client.Notification; } if (client.Currency != null) { _client.Currency = client.Currency; } if (client.BankName != null) { _client.BankName = client.BankName; } if (client.ClientCode != null) { _client.ClientCode = client.ClientCode; } if (client.AccountNo != null) { _client.AccountNo = client.AccountNo; } if (client.StDate != null) { _client.STDate = Common.DateGB(client.StDate); } if (client.EndDate != null) { _client.EndDate = Common.DateGB(client.EndDate); } if (client.ContactName != null) { _client.ContactName = client.ContactName.ToUpper(); } if (client.ContractType != null) { _client.ContractType = client.ContractType; } if (client.DeptID != null) { _client.DepID = client.DeptID; } if (client.DeptID != null) { _client.DepID = client.DeptID; } if (client.CORRAddress != null) { _client.CORRAddress = client.CORRAddress; } if (client.TelNo != null) { _client.Tel = client.TelNo; } if (client.Mobile != null) { _client.Mobile = client.Mobile; } if (client.Email != null) { _client.Email = client.Email; } Int32 Ref = DAL.DALClient.ClientMAXReferenceNumer(); if (Ref == 0) { _client.RefNo = "SYC-1"; } else { _client.RefNo = "SYC-" + (Ref + 1).ToString(); } if (client.NotifyTime != null) { _client.NotificationTime = Common.TimeGB(client.NotifyTime); } if (client.Logo != null) { _client.Logo = client.Logo; } if (client.FirstName != null) { _client.FirstName = client.FirstName; } if (client.LastName != null) { _client.LastName = client.LastName; } _client.Createby = client.CreateBy; _client.CreateDate = DateTime.Now; if (_client.RefNo != null) { Id = DAL.DALClient.ADDCLIENT(_client); } } catch (Exception ex) { throw; } return Id; }
public bool UpdateRecord(Object clientobj) { Boolean flag = false; Client client = (Client)clientobj; try { ClientMaster _client = new ClientMaster(); _client.ClientID = Convert.ToInt64(client.ClientID); if (client.Name != null) { _client.Name = client.Name.Trim(); } if (client.Address != null) { _client.Address = Common.RemoveSpecialCharacters(client.Address); } if (client.Address2 != null) { _client.Address2 = Common.RemoveSpecialCharacters(client.Address2); } if (client.city != null) { _client.City = client.city; } if (client.Zipcode != null) { _client.ZipCode = client.Zipcode; } if (client.County != null) { _client.County = client.County; } if (client.CompNumber != null) { _client.CompNumber = client.CompNumber; } if (client.Vat != null) { _client.Vat = client.Vat; } if (client.Notification != null) { _client.NotificationID = client.Notification; } if (client.Currency != null) { _client.Currency = client.Currency; } if (client.BankName != null) { _client.BankName = client.BankName; } if (client.ClientCode != null) { _client.ClientCode = client.ClientCode; } if (client.AccountNo != null) { _client.AccountNo = client.AccountNo; } if (client.StDate != null) { _client.STDate = Common.DateGB(client.StDate); } if (client.EndDate != null) { _client.EndDate = Common.DateGB(client.EndDate); } if (client.ContactName != null) { _client.ContactName = client.ContactName; } if (client.ContractType != null) { _client.ContractType = client.ContractType; } if (client.DeptID != null) { _client.DepID = client.DeptID; } if (client.CORRAddress != null) { _client.CORRAddress = client.CORRAddress; } if (client.ContactAddress!= null) { _client.ContactAddress = client.ContactAddress; } if (client.ContactAddress2 != null) { _client.ContactAddress2 = client.ContactAddress2; } if (client.Contactcity != null) { _client.ContactCity = client.Contactcity; } if (client.ContactCounty != null) { _client.ContactCounty = client.ContactCounty; } if (client.ContactZipcode != null) { _client.ContactZipCode = client.ContactZipcode; } if (client.TelNo != null) { _client.Tel = client.TelNo; } if (client.Mobile != null) { _client.Mobile = client.Mobile; } if (client.Email != null) { _client.Email = client.Email; } if (!(String.IsNullOrEmpty(client.NotifyTime))) { _client.NotificationTime = Common.TimeGB(client.NotifyTime); } if (client.Logo != null) { _client.Logo = client.Logo; } if (client.FirstName != null) { _client.FirstName = client.FirstName; } if (client.LastName != null) { _client.LastName = client.LastName; } _client.Modifydate = DateTime.Now; _client.ModifyBy = client.modifyBy; if (_client.ClientID != null) { flag = DAL.DALClient.UpdateClient(_client); } } catch (Exception ex) { throw; } return flag; }
public static bool IsExistingClient(ClientMaster client) { using (var context = new SycousCon()) { try { ClientMaster objclient = context.ClientMasters.SingleOrDefault(p => p.Name.ToUpper() == client.Name.ToUpper() && p.ClientCode == client.ClientCode); if (objclient != null) { return true; } else { return false; } } catch (Exception ex) { context.Dispose(); throw; } } }
public static Boolean UpdateClient(ClientMaster client) { using (TransactionScope scope = new TransactionScope()) { Boolean bol = false; using (var context = new SycousCon()) { try { var Update = context.ClientMasters.Where(c => c.ClientID == client.ClientID); foreach (ClientMaster p in Update) { if (client.Name != null) { p.Name = client.Name.Trim(); } if (client.Address != null) { p.Address = client.Address; } if (client.Address2 != null) { p.Address2 = client.Address2; } else { p.Address2 = null; } if (client.City != null) { p.City = client.City; } if (client.ZipCode != null) { p.ZipCode = client.ZipCode; } if (client.County != null) { p.County = client.County; } else { p.County = null; } if (client.CompNumber != null) { p.CompNumber = client.CompNumber; } else { p.CompNumber = null; } if (client.Vat != null) { p.Vat = client.Vat; } else { p.Vat = null; } if (client.NotificationID != null) { p.NotificationID = client.NotificationID; } if (client.Currency != null) { p.Currency = client.Currency; } if (client.BankName != null) { p.BankName = client.BankName; } else { p.BankName = null; } if (client.ClientCode != null) { p.ClientCode = client.ClientCode; } else { p.ClientCode = null; } if (client.AccountNo != null) { p.AccountNo = client.AccountNo; } else { p.AccountNo = null; } if (client.STDate != null) { p.STDate = client.STDate; } if (client.EndDate != null) { p.EndDate = client.EndDate; } else { p.EndDate = null; } if (client.ContactName != null) { p.ContactName = client.ContactName; } if (client.ContractType != null) { p.ContractType = client.ContractType; } if (client.DepID != null) { p.DepID = client.DepID; } if (client.CORRAddress != null) { p.CORRAddress = client.CORRAddress; } if (client.ContactAddress != null) { p.ContactAddress = client.ContactAddress; } if (client.ContactAddress2 != null) { p.ContactAddress2 = client.ContactAddress2; } else { p.ContactAddress2 = null; } if (client.ContactCity!= null) { p.ContactCity = client.ContactCity; } if (client.ContactCounty != null) { p.ContactCounty = client.ContactCounty; } if (client.ContactZipCode != null) { p.ContactZipCode = client.ContactZipCode; } if (client.Tel != null) { p.Tel = client.Tel; } else { p.Tel = null; } if (client.Mobile != null) { p.Mobile = client.Mobile; } else { p.Mobile = null; } if (client.Email != null) { p.Email = client.Email; } else { p.Email = null; } if (client.RefNo != null) { p.RefNo = client.RefNo; } if (client.NotificationTime != null) { p.NotificationTime = client.NotificationTime; } if (client.Logo != null) { p.Logo = client.Logo; } if (client.FirstName != null) { p.FirstName = client.FirstName; } if (client.LastName != null) { p.LastName = client.LastName; } p.Modifydate = client.Modifydate; 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 ClientMaster EditClient(Int64 clientId) { ClientMaster client = new ClientMaster(); using (var context = new SycousCon()) { try { client = context.ClientMasters.SingleOrDefault(s => s.ClientID == clientId); } catch (Exception ex) { context.Dispose(); throw; } } return client; }
public static Boolean CreateClient(ClientMaster client) { Boolean flag = false; if (!(IsExistingClient(client))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.ClientMasters.AddObject(client); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); flag = true; } catch (Exception ex) { context.Dispose(); throw; } } } } return flag; }
public static String ADDCLIENT(ClientMaster client) { String ReturnClientID = String.Empty; if (!(IsExistingClient(client))) { using (TransactionScope scope = new TransactionScope()) { using (var context = new SycousCon()) { try { context.ClientMasters.AddObject(client); context.SaveChanges(); scope.Complete(); context.AcceptAllChanges(); ReturnClientID = client.ClientID.ToString(); }// try catch (Exception ex) { context.Dispose(); throw; } } } } return ReturnClientID; }
/// <summary> /// Create a new ClientMaster object. /// </summary> /// <param name="clientID">Initial value of the ClientID property.</param> /// <param name="deleteStatus">Initial value of the DeleteStatus property.</param> public static ClientMaster CreateClientMaster(global::System.Int64 clientID, global::System.Int32 deleteStatus) { ClientMaster clientMaster = new ClientMaster(); clientMaster.ClientID = clientID; clientMaster.DeleteStatus = deleteStatus; return clientMaster; }
/// <summary> /// Deprecated Method for adding a new object to the ClientMasters EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToClientMasters(ClientMaster clientMaster) { base.AddObject("ClientMasters", clientMaster); }