//public JsonResult GetVendorContacts1(Guid vendorId, int pageSize, int currentPage) //{ // TGFContext db = new TGFContext(); // db.Configuration.ProxyCreationEnabled = false; // var contactsQuery = db.VendorContacts.Include("Vendor").Where(c => c.VendorID == vendorId); // var rowCount = contactsQuery.Count(); // var contacts = contactsQuery.OrderBy(c => c.Firstname).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList(); // contacts.ForEach(c => // { // c.Vendnum = c.Vendor.Vendnum; // }); // return Json(new { Data = contacts, VirtualRowCount = rowCount }, JsonRequestBehavior.AllowGet); //} public JsonResult SaveVendorContact(VendorContact contact) { contact.InputDate = DateTime.Now; contact.LastModifiedDate = DateTime.Now; var result = false; if (ModelState.IsValid) { using (this.UoW) { if (contact.VendorContactID == Guid.Empty) { contact.VendorContactID = Guid.NewGuid(); this.UoW.VendorContacts.Insert(contact); result = this.UoW.Commit() > 0; } else { this.UoW.VendorContacts.Update(contact); result = this.UoW.Commit() > 0; } } return(Json(new { Success = result, VendorContact = contact })); } else { return(Json(new { Success = result, Message = "Invalid Model" })); } }
///<summary> /// Returns a Typed VendorContact Entity with mock values. ///</summary> static public VendorContact CreateMockInstance_Generated(TransactionManager tm) { VendorContact mock = new VendorContact(); mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Contact mockContactByContactId = ContactTest.CreateMockInstance(tm); DataRepository.ContactProvider.Insert(tm, mockContactByContactId); mock.ContactId = mockContactByContactId.ContactId; //OneToOneRelationship ContactType mockContactTypeByContactTypeId = ContactTypeTest.CreateMockInstance(tm); DataRepository.ContactTypeProvider.Insert(tm, mockContactTypeByContactTypeId); mock.ContactTypeId = mockContactTypeByContactTypeId.ContactTypeId; //OneToOneRelationship Vendor mockVendorByVendorId = VendorTest.CreateMockInstance(tm); DataRepository.VendorProvider.Insert(tm, mockVendorByVendorId); mock.VendorId = mockVendorByVendorId.VendorId; // create a temporary collection and add the item to it TList <VendorContact> tempMockCollection = new TList <VendorContact>(); tempMockCollection.Add(mock); tempMockCollection.Remove(mock); return((VendorContact)mock); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { VendorContact MasterEntity = (VendorContact)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Data_VendorContact WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// Deep load all VendorContact children. /// </summary> private void Step_03_DeepLoad_Generated() { using (TransactionManager tm = CreateTransaction()) { int count = -1; mock = CreateMockInstance(tm); mockCollection = DataRepository.VendorContactProvider.GetPaged(tm, 0, 10, out count); DataRepository.VendorContactProvider.DeepLoading += new EntityProviderBaseCore <VendorContact, VendorContactKey> .DeepLoadingEventHandler( delegate(object sender, DeepSessionEventArgs e) { if (e.DeepSession.Count > 3) { e.Cancel = true; } } ); if (mockCollection.Count > 0) { DataRepository.VendorContactProvider.DeepLoad(tm, mockCollection[0]); System.Console.WriteLine("VendorContact instance correctly deep loaded at 1 level."); mockCollection.Add(mock); // DataRepository.VendorContactProvider.DeepSave(tm, mockCollection); } //normally one would commit here //tm.Commit(); //IDisposable will Rollback Transaction since it's left uncommitted } }
public VendorContactModel(VendorContact contactInfo) { Name = contactInfo.Name; Role = contactInfo.Role; PhoneNumber = contactInfo.Phone_; Email = contactInfo.Email; Fax = contactInfo.Fax; }
///<summary> /// Update the Typed VendorContact Entity with modified mock values. ///</summary> static public void UpdateMockInstance(TransactionManager tm, VendorContact mock) { VendorContactTest.UpdateMockInstance_Generated(tm, mock); // make any alterations necessary // (i.e. for DB check constraints, special test cases, etc.) SetSpecialTestData(mock); }
/// <summary> /// Test methods exposed by the EntityHelper class. /// </summary> private void Step_20_TestEntityHelper_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); VendorContact entity = mock.Copy() as VendorContact; entity = (VendorContact)mock.Clone(); Assert.IsTrue(VendorContact.ValueEquals(entity, mock), "Clone is not working"); } }
public JsonResult DeleteVendorContact(VendorContact contact) { bool result = false; using (this.UoW) { this.UoW.VendorContacts.Delete(contact); result = this.UoW.Commit() > 0; } return(Json(new { Success = result })); }
///<summary> /// Returns a Typed VendorContact Entity with mock values. ///</summary> static public VendorContact CreateMockInstance(TransactionManager tm) { // get the default mock instance VendorContact mock = VendorContactTest.CreateMockInstance_Generated(tm); // make any alterations necessary // (i.e. for DB check constraints, special test cases, etc.) SetSpecialTestData(mock); // return the modified object return(mock); }
public int InsertVendorContact(VendorContact vendorContact) { var data = vendorContact; var response = GetDataFromApiOut <BaseResultAPI <int>, VendorContact>( "Interface/InsertVendorContact", Method.POST, null, null, data); return(response.Data); }
/// <summary> /// Serialize the mock VendorContact entity into a temporary file. /// </summary> private void Step_06_SerializeEntity_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_VendorContact.xml"); EntityHelper.SerializeXml(mock, fileName); Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found"); System.Console.WriteLine("mock correctly serialized to a temporary file."); } }
/// <summary> /// 获取客户联系人实体 /// </summary> /// <returns></returns> private VendorContact[] GetVendorContact() { int Num = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (SysConvert.ToString(gridView1.GetRowCellValue(i, "Name")) != string.Empty) { Num++; } } VendorContact[] entitydts = new VendorContact[Num]; int index = 0; for (int i = 0; i < gridView1.RowCount; i++) { if (SysConvert.ToString(gridView1.GetRowCellValue(i, "Name")) != string.Empty) { entitydts[index] = new VendorContact(); entitydts[index].MainID = HTDataID; entitydts[index].Seq = i + 1; entitydts[index].SelectByID(); entitydts[index].Code = SysConvert.ToString(gridView1.GetRowCellValue(i, "Code")); entitydts[index].Name = SysConvert.ToString(gridView1.GetRowCellValue(i, "Name")); entitydts[index].FL = SysConvert.ToString(gridView1.GetRowCellValue(i, "FL")); entitydts[index].TEL = SysConvert.ToString(gridView1.GetRowCellValue(i, "TEL")); entitydts[index].FAX = SysConvert.ToString(gridView1.GetRowCellValue(i, "FAX")); entitydts[index].Mobil = SysConvert.ToString(gridView1.GetRowCellValue(i, "Mobil")); entitydts[index].SubTel = SysConvert.ToString(gridView1.GetRowCellValue(i, "SubTel")); entitydts[index].Dep = SysConvert.ToString(gridView1.GetRowCellValue(i, "Dep")); entitydts[index].Remark = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark")); entitydts[index].Birthday = SysConvert.ToDateTime(gridView1.GetRowCellValue(i, "Birthday")); entitydts[index].SpecialDay = SysConvert.ToDateTime(gridView1.GetRowCellValue(i, "SpecialDay")); entitydts[index].TELTwo = SysConvert.ToString(gridView1.GetRowCellValue(i, "TELTwo")); //邱超添加 entitydts[index].TELThree = SysConvert.ToString(gridView1.GetRowCellValue(i, "TELThree")); entitydts[index].QQ = SysConvert.ToString(gridView1.GetRowCellValue(i, "QQ")); entitydts[index].Email = SysConvert.ToString(gridView1.GetRowCellValue(i, "Email")); entitydts[index].FreeStr = SysConvert.ToString(gridView1.GetRowCellValue(i, "FreeStr")); entitydts[index].ContactEn = SysConvert.ToString(gridView1.GetRowCellValue(i, "ContactEn")); index++; } } return(entitydts); }
private VendorContact VendorContact(string EmailAddress, string FirstName, string LastName) { VendorContact vendorContact = this.DataSourceHelper.Session.FindObject <VendorContact>(CriteriaOperator.Parse(string.Format("Email = '{0}'", EmailAddress))); if (vendorContact == null) { vendorContact = new VendorContact(this.DataSourceHelper.Session) { FirstName = FirstName, LastName = LastName, Email = EmailAddress }; vendorContact.Save(); } return(vendorContact); }
private string GetVendorPhoneNo(Guid vendorKey) { string asd = ""; VendorContact count = db.VendorContact.FirstOrDefault(m => m.VendorKey == vendorKey && m.IsDefault == true && m.IsDelete == false); if (count == null) { asd = ""; } else { asd = count.Phone + " - " + count.PhoneEXT; } return(asd); }
private void mapItem(VendorContact vendorContact, VendorContactViewModel input) { vendorContact.Address1 = input.VendorContact.Address1; vendorContact.Address2 = input.VendorContact.Address2; vendorContact.City = input.VendorContact.City; vendorContact.Country = input.VendorContact.Country; vendorContact.Email = input.VendorContact.Email; vendorContact.Fax = input.VendorContact.Fax; vendorContact.FirstName = input.VendorContact.FirstName; vendorContact.LastName = input.VendorContact.LastName; vendorContact.Notes = input.VendorContact.Notes; vendorContact.Phone = input.VendorContact.Phone; vendorContact.State = input.VendorContact.State; vendorContact.Status = input.VendorContact.State; vendorContact.ZipCode = input.VendorContact.ZipCode; }
private void mapItem(VendorContact vendorContact, VendorContactViewModel input) { vendorContact.Address1 = input.VendorContact.Address1; vendorContact.Address2 = input.VendorContact.Address2; vendorContact.City = input.VendorContact.City; vendorContact.Country = input.VendorContact.Country; vendorContact.Email = input.VendorContact.Email; vendorContact.Fax = input.VendorContact.Fax; vendorContact.FirstName = input.VendorContact.FirstName; vendorContact.LastName = input.VendorContact.LastName; vendorContact.Notes = input.VendorContact.Notes; vendorContact.Phone = input.VendorContact.Phone; vendorContact.State = input.VendorContact.State; vendorContact.Status = input.VendorContact.State; vendorContact.ZipCode = input.VendorContact.ZipCode; }
/// <summary> /// Serialize a VendorContact collection into a temporary file. /// </summary> private void Step_08_SerializeCollection_Generated() { using (TransactionManager tm = CreateTransaction()) { string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_VendorContactCollection.xml"); mock = CreateMockInstance(tm); TList <VendorContact> mockCollection = new TList <VendorContact>(); mockCollection.Add(mock); EntityHelper.SerializeXml(mockCollection, fileName); Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found"); System.Console.WriteLine("TList<VendorContact> correctly serialized to a temporary file."); } }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); VendorContact entity = (VendorContact)p_BE; VendorContactCtl control = new VendorContactCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public ActionResult Save(VendorContactViewModel input) { VendorContact vendorContact; if (input.VendorContact.EntityId > 0) { vendorContact = _repository.Find<VendorContact>(input.VendorContact.EntityId); } else { vendorContact = new VendorContact(); var vendor = _repository.Find<Vendor>(input.ParentId); vendorContact.Vendor = vendor; } mapItem(vendorContact, input); var crudManager = _saveEntityService.ProcessSave(vendorContact); var notification = crudManager.Finish(); return Json(notification, JsonRequestBehavior.AllowGet); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); VendorContact entity = (VendorContact)p_BE; VendorContactCtl control = new VendorContactCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_VendorContact, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public void UpdateVendorDetails(VendorsViewModel model) { Vendor vendor = this._context .Vendor .Where(r => r.VendorId == model.VendorId) .FirstOrDefault(); if (vendor != null) { vendor.CompanyName = model.CompanyName; vendor.AddressLine1 = model.AddressLine1; vendor.City = model.City; vendor.State = model.State; vendor.Zip = model.Zip; } VendorContact contact = this._context .Vendor_Contact .Where(r => r.VendorContactId == model.ContactId) .FirstOrDefault(); if (contact != null) { contact.Name = model.ContactName; contact.JobTitle = model.ContactTitle; contact.Email = model.ContactEmail; } VendorContact signatory = this._context .Vendor_Contact .Where(r => r.VendorContactId == model.SignatoryId) .FirstOrDefault(); if (contact != null) { signatory.Name = model.SignatoryName; signatory.JobTitle = model.SignatoryTitle; signatory.Email = model.SignatoryEmail; } this._context.SaveChanges(); }
public ActionResult Save(VendorContactViewModel input) { VendorContact vendorContact; if (input.VendorContact.EntityId > 0) { vendorContact = _repository.Find <VendorContact>(input.VendorContact.EntityId); } else { vendorContact = new VendorContact(); var vendor = _repository.Find <Vendor>(input.ParentId); vendorContact.Vendor = vendor; } mapItem(vendorContact, input); var crudManager = _saveEntityService.ProcessSave(vendorContact); var notification = crudManager.Finish(); return(Json(notification, JsonRequestBehavior.AllowGet)); }
public void CreateContactInfo(Vendor Vendor) { if (Vendor.VendorContacts.Count == 0) { if (Vendor.FirstName != null && Vendor.LastName != null && Vendor.Email != null) { VendorContact contact = Vendor.Session.FindObject <VendorContact>(CriteriaOperator.Parse("Email == ?", Vendor.Email)); if (contact == null) { contact = new VendorContact(Vendor.Session) { FirstName = Vendor.FirstName, LastName = Vendor.LastName, Phone = Vendor.Phone, CellNo = Vendor.CellNo, Email = Vendor.Email } } ; Vendor.VendorContacts.Add(contact); } } }
/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance VendorContact mock = CreateMockInstance(tm); bool result = DataRepository.VendorContactProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); VendorContactQuery query = new VendorContactQuery(); query.AppendEquals(VendorContactColumn.VendorId, mock.VendorId.ToString()); query.AppendEquals(VendorContactColumn.ContactId, mock.ContactId.ToString()); query.AppendEquals(VendorContactColumn.ContactTypeId, mock.ContactTypeId.ToString()); query.AppendEquals(VendorContactColumn.ModifiedDate, mock.ModifiedDate.ToString()); TList <VendorContact> results = DataRepository.VendorContactProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }
///<summary> /// Update the Typed VendorContact Entity with modified mock values. ///</summary> static public void UpdateMockInstance_Generated(TransactionManager tm, VendorContact mock) { mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); //OneToOneRelationship Contact mockContactByContactId = ContactTest.CreateMockInstance(tm); DataRepository.ContactProvider.Insert(tm, mockContactByContactId); mock.ContactId = mockContactByContactId.ContactId; //OneToOneRelationship ContactType mockContactTypeByContactTypeId = ContactTypeTest.CreateMockInstance(tm); DataRepository.ContactTypeProvider.Insert(tm, mockContactTypeByContactTypeId); mock.ContactTypeId = mockContactTypeByContactTypeId.ContactTypeId; //OneToOneRelationship Vendor mockVendorByVendorId = VendorTest.CreateMockInstance(tm); DataRepository.VendorProvider.Insert(tm, mockVendorByVendorId); mock.VendorId = mockVendorByVendorId.VendorId; }
public void CreateLocationInfo(Vendor Vendor) { if (Vendor.Locations.Count == 0) { if (Vendor.PostalAddress != null) { VendorContact contact = Vendor.Session.FindObject <VendorContact>(CriteriaOperator.Parse("Email == ?", Vendor.Email)); Location location = Vendor.Session.FindObject <Location>(contact != null ? CriteriaOperator.Parse("PhysicalAddress == ? and VendorContact == ?", Vendor.PostalAddress.Oid, contact.Oid) : CriteriaOperator.Parse("PhysicalAddress == ?", Vendor.PostalAddress.Oid)); if (location == null) { location = new Location(Vendor.Session) { PhysicalAddress = Vendor.PostalAddress, VendorContact = contact } } ; Vendor.Locations.Add(location); } } } }
/// <summary> /// There are no comments for VendorContact in the schema. /// </summary> public void AddToVendorContact(VendorContact vendorContact) { base.AddObject("VendorContact", vendorContact); }
private void CreateVendorContact() { _contact1v1 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Amahl", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "RI", Status = "Active", }; _contact1v2 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Amahl", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "RI", Status = "Active", }; _contact2v1 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Raif", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "Tx", Status = "Active", }; _contact2v2 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Raif", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "Tx", Status = "Active", }; _vendor1.AddContact(_contact1v1); _vendor1.AddContact(_contact2v1); _vendor2.AddContact(_contact1v2); _vendor2.AddContact(_contact2v2); _repository.Save(_contact1v1); _repository.Save(_contact2v1); _repository.Save(_contact1v2); _repository.Save(_contact2v2); _repository.Save(_vendor1); _repository.Save(_vendor2); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); Vendor entity = (Vendor)p_BE; this.RAdd(entity, sqlTrans); //string sql = "SELECT * FROM Data_Vendor WHERE VendorID="+SysString.ToDBString(entity.VendorID); //DataTable dt = sqlTrans.Fill(sql); //if (dt.Rows.Count > 0) //{ // throw new BaseException("客户编码已存在,请检查后重新输入"); //} //sql = "SELECT * FROM Data_Vendor WHERE VendorAttn=" + SysString.ToDBString(entity.VendorAttn); //dt = sqlTrans.Fill(sql); //if (dt.Rows.Count > 0) //{ // throw new BaseException("客户简称已存在,请检查后重新输入"); //} //sql = "SELECT * FROM Data_Vendor WHERE VendorName=" + SysString.ToDBString(entity.VendorName); //dt = sqlTrans.Fill(sql); //if (dt.Rows.Count > 0) //{ // throw new BaseException("客户全称已存在,请检查后重新输入"); //} //VendorCtl control = new VendorCtl(sqlTrans); //entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_Vendor, sqlTrans); //control.AddNew(entity); //新增客户联系人 for (int i = 0; i < p_BE2.Length; i++) { VendorContactRule rule = new VendorContactRule(); VendorContact entityVendorContact = (VendorContact)p_BE2[i]; entityVendorContact.MainID = entity.ID; entityVendorContact.Seq = i + 1; rule.RAdd(entityVendorContact, sqlTrans); } //新增客户归属业务员 for (int i = 0; i < p_BE3.Length; i++) { VendorSaleOPRule rule = new VendorSaleOPRule(); VendorSaleOP entityVendorSaleOP = (VendorSaleOP)p_BE3[i]; entityVendorSaleOP.MainID = entity.ID; entityVendorSaleOP.Seq = i + 1; rule.RAdd(entityVendorSaleOP, sqlTrans); } for (int i = 0; i < p_BE4.Length; i++) { VendorAddressRule rule = new VendorAddressRule(); VendorAddress entityVendorAddress = (VendorAddress)p_BE4[i]; entityVendorAddress.MainID = entity.ID; entityVendorAddress.Seq = i + 1; rule.RAdd(entityVendorAddress, sqlTrans); } for (int i = 0; i < p_BE5.Length; i++) { VendorNewsRule rule = new VendorNewsRule(); VendorNews entityVendorNews = (VendorNews)p_BE5[i]; entityVendorNews.MainID = entity.ID; entityVendorNews.Seq = i + 1; rule.RAdd(entityVendorNews, sqlTrans); } VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule(); vendortyperule.RSave(p_BE, p_BE6, sqlTrans); //FormNoControlRule fnrule = new FormNoControlRule(); //fnrule.RAddSort("Data_Vendor", "VendorID", entity.VendorTypeID, sqlTrans); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public virtual void AddContact(VendorContact contact) { if (!contact.IsNew() && _contacts.Contains(contact)) return; _contacts.Add(contact); contact.Vendor = this; }
/// <summary> /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.) /// </summary> /// <param name="mock">Object to be modified</param> static private void SetSpecialTestData(VendorContact mock) { //Code your changes to the data object here. }
/// <summary> /// Create a new VendorContact object. /// </summary> /// <param name="vendorID">Initial value of VendorID.</param> /// <param name="contactID">Initial value of ContactID.</param> /// <param name="modifiedDate">Initial value of ModifiedDate.</param> public static VendorContact CreateVendorContact(int vendorID, int contactID, global::System.DateTime modifiedDate) { VendorContact vendorContact = new VendorContact(); vendorContact.VendorID = vendorID; vendorContact.ContactID = contactID; vendorContact.ModifiedDate = modifiedDate; return vendorContact; }
private void CreateVendorContact() { _contact1v1 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Amahl", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "RI", Status = "Active", }; _contact1v2 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Amahl", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "RI", Status = "Active", }; _contact2v1 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Raif", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "Tx", Status = "Active", }; _contact2v2 = new VendorContact { Address2 = "4600 Guadalupe St", Address1 = "B113", City = "Austin", Email = "*****@*****.**", FirstName = "Raif", LastName = "Harik", Phone = "512.228.6069", Fax = "512.228.60690", State = "Tx", Status = "Active", }; _vendor1.AddContact(_contact1v1); _vendor1.AddContact(_contact2v1); _vendor2.AddContact(_contact1v2); _vendor2.AddContact(_contact2v2); _repository.Save(_contact1v1); _repository.Save(_contact2v1); _repository.Save(_contact1v2); _repository.Save(_contact2v2); _repository.Save(_vendor1); _repository.Save(_vendor2); }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); Vendor entity = (Vendor)p_BE; this.RUpdate(p_BE, sqlTrans); //VendorCtl control = new VendorCtl(sqlTrans); //control.Update(entity); string sql = "DELETE Data_VendorSaleOP WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorContact WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorAddress WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorNews WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorInvoiceDts WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); if (p_BE7.Length > 0) { sql = "DELETE Data_ItemAdd WHERE MainID=" + SysString.ToDBString(entity.ID); sql += " AND ISNULL(FormID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormID); sql += " AND ISNULL(FormAID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormAID); sql += " AND ISNULL(FormBID,0)=" + SysString.ToDBString(((ItemAdd)p_BE7[0]).FormBID); sqlTrans.ExecuteNonQuery(sql); } //新增客户联系人 for (int i = 0; i < p_BE2.Length; i++) { VendorContactRule rule = new VendorContactRule(); VendorContact entityVendorContact = (VendorContact)p_BE2[i]; entityVendorContact.MainID = entity.ID; entityVendorContact.Seq = i + 1; rule.RAdd(entityVendorContact, sqlTrans); } //新增客户归属业务员 for (int i = 0; i < p_BE3.Length; i++) { VendorSaleOPRule rule = new VendorSaleOPRule(); VendorSaleOP entityVendorSaleOP = (VendorSaleOP)p_BE3[i]; entityVendorSaleOP.MainID = entity.ID; entityVendorSaleOP.Seq = i + 1; rule.RAdd(entityVendorSaleOP, sqlTrans); } for (int i = 0; i < p_BE4.Length; i++) { VendorAddressRule rule = new VendorAddressRule(); VendorAddress entityVendorAddress = (VendorAddress)p_BE4[i]; entityVendorAddress.MainID = entity.ID; entityVendorAddress.Seq = i + 1; rule.RAdd(entityVendorAddress, sqlTrans); } for (int i = 0; i < p_BE5.Length; i++) { VendorNewsRule rule = new VendorNewsRule(); VendorNews entityVendorNews = (VendorNews)p_BE5[i]; entityVendorNews.MainID = entity.ID; entityVendorNews.Seq = i + 1; rule.RAdd(entityVendorNews, sqlTrans); } for (int i = 0; i < p_BE7.Length; i++) { ItemAddRule rule = new ItemAddRule(); ItemAdd entityItemAdd = (ItemAdd)p_BE7[i]; entityItemAdd.MainID = entity.ID; entityItemAdd.Seq = i + 1; rule.RAdd(entityItemAdd, sqlTrans); rule.UpdateFiledSet(entity.ID, entityItemAdd.FiledSetID, entityItemAdd.Value, sqlTrans); } for (int i = 0; i < p_BE8.Length; i++) { VendorInvoiceDtsRule rule = new VendorInvoiceDtsRule(); VendorInvoiceDts entityItemInvoice = (VendorInvoiceDts)p_BE8[i]; entityItemInvoice.MainID = entity.ID; entityItemInvoice.Seq = i + 1; rule.RAdd(entityItemInvoice, sqlTrans); } VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule(); vendortyperule.RSave(p_BE, p_BE6, sqlTrans); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); Vendor entity = (Vendor)p_BE; this.RUpdate(p_BE, sqlTrans); //VendorCtl control = new VendorCtl(sqlTrans); //control.Update(entity); string sql = "DELETE Data_VendorSaleOP WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorContact WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorAddress WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE Data_VendorNews WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); //新增客户联系人 for (int i = 0; i < p_BE2.Length; i++) { VendorContactRule rule = new VendorContactRule(); VendorContact entityVendorContact = (VendorContact)p_BE2[i]; entityVendorContact.MainID = entity.ID; entityVendorContact.Seq = i + 1; rule.RAdd(entityVendorContact, sqlTrans); } //新增客户归属业务员 for (int i = 0; i < p_BE3.Length; i++) { VendorSaleOPRule rule = new VendorSaleOPRule(); VendorSaleOP entityVendorSaleOP = (VendorSaleOP)p_BE3[i]; entityVendorSaleOP.MainID = entity.ID; entityVendorSaleOP.Seq = i + 1; rule.RAdd(entityVendorSaleOP, sqlTrans); } for (int i = 0; i < p_BE4.Length; i++) { VendorAddressRule rule = new VendorAddressRule(); VendorAddress entityVendorAddress = (VendorAddress)p_BE4[i]; entityVendorAddress.MainID = entity.ID; entityVendorAddress.Seq = i + 1; rule.RAdd(entityVendorAddress, sqlTrans); } for (int i = 0; i < p_BE5.Length; i++) { VendorNewsRule rule = new VendorNewsRule(); VendorNews entityVendorNews = (VendorNews)p_BE5[i]; entityVendorNews.MainID = entity.ID; entityVendorNews.Seq = i + 1; rule.RAdd(entityVendorNews, sqlTrans); } VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule(); vendortyperule.RSave(p_BE, p_BE6, sqlTrans); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, BaseEntity[] p_BE4, BaseEntity[] p_BE5, ArrayList p_BE6, BaseEntity[] p_BE7, BaseEntity[] p_BE8, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); Vendor entity = (Vendor)p_BE; this.RAdd(entity, sqlTrans); for (int i = 0; i < p_BE2.Length; i++) { VendorContactRule rule = new VendorContactRule(); VendorContact entityVendorContact = (VendorContact)p_BE2[i]; entityVendorContact.MainID = entity.ID; entityVendorContact.Seq = i + 1; rule.RAdd(entityVendorContact, sqlTrans); } //新增客户归属业务员 for (int i = 0; i < p_BE3.Length; i++) { VendorSaleOPRule rule = new VendorSaleOPRule(); VendorSaleOP entityVendorSaleOP = (VendorSaleOP)p_BE3[i]; entityVendorSaleOP.MainID = entity.ID; entityVendorSaleOP.Seq = i + 1; rule.RAdd(entityVendorSaleOP, sqlTrans); } for (int i = 0; i < p_BE4.Length; i++) { VendorAddressRule rule = new VendorAddressRule(); VendorAddress entityVendorAddress = (VendorAddress)p_BE4[i]; entityVendorAddress.MainID = entity.ID; entityVendorAddress.Seq = i + 1; rule.RAdd(entityVendorAddress, sqlTrans); } for (int i = 0; i < p_BE5.Length; i++) { VendorNewsRule rule = new VendorNewsRule(); VendorNews entityVendorNews = (VendorNews)p_BE5[i]; entityVendorNews.MainID = entity.ID; entityVendorNews.Seq = i + 1; rule.RAdd(entityVendorNews, sqlTrans); } for (int i = 0; i < p_BE7.Length; i++) { ItemAddRule rule = new ItemAddRule(); ItemAdd entityItemAdd = (ItemAdd)p_BE7[i]; entityItemAdd.MainID = entity.ID; entityItemAdd.Seq = i + 1; rule.RAdd(entityItemAdd, sqlTrans); rule.UpdateFiledSet(entity.ID, entityItemAdd.FiledSetID, entityItemAdd.Value, sqlTrans); } for (int i = 0; i < p_BE8.Length; i++) { VendorInvoiceDtsRule rule = new VendorInvoiceDtsRule(); VendorInvoiceDts entityItemInvoice = (VendorInvoiceDts)p_BE8[i]; entityItemInvoice.MainID = entity.ID; entityItemInvoice.Seq = i + 1; rule.RAdd(entityItemInvoice, sqlTrans); } VendorTypeDtsRule vendortyperule = new VendorTypeDtsRule(); vendortyperule.RSave(p_BE, p_BE6, sqlTrans); //FormNoControlRule fnrule = new FormNoControlRule(); //fnrule.RAddSort("Data_Vendor", "VendorID", entity.VendorTypeID, sqlTrans); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public virtual void RemoveContact(VendorContact contact) { _contacts.Remove(contact); }