상속: System.Web.UI.Page
        public static WorkgroupVendorViewModel Create(IRepositoryWithTypedId<Vendor, string> vendorRepository, WorkgroupVendor workgroupVendor = null, Vendor vendor = null, VendorAddress vendorAddress = null, bool? newVendor = null)
        {
            Check.Require(vendorRepository != null, "Repository must be supplied");

            var addresses = vendor != null ? new MultiSelectList(vendor.VendorAddresses.Select(a => new { TypeCode = a.TypeCode, Name = string.Format("{0} ({1}, {2}, {3} {4})", a.Name, a.Line1, a.City, a.State, a.Zip) }).ToList(), "TypeCode", "Name") : new MultiSelectList(new List<VendorAddress>(), "TypeCode", "Name");

            var viewModel = new WorkgroupVendorViewModel
                                {
                                    WorkgroupVendor = workgroupVendor ?? new WorkgroupVendor(),
                                    Vendor = vendor,
                                    VendorAddress = vendorAddress,
                                    //Vendors = vendorRepository.Queryable.OrderBy(a => a.Name).ToList(),
                                    VendorAddresses = addresses,
                                    NewVendor = newVendor
                                };
            if(viewModel.WorkgroupVendor.VendorId != null && string.IsNullOrWhiteSpace(viewModel.WorkgroupVendor.Name))
            {
                var locVendor = vendorRepository.Queryable.First(a => a.Id == viewModel.WorkgroupVendor.VendorId);
                if(locVendor != null)
                {
                    viewModel.WorkgroupVendor.Name = locVendor.Name;
                }
            }
            return viewModel;
        }
예제 #2
0
        ///<summary>
        ///  Returns a Typed VendorAddress Entity with mock values.
        ///</summary>
        static public VendorAddress CreateMockInstance_Generated(TransactionManager tm)
        {
            VendorAddress mock = new VendorAddress();

            mock.ModifiedDate = TestUtility.Instance.RandomDateTime();

            //OneToOneRelationship
            Address mockAddressByAddressId = AddressTest.CreateMockInstance(tm);

            DataRepository.AddressProvider.Insert(tm, mockAddressByAddressId);
            mock.AddressId = mockAddressByAddressId.AddressId;
            //OneToOneRelationship
            AddressType mockAddressTypeByAddressTypeId = AddressTypeTest.CreateMockInstance(tm);

            DataRepository.AddressTypeProvider.Insert(tm, mockAddressTypeByAddressTypeId);
            mock.AddressTypeId = mockAddressTypeByAddressTypeId.AddressTypeId;
            //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 <VendorAddress> tempMockCollection = new TList <VendorAddress>();

            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);


            return((VendorAddress)mock);
        }
예제 #3
0
        private void dgvCustomers_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            VendorAddress objVendorAddress = dgvVendors.CurrentRow.DataBoundItem as VendorAddress;

            SelectedVendorAddress = objVendorAddress;
            this.Dispose();
        }
예제 #4
0
        /// <summary>
        /// Deep load all VendorAddress children.
        /// </summary>
        private void Step_03_DeepLoad_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                int count = -1;
                mock           = CreateMockInstance(tm);
                mockCollection = DataRepository.VendorAddressProvider.GetPaged(tm, 0, 10, out count);

                DataRepository.VendorAddressProvider.DeepLoading += new EntityProviderBaseCore <VendorAddress, VendorAddressKey> .DeepLoadingEventHandler(
                    delegate(object sender, DeepSessionEventArgs e)
                {
                    if (e.DeepSession.Count > 3)
                    {
                        e.Cancel = true;
                    }
                }
                    );

                if (mockCollection.Count > 0)
                {
                    DataRepository.VendorAddressProvider.DeepLoad(tm, mockCollection[0]);
                    System.Console.WriteLine("VendorAddress instance correctly deep loaded at 1 level.");

                    mockCollection.Add(mock);
                    // DataRepository.VendorAddressProvider.DeepSave(tm, mockCollection);
                }

                //normally one would commit here
                //tm.Commit();
                //IDisposable will Rollback Transaction since it's left uncommitted
            }
        }
예제 #5
0
        private VendorAddress[] GetVendorAddress()
        {
            int Num = 0;

            for (int i = 0; i < gridView3.RowCount; i++)
            {
                if (SysConvert.ToString(gridView3.GetRowCellValue(i, "Address")) != string.Empty)
                {
                    Num++;
                }
            }
            VendorAddress[] entitydts = new VendorAddress[Num];
            int             index     = 0;

            for (int i = 0; i < gridView3.RowCount; i++)
            {
                if (SysConvert.ToString(gridView3.GetRowCellValue(i, "Address")) != string.Empty)
                {
                    entitydts[index]        = new VendorAddress();
                    entitydts[index].MainID = HTDataID;
                    entitydts[index].Seq    = i + 1;
                    entitydts[index].SelectByID();


                    entitydts[index].Address = SysConvert.ToString(gridView3.GetRowCellValue(i, "Address"));


                    index++;
                }
            }
            return(entitydts);
        }
예제 #6
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                VendorAddress MasterEntity = (VendorAddress)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_VendorAddress WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq);
                //执行
                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);
            }
        }
예제 #7
0
            public XElement GenerateModRq(bool?ClearExpenseLines = null)
            {
                XElement xElement = new XElement(nameof(Bill) + "Mod");

                xElement.Add(TxnID?.ToQBXML(nameof(TxnID)));
                xElement.Add(TimeCreated?.ToQBXML(nameof(TimeCreated)));
                xElement.Add(TimeModified?.ToQBXML(nameof(TimeModified)));
                xElement.Add(EditSequence?.ToQBXML(nameof(EditSequence)));
                xElement.Add(TxnNumber?.ToQBXML(nameof(TxnNumber)));
                xElement.Add(VendorRef?.ToQBXML(nameof(VendorRef)));
                xElement.Add(VendorAddress?.ToQBXML(nameof(VendorAddress)));
                xElement.Add(APAccountRef?.ToQBXML(nameof(APAccountRef)));
                xElement.Add(TxnDate?.ToQBXML(nameof(TxnDate)));
                xElement.Add(DueDate?.ToQBXML(nameof(DueDate)));
                xElement.Add(AmountDue?.ToQBXML(nameof(AmountDue)));
                xElement.Add(CurrencyRef?.ToQBXML(nameof(CurrencyRef)));
                xElement.Add(ExchangeRate?.ToQBXML(nameof(ExchangeRate)));
                xElement.Add(AmountDueInHomeCurrency?.ToQBXML(nameof(AmountDueInHomeCurrency)));
                xElement.Add(RefNumber?.ToQBXML(nameof(RefNumber)));
                xElement.Add(TermsRef?.ToQBXML(nameof(TermsRef)));
                xElement.Add(Memo?.ToQBXML(nameof(Memo)));
                xElement.Add(IsTaxIncluded?.ToQBXML(nameof(IsTaxIncluded)));
                xElement.Add(SalesTaxCodeRef?.ToQBXML(nameof(SalesTaxCodeRef)));
                xElement.Add(IsPaid?.ToQBXML(nameof(IsPaid)));
                xElement.Add(ExternalGUID?.ToQBXML(nameof(ExternalGUID)));
                xElement.Add(LinkedTxnList?.ToQBXML(nameof(LinkedTxnList)));
                xElement.Add(ExpenseLineList?.ToQBXML(nameof(ExpenseLineList)));
                xElement.Add(ItemLineList?.ToQBXML(nameof(ItemLineList)));
                xElement.Add(OpenAmount?.ToQBXML(nameof(OpenAmount)));
                xElement.Add(DataExtList?.ToQBXML(nameof(DataExtList)));

                return(xElement);
            }
예제 #8
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(Vendor p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Data_VendorAddress WHERE MainID=" + p_Entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据
                for (int i = 0; i < p_BE.Length; i++)
                {
                    VendorAddress entitydts = (VendorAddress)p_BE[i];
                    sql              = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Data_VendorAddress WHERE MainID=" + p_Entity.ID.ToString();
                    entitydts.Seq    = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());//找到最大的Seq
                    entitydts.MainID = p_Entity.ID;

                    sql = " SELECT Address FROM Data_VendorAddress WHERE MainID=" + SysString.ToDBString(p_Entity.ID) + " AND Address=" + SysString.ToDBString(entitydts.Address);
                    if (sqlTrans.Fill(sql).Rows.Count != 0 && SysConvert.ToString(sqlTrans.Fill(sql).Rows[0][0]) != "")
                    {
                        throw new Exception(" 地址已存在,请检查");
                    }

                    this.RAdd(entitydts, sqlTrans);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #9
0
 private void clear_Click(object sender, EventArgs e)
 {
     VendorName.Clear();
     VendorAddress.Clear();
     PhoneNumber.Clear();
     email.Clear();
     VendorID.Clear();
 }
예제 #10
0
        ///<summary>
        ///  Update the Typed VendorAddress Entity with modified mock values.
        ///</summary>
        static public void UpdateMockInstance(TransactionManager tm, VendorAddress mock)
        {
            VendorAddressTest.UpdateMockInstance_Generated(tm, mock);

            // make any alterations necessary
            // (i.e. for DB check constraints, special test cases, etc.)
            SetSpecialTestData(mock);
        }
        private void submit_Click(object sender, EventArgs e)
        {
            if (VendorName.Text == "" || VendorAddress.Text == "" || PhoneNO.Text == "" || Email.Text == "" || VendorID.Text == "")
            {
                MessageBox.Show("Please provide all the details", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (PhoneNO.Text.Length != 10)
            {
                MessageBox.Show("Enter valid Phone number", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                Connect connectObj = new Connect();
                con = connectObj.connect();

                SqlCommand cmd = new SqlCommand("Insert into VENDOR (vid,vname,address,phone_number,email) values(@id,@vname,@address,@phno,@email);", con);

                cmd.Parameters.AddWithValue("@id", VendorID.Text);
                cmd.Parameters.AddWithValue("@vname", VendorName.Text);
                cmd.Parameters.AddWithValue("@phno", Convert.ToInt64(PhoneNO.Text));
                cmd.Parameters.AddWithValue("@address", VendorAddress.Text);
                cmd.Parameters.AddWithValue("@email", Email.Text);

                int i = cmd.ExecuteNonQuery();
                //If count is equal to 1, than show frmMain form
                if (i != 0)
                {
                    MessageBox.Show("Vendor Insertion Successful!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Vendor Insertion Failed", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                con.Close();

                //Clear all the fields.
                VendorName.Clear();
                VendorAddress.Clear();
                PhoneNO.Clear();
                Email.Clear();
                VendorID.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed!! Try with Different ID!!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
 private void clear_Click(object sender, EventArgs e)
 {
     VendorName.Clear();
     VendorAddress.Clear();
     VendorPhoneNo.Clear();
     Email.Clear();
     VendorID.Clear();
     VendorName2.Clear();
 }
예제 #13
0
        /*
         * Developer: Azeem Hassan
         * Date: 7-5-19
         * Action: creating new vendor address to database
         * Input: vendor address
         * output: result
         */
        public async Task <string> Create(VendorAddress NewVendor)
        {
            using (IDbConnection conn = Connection)
            {
                var result = await conn.InsertAsync <VendorAddress>(NewVendor);

                return(result.ToString());
            }
        }
예제 #14
0
        /*
         * Developer: Azeem Hassan
         * Date: 7-5-19
         * Action: update vendor address to database
         * Input: vendor address
         * output: result
         */
        public async Task <Boolean> Update(VendorAddress VendorToUpdate)
        {
            using (IDbConnection conn = Connection)
            {
                var result = await conn.UpdateAsync <VendorAddress>(VendorToUpdate);

                return(result);
            }
        }
예제 #15
0
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                VendorAddress entity = mock.Copy() as VendorAddress;
                entity = (VendorAddress)mock.Clone();
                Assert.IsTrue(VendorAddress.ValueEquals(entity, mock), "Clone is not working");
            }
        }
        public void InsertVendorAddress(VendorAddress vendorAddress)
        {
            if (vendorAddress == null)
            {
                throw new ArgumentNullException();
            }

            _vendorAddressRepo.Insert(vendorAddress);

            _eventPublisher.EntityInserted(vendorAddress);
        }
        public void UpdateVendorAddress(VendorAddress vendorAddress)
        {
            if (vendorAddress == null)
            {
                throw new ArgumentNullException();
            }

            _vendorAddressRepo.Update(vendorAddress);

            _eventPublisher.EntityUpdated(vendorAddress);
        }
예제 #18
0
        ///<summary>
        ///  Returns a Typed VendorAddress Entity with mock values.
        ///</summary>
        static public VendorAddress CreateMockInstance(TransactionManager tm)
        {
            // get the default mock instance
            VendorAddress mock = VendorAddressTest.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);
        }
예제 #19
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                VendorAddress MasterEntity = (VendorAddress)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_VendorAddress(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("Address" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Address) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("Tel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Tel) + ",");
                MasterField.Append("Name" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Name) + ",");
                MasterField.Append("Attn" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Attn) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
예제 #20
0
        /// <summary>
        /// Serialize the mock VendorAddress 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_VendorAddress.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.");
            }
        }
예제 #21
0
        private void update_Click(object sender, EventArgs e)
        {
            if (VendorName.Text == "" || VendorAddress.Text == "" || PhoneNumber.Text == "" || email.Text == "" || VendorID.Text == "")
            {
                MessageBox.Show("Please provide all the details", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                Connect connectObj = new Connect();
                con = connectObj.connect();

                SqlCommand cmd = new SqlCommand("UPDATE VENDOR SET vname = @vname,address = @address,phone_number = @phno,email = @email WHERE vid = @id;", con);

                cmd.Parameters.AddWithValue("@id", VendorID.Text);
                cmd.Parameters.AddWithValue("@vname", VendorName.Text);
                cmd.Parameters.AddWithValue("@phno", Convert.ToInt64(PhoneNumber.Text));
                cmd.Parameters.AddWithValue("@address", VendorAddress.Text);
                cmd.Parameters.AddWithValue("@email", email.Text);

                int i = cmd.ExecuteNonQuery();
                //If count is equal to 1, than show frmMain form
                if (i != 0)
                {
                    MessageBox.Show("Vendor Updation Successful!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Vendor Updation Failed", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Vendor not found", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }

            VendorName.Clear();
            VendorAddress.Clear();
            PhoneNumber.Clear();
            email.Clear();
            VendorID.Clear();
        }
예제 #22
0
        public static VendorAddress VendorAddress(int?counter)
        {
            var rtValue = new VendorAddress();

            rtValue.TypeCode    = "tc" + counter.Extra();
            rtValue.Name        = "Name" + counter.Extra();
            rtValue.Line1       = "Line1" + counter.Extra();
            rtValue.Line2       = "Line2" + counter.Extra();
            rtValue.Line3       = "Line3" + counter.Extra();
            rtValue.City        = "City" + counter.Extra();
            rtValue.State       = "XX";
            rtValue.Zip         = "12345";
            rtValue.CountryCode = "AA";

            return(rtValue);
        }
예제 #23
0
        /// <summary>
        /// Serialize a VendorAddress 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_VendorAddressCollection.xml");

                mock = CreateMockInstance(tm);
                TList <VendorAddress> mockCollection = new TList <VendorAddress>();
                mockCollection.Add(mock);

                EntityHelper.SerializeXml(mockCollection, fileName);

                Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found");
                System.Console.WriteLine("TList<VendorAddress> correctly serialized to a temporary file.");
            }
        }
예제 #24
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            VendorAddress objVendorAddress;


            if (dgvVendors.SelectedRows.Count == 0)
            {
                MessageBox.Show("No Customer selected!", "Job", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            else
            {
                objVendorAddress      = dgvVendors.CurrentRow.DataBoundItem as VendorAddress;
                SelectedVendorAddress = objVendorAddress;
                this.Dispose();
            }
        }
예제 #25
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                VendorAddress MasterEntity = (VendorAddress)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_VendorAddress SET ");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" Address=" + SysString.ToDBString(MasterEntity.Address) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" Tel=" + SysString.ToDBString(MasterEntity.Tel) + ",");
                UpdateBuilder.Append(" Name=" + SysString.ToDBString(MasterEntity.Name) + ",");
                UpdateBuilder.Append(" Attn=" + SysString.ToDBString(MasterEntity.Attn));

                UpdateBuilder.Append(" WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
        private void txtNo_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:
                try
                {
                    if (!string.IsNullOrEmpty(txtNo.Text))
                    {
                        switch (((ComboBoxItem)cmbAddressType.SelectedItem).Value)
                        {
                        case CUSTOMERVALUE:
                            var objCustomerAddress = new CustomerAddress(txtNo.Text);
                            mintCustomerOrVendorNumber = int.Parse(objCustomerAddress.CustomerNumber);
                            LoadCustomerAddresses();
                            break;

                        case VENDORVALUE:
                            var objVendorAddress = new VendorAddress(txtNo.Text);
                            mintCustomerOrVendorNumber = int.Parse(objVendorAddress.VendorNumber);
                            LoadVendorAddresses();
                            break;
                        }

                        txtNo.Text = mintCustomerOrVendorNumber.ToString();
                    }
                }
                catch
                {
                    switch (((ComboBoxItem)cmbAddressType.SelectedItem).Value)
                    {
                    case CUSTOMERVALUE:
                        MessageBox.Show("Customer " + txtNo.Text + " Not Found", "No Customer Found", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        break;

                    case VENDORVALUE:
                        MessageBox.Show("Vendor " + txtNo.Text + " Not Found", "No Vendor Found", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        break;
                    }
                }
                break;
            }
        }
        private void LoadVendorAddresses()
        {
            mobjVendorAddressList = VendorAddress.Search(mintCustomerOrVendorNumber.ToString());

            mintSelectedAddressIndex = -1;

            if (mobjVendorAddressList.Count > 0)
            {
                SelectVendorAddress(0);
                grpAddress.Enabled = true;
            }
            else
            {
                MessageBox.Show("No addresses found for Vendor!", "No Addresses Found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                lblAddrCt.Text     = "";
                grpAddress.Enabled = false;
            }
        }
예제 #28
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         VendorAddress    entity  = (VendorAddress)p_BE;
         VendorAddressCtl control = new VendorAddressCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
        public async Task <string> Update(int id, [FromBody] string value)
        {
            string UpdateResult        = "Success";
            bool   UpdateProcessOutput = false;

            try
            {
                VendorAddress VendorToUpdate = JsonConvert.DeserializeObject <VendorAddress>(value);
                VendorToUpdate.vendor_address_id = id;
                int updated_by = VendorToUpdate.updated_by;
                UpdateProcessOutput = await _VendorAddressRepo.Update(VendorToUpdate);

                var eventModel = new EventModel(vendorEventTableName)
                {
                    EventName   = vendor_address_updated,
                    EntityId    = VendorToUpdate.vendor_id,
                    RefrenceId  = id,
                    UserId      = updated_by,
                    EventNoteId = id
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EventName   = vendor_address_updated,
                    EntityId    = updated_by,
                    RefrenceId  = id,
                    UserId      = updated_by,
                    EventNoteId = id
                };
                await _eventRepo.AddEventAsync(userEvent);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in updating  vendor with message" + ex.Message);
                UpdateResult = "Failed";
            }
            if (!UpdateProcessOutput)
            {
                UpdateResult = "Creation failed due to reason: No specific reson";
            }
            return(UpdateResult);
        }
예제 #30
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         VendorAddress    entity  = (VendorAddress)p_BE;
         VendorAddressCtl control = new VendorAddressCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_VendorAddress,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
예제 #31
0
        private void GetVendors()
        {
            Cursor.Current     = Cursors.WaitCursor;
            dgvVendors.Visible = false;

            SortableSearchableBindingList <VendorAddress> objVendorAddressList = VendorAddress.Search(txtVendor.Text.Trim(),
                                                                                                      MINTMAXRECORDCOUNT, ((ComboBoxItem)cboSortSearch.SelectedItem).Value);

            if (objVendorAddressList.Count == 0)
            {
                MessageBox.Show(((ComboBoxItem)cboSortSearch.SelectedItem).Text + " " + txtVendor.Text + " not found!", "No Customer Found", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }

            Cursor.Current        = Cursors.Default;
            dgvVendors.Visible    = true;
            dgvVendors.DataSource = objVendorAddressList;
            dgvVendors.Refresh();
        }
예제 #32
0
        public static VendorAddress VendorAddress(int? counter)
        {
            var rtValue = new VendorAddress();
            rtValue.TypeCode = "tc" + counter.Extra();
            rtValue.Name = "Name" + counter.Extra();
            rtValue.Line1 = "Line1" + counter.Extra();
            rtValue.Line2 = "Line2" + counter.Extra();
            rtValue.Line3 = "Line3" + counter.Extra();
            rtValue.City = "City" + counter.Extra();
            rtValue.State = "XX";
            rtValue.Zip = "12345";
            rtValue.CountryCode = "AA";

            return rtValue;
        }
 /// <summary>
 /// There are no comments for VendorAddress in the schema.
 /// </summary>
 public void AddToVendorAddress(VendorAddress vendorAddress)
 {
     base.AddObject("VendorAddress", vendorAddress);
 }
 /// <summary>
 /// Create a new VendorAddress object.
 /// </summary>
 /// <param name="vendorID">Initial value of VendorID.</param>
 /// <param name="addressID">Initial value of AddressID.</param>
 /// <param name="modifiedDate">Initial value of ModifiedDate.</param>
 public static VendorAddress CreateVendorAddress(int vendorID, int addressID, global::System.DateTime modifiedDate)
 {
     VendorAddress vendorAddress = new VendorAddress();
     vendorAddress.VendorID = vendorID;
     vendorAddress.AddressID = addressID;
     vendorAddress.ModifiedDate = modifiedDate;
     return vendorAddress;
 }