public ActionResult Create(SupplierTable supplierTable)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            int userid = Convert.ToInt32(Convert.ToString(Session["UserID"]));

            supplierTable.UserID = userid;
            if (ModelState.IsValid)
            {
                var find = db.SupplierTables.Where(s => s.SupplierName == supplierTable.SupplierName && s.ContactNo == supplierTable.ContactNo).FirstOrDefault();
                if (find == null)
                {
                    db.SupplierTables.Add(supplierTable);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.Message = "Dostawca jest już zarejestrowany!";
                }
            }
            return(View(supplierTable));
        }
Beispiel #2
0
        private void FormSupplierEdit_Load(object sender, EventArgs e)
        {
            this.textBoxCredit.Text  = "0";
            this.textBoxVatRate.Text = "17";

            if (!m_isAdd)
            {
                this.buttonAdd.Enabled           = false;
                this.buttonSupplierGroup.Enabled = false;

                if (m_isEditSupplier)
                {
                    m_supplier = Supplier.getInctance().getSupplierInfoFromPkey(m_supplierPkey);
                }
                else
                {
                    m_supplierType    = SupplierType.getInctance().getSupplierTypeInfoFromPkey(m_supplierGroupPkey);
                    m_isSupplierGroup = true;
                }

                setPageActiveState();
                setPageActiveValue();
            }

            // 初始化区域下拉框值
            ComboBoxExtend.initComboBox(this.comboBoxArea, "BASE_AREA_LIST");
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            SupplierTable supplierTable = db.SupplierTables.Find(id);

            db.SupplierTables.Remove(supplierTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public virtual SupplierTable convertToSupplierTable(ProjectDBProperties prop)
        {
            SupplierTable obj = BlankResourceInitializer.createBlankSupplier(null);

            obj.DatabaseId = SupplierDatabaseId;
            if (DatabaseCreationDate == null)
            {
                obj.DatabaseCreationDate = 100L;                 //ResourceUtil.MISSING_DB_CREATE_DATE);
            }
            else
            {
                obj.DatabaseCreationDate = DatabaseCreationDate;
            }
            obj.Address       = quotationTable.Address;
            obj.Title         = quotationTable.CompanyName;
            obj.ContactPerson = quotationTable.ContactPerson;
            obj.GroupCode     = boqItemTable.GroupCode;
            obj.GekCode       = boqItemTable.GekCode;
            obj.Description   = boqItemTable.Description;
            obj.Notes         = boqItemTable.Notes;
            obj.EditorId      = DatabaseDBUtil.Properties.UserId;
            obj.PhoneNumber   = quotationTable.PhoneNumber;
            obj.MobileNumber  = quotationTable.MobileNumber;
            obj.Email         = quotationTable.Email;
            obj.Url           = quotationTable.Url;
            obj.Country       = quotationTable.Country;
            obj.City          = quotationTable.City;
            obj.StateProvince = quotationTable.StateProvince;
            obj.GeoLocation   = quotationTable.GeoLocation;
            obj.FaxNumber     = quotationTable.FaxNumber;
            obj.Performance   = "" + quotationTable.Performance;
            obj.ExtraCode1    = boqItemTable.ExtraCode1;
            obj.ExtraCode2    = boqItemTable.ExtraCode2;
            obj.ExtraCode3    = boqItemTable.ExtraCode3;
            obj.ExtraCode4    = boqItemTable.ExtraCode4;
            obj.ExtraCode5    = boqItemTable.ExtraCode5;
            obj.ExtraCode6    = boqItemTable.ExtraCode6;
            obj.ExtraCode7    = boqItemTable.ExtraCode7;
            obj.ExtraCode8    = boqItemTable.ExtraCode8;
            obj.ExtraCode9    = boqItemTable.ExtraCode9;
            obj.ExtraCode10   = boqItemTable.ExtraCode10;
            obj.CreateUserId  = quotationTable.EditorId;
            if (quotationTable.ReceivedDate != null)
            {
                obj.LastUpdate = quotationTable.ReceivedDate;
                obj.CreateDate = quotationTable.ReceivedDate;
            }
            else
            {
                obj.LastUpdate = DateTime.Now;
                obj.CreateDate = obj.LastUpdate;
            }
            obj.recalculate();

            return(obj);
        }
Beispiel #5
0
        private void buttonSelect_Click(object sender, EventArgs e)
        {
            FormBaseSupplier fbs = new FormBaseSupplier(true);

            fbs.ShowDialog();

            m_supplierPkey = fbs.getSelectRecordPkey();
            SupplierTable record = Supplier.getInctance().getSupplierInfoFromPkey(m_supplierPkey);

            this.textBoxSupplierName.Text = Convert.ToString(record.pkey) + "-" + record.name;
        }
 private static async Task InsertSupplierAsync(SupplierTable supplierTable)
 {
     await SupplierEntityBuilder.Create()
     .WithId(supplierTable.Id)
     .WithName(supplierTable.SupplierName)
     .WithSummary(supplierTable.Summary)
     .WithSupplierUrl(supplierTable.SupplierUrl)
     .WithAddress(supplierTable.Address)
     .Build()
     .InsertAsync();
 }
Beispiel #7
0
 public ActionResult Edit([Bind(Include = "SupplierID,SupplierName,UserID,ContactNo,Email,Description")] SupplierTable supplierTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplierTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.UserTables, "UserID", "UserName", supplierTable.UserID);
     return(View(supplierTable));
 }
Beispiel #8
0
        private static async Task InsertSupplierAsync(SupplierTable supplierTable)
        {
            var organisations = (await OrganisationEntity.FetchAllAsync().ConfigureAwait(false)).ToList();

            await SupplierEntityBuilder.Create()
            .WithId(supplierTable.Id)
            .WithOrganisation(organisations.First(o => o.Name == supplierTable.OrganisationName).Id)
            .WithName(supplierTable.Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);
        }
Beispiel #9
0
        private void addSupplier()
        {
            SupplierTable supplier = new SupplierTable();

            // 基本信息-基础信息
            supplier.supplierType = m_supplierGroupPkey;
            supplier.name         = this.textBoxName.Text.ToString();
            supplier.nameShort    = this.textBoxShortName.Text.ToString();
            supplier.mnemonicCode = this.textBoxMnemonicCode.Text.ToString();
            if (this.textBoxCredit.Text.ToString().Length == 0)
            {
                supplier.credit = 0;
            }
            else
            {
                supplier.credit = Convert.ToInt32(this.textBoxCredit.Text.ToString());
            }

            if (this.textBoxVatRate.Text.ToString().Length == 0)
            {
                supplier.varRate = Convert.ToInt32(this.textBoxVatRate.Text.ToString());
            }
            else
            {
                // 增值税税率默认为17%
                supplier.varRate = 17;
            }

            // 基础信息-银行信息
            supplier.bankName    = this.textBoxBankName.Text.ToString();
            supplier.bankAccount = this.textBoxBankAccount.Text.ToString();
            supplier.taxAccount  = this.textBoxTaxAccount.Text.ToString();

            // 联系方式
            supplier.area     = this.comboBoxArea.Text.ToString();
            supplier.contact  = this.textBoxContact.Text.ToString();
            supplier.tel      = this.textBoxTel.Text.ToString();
            supplier.fax      = this.textBoxFax.Text.ToString();
            supplier.homePage = this.textBoxHomePage.Text.ToString();
            supplier.email    = this.textBoxEmail.Text.ToString();
            supplier.address  = this.textBoxAddress.Text.ToString();
            supplier.zipCode  = this.textBoxZipCode.Text.ToString();
            supplier.note     = this.textBoxNote.Text.ToString();

            if (supplier.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("公司名称不能为空,请重新填写!");
                return;
            }

            Supplier.getInctance().insert(supplier);
        }
Beispiel #10
0
        // GET: SupplierTables/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SupplierTable supplierTable = db.SupplierTables.Find(id);

            if (supplierTable == null)
            {
                return(HttpNotFound());
            }
            return(View(supplierTable));
        }
Beispiel #11
0
        public void Initialice(string applicationPath, string applicationDataPath)
        {
            this.m_comLockObj          = Guid.NewGuid();
            this.m_applicationPath     = applicationPath;
            this.m_applicationDataPath = applicationDataPath;

            this.m_masterData = new Working.MasterData();
            this.m_supplier   = new Working.Supplier();
            this.m_position   = new Working.Positions();

            this.m_materialCategoryTable = BasicTable.OpenDataTable <MaterialCategoryTable>(applicationDataPath);
            this.m_manufacturerTable     = BasicTable.OpenDataTable <ManufacturerTable>(applicationDataPath);
            this.m_supplierTable         = BasicTable.OpenDataTable <SupplierTable>(applicationDataPath);
            this.m_positionsTable        = BasicTable.OpenDataTable <PositionsTable>(applicationDataPath);
        }
Beispiel #12
0
        // GET: SupplierTables/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SupplierTable supplierTable = db.SupplierTables.Find(id);

            if (supplierTable == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserID = new SelectList(db.UserTables, "UserID", "UserName", supplierTable.UserID);
            return(View(supplierTable));
        }
Beispiel #13
0
        private void panelPurchaseName_DoubleClick(object sender, EventArgs e)
        {
            if (!this.textBoxPurchaseName.Visible)
            {
                this.labelPurchaseName.Visible   = false;
                this.textBoxPurchaseName.Visible = true;
            }
            else
            {
                FormBaseSupplier fbs = new FormBaseSupplier(true);
                fbs.ShowDialog();

                m_supplierPkey = fbs.getSelectRecordPkey();
                SupplierTable record = Supplier.getInctance().getSupplierInfoFromPkey(m_supplierPkey);
                this.textBoxPurchaseName.Text    = record.name;
                this.textBoxPurchaseName.Visible = true;
            }
        }
        // GET: SupplierTables/Details/5
        public ActionResult Details(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SupplierTable supplierTable = db.SupplierTables.Find(id);

            if (supplierTable == null)
            {
                return(HttpNotFound());
            }
            return(View(supplierTable));
        }
        public ActionResult Edit(SupplierTable supplierTable)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            int userid = Convert.ToInt32(Convert.ToString(Session["UserID"]));

            supplierTable.UserID = userid;
            if (ModelState.IsValid)
            {
                db.Entry(supplierTable).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.UserID = new SelectList(db.UserTables, "UserID", "UserName", supplierTable.UserID);
            return(View(supplierTable));
        }
Beispiel #16
0
        private void noForbid_Click(object sender, EventArgs e)
        {
            SortedDictionary <int, SupplierTable> forbidSupplierList = Supplier.getInctance().getAllForbidSupplierInfo();
            ArrayList forbidSuppliers = new ArrayList();

            foreach (KeyValuePair <int, SupplierTable> index in forbidSupplierList)
            {
                SupplierTable supplier = new SupplierTable();
                supplier = index.Value;

                forbidSuppliers.Add(Convert.ToString(supplier.pkey));
                forbidSuppliers.Add(Convert.ToString(supplier.name));
            }

            FormNoForbid fnfs = new FormNoForbid(forbidSuppliers, "供应商反禁用", ForbidDataType.Supplier);

            fnfs.ShowDialog();
            updateDataGridView(getCurrentNodeAllChildNodesSupplier());
        }
        // GET: SupplierTables/Edit/5
        public ActionResult Edit(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserID"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SupplierTable supplierTable = db.SupplierTables.Find(id);

            if (supplierTable == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserID = new SelectList(db.UserTables, "UserID", "UserName", supplierTable.UserID);
            return(View(supplierTable));
        }
Beispiel #18
0
 private void buttonSelect_Click(object sender, EventArgs e)
 {
     if (m_userInterfaceValue.isAccountReceivable)
     {
         FormBaseCustomer fbs = new FormBaseCustomer(true);
         fbs.ShowDialog();
         m_selectRecordPkey = fbs.getSelectRecordPkey();
         CustomerTable record = Customer.getInctance().getCustomerInfoFromPkey(m_selectRecordPkey);
         this.textBoxName.Text = Convert.ToString(record.pkey) + "-" + record.name;
     }
     else
     {
         FormBaseSupplier fbs = new FormBaseSupplier(true);
         fbs.ShowDialog();
         m_selectRecordPkey = fbs.getSelectRecordPkey();
         SupplierTable record = Supplier.getInctance().getSupplierInfoFromPkey(m_selectRecordPkey);
         this.textBoxName.Text = Convert.ToString(record.pkey) + "-" + record.name;
     }
 }
Beispiel #19
0
 private void panelSourceOrderNumber_Click(object sender, EventArgs e)
 {
     if (comboBoxPaymentType.Text.IndexOf("应付") != -1)
     {
         FormInitAccountReceivabler fiar = new FormInitAccountReceivabler(false, true);
         fiar.ShowDialog();
         m_supplierData = Supplier.getInctance().getSupplierInfoFromPkey(fiar.getCustomerOrSupplierID());
         this.textBoxSourceOrderNumber.Text     = m_supplierData.name;
         this.textBoxSourceOrderNumber.ReadOnly = true;
     }
     else if (comboBoxPaymentType.Text.IndexOf("采购入库") != -1)
     {
         FormPurchaseOrderSequence fpos = new FormPurchaseOrderSequence(FormPurchaseOrderSequence.OrderType.PurchaseIn, true);
         fpos.ShowDialog();
         this.textBoxSourceOrderNumber.Text = fpos.getSelectOrderNumber();
     }
     else
     {
         this.textBoxSourceOrderNumber.Text = "";
     }
 }
Beispiel #20
0
        private void updateDataGridView(SortedDictionary <int, SupplierTable> supplierList)
        {
            m_supplierRecordCount            = supplierList.Count;
            this.labelSupplierGroupName.Text = "[" + m_supplierGroupName + "]供应商共计[" + Convert.ToString(m_supplierRecordCount) + "]条记录";

            SortedDictionary <int, ArrayList> suppliers = new SortedDictionary <int, ArrayList>();

            for (int i = 0; i < supplierList.Count; i++)
            {
                SupplierTable supplier = new SupplierTable();
                supplier = (SupplierTable)supplierList[i];

                ArrayList temp = new ArrayList();

                temp.Add(supplier.pkey);
                temp.Add(supplier.supplierType);
                temp.Add(supplier.name);
                temp.Add(supplier.nameShort);
                temp.Add(supplier.mnemonicCode);
                temp.Add(supplier.area);
                temp.Add(supplier.credit);
                temp.Add(supplier.varRate);
                temp.Add(supplier.contact);
                temp.Add(supplier.tel);
                temp.Add(supplier.fax);
                temp.Add(supplier.mobilePhone);
                temp.Add(supplier.email);
                temp.Add(supplier.homePage);
                temp.Add(supplier.address);
                temp.Add(supplier.zipCode);
                temp.Add(supplier.bankName);
                temp.Add(supplier.bankAccount);
                temp.Add(supplier.taxAccount);
                temp.Add(supplier.note);

                suppliers.Add(i, temp);
            }

            m_dataGridViewExtend.initDataGridViewData(suppliers, 3);
        }
Beispiel #21
0
        private SortedDictionary <int, SupplierTable> getCurrentNodeAllChildNodesSupplier()
        {
            SortedDictionary <int, SupplierTable> supplierList    = new SortedDictionary <int, SupplierTable>();
            SortedDictionary <int, int>           childNodeValues = SupplierOrgStruct.getInctance().getAllChildNodeValue(m_supplierGroupPkey);

            if (!childNodeValues.ContainsKey(m_supplierGroupPkey))
            {
                childNodeValues.Add(m_supplierGroupPkey, m_supplierGroupPkey);
            }

            foreach (KeyValuePair <int, int> index in childNodeValues)
            {
                SortedDictionary <int, SupplierTable> temp = Supplier.getInctance().getSupplierInfoFromSupplierType(index.Value);

                foreach (KeyValuePair <int, SupplierTable> i in temp)
                {
                    SupplierTable supplier = new SupplierTable();
                    supplierList.Add(supplierList.Count, (SupplierTable)i.Value);
                }
            }

            return(supplierList);
        }
        public SupplierViewModel()
        {
            DisplayName = null;
            Address     = null;
            Phone       = null;
            ContractDay = DateTime.Today;

            loadUserCurrentLogin();
            ListSupplier = new List <SupplierTable>(DataProvider.Ins.Entities.SupplierTable);

            LoadEditCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadDialogAccountEdit(); });

            AddCommand = new RelayCommand <object>((p) =>
            {
                var Supplier = DataProvider.Ins.Entities.SupplierTable.Where(x => x.DisplayName == DisplayName);

                if (string.IsNullOrEmpty(DisplayName) || string.IsNullOrEmpty(Phone) || string.IsNullOrEmpty(Address) || ContractDay == null)
                {
                    return(false);
                }

                if (Supplier.Count() != 0 || Supplier == null)
                {
                    return(false);
                }

                return(true);
            },
                                                   (p) =>
            {
                var newSupplier         = new SupplierTable();
                newSupplier.DisplayName = DisplayName;
                newSupplier.Address     = Address;
                newSupplier.Phone       = Phone;
                newSupplier.ContractDay = ContractDay;

                DataProvider.Ins.Entities.SupplierTable.Add(newSupplier);
                DataProvider.Ins.Entities.SaveChanges();
                ListSupplier = new List <SupplierTable>(DataProvider.Ins.Entities.SupplierTable);

                DisplayName   = null;
                Address       = null;
                Phone         = null;
                ContractDay   = DateTime.Today;
                SelectedItems = null;

                IsActiveSnackBar = true;
                Message          = "Thêm Thành Công!";

                System.Timers.Timer timer = new System.Timers.Timer();
                timer.Interval            = 3000;
                timer.Enabled             = true;
                timer.Elapsed            += ShowSnackBar;
                timer.Start();
            });

            ConfirmEditCommand = new RelayCommand <Button>((p) =>
            {
                var Supplier = DataProvider.Ins.Entities.SupplierTable.Where(x => x.DisplayName == DisplayName);

                if (string.IsNullOrEmpty(DisplayName) || string.IsNullOrEmpty(Phone) || string.IsNullOrEmpty(Address) || ContractDay == null)
                {
                    return(false);
                }

                if (Supplier == null || SelectedItems == null)
                {
                    return(false);
                }

                return(true);
            },
                                                           (p) =>
            {
                SupplierTable EditItem = DataProvider.Ins.Entities.SupplierTable.Where(x => x.ID == SelectedItems.ID).SingleOrDefault();
                if (EditItem == null)
                {
                    return;
                }
                EditItem.DisplayName = DisplayName;
                EditItem.Address     = Address;
                EditItem.ContractDay = ContractDay;
                EditItem.Phone       = Phone;

                DataProvider.Ins.Entities.SaveChanges();
                ListSupplier = new List <SupplierTable>(DataProvider.Ins.Entities.SupplierTable);

                DisplayName   = null;
                Address       = null;
                Phone         = null;
                ContractDay   = DateTime.Today;
                SelectedItems = null;

                IsActiveSnackBar = true;
                Message          = "Sửa Thành Công!";

                DialogHost.CloseDialogCommand.Execute(null, null);
                System.Timers.Timer timer = new System.Timers.Timer();
                timer.Interval            = 3000;
                timer.Enabled             = true;
                timer.Elapsed            += ShowSnackBar;
                timer.Start();
            });

            DeleteCommand = new RelayCommand <object>((p) =>
            {
                var Supplier = DataProvider.Ins.Entities.SupplierTable.Where(x => x.DisplayName == DisplayName);

                if (string.IsNullOrEmpty(DisplayName) || string.IsNullOrEmpty(Phone) || string.IsNullOrEmpty(Address) || ContractDay == null)
                {
                    return(false);
                }

                if (Supplier == null || SelectedItems == null)
                {
                    return(false);
                }

                return(true);
            },
                                                      (p) =>
            {
                SupplierTable DeleteItem = DataProvider.Ins.Entities.SupplierTable.Where(x => x.ID == SelectedItems.ID).SingleOrDefault();

                var listProduct = DataProvider.Ins.Entities.ProductTable.Where(x => x.ID_Supplier == SelectedItems.ID);

                if (DeleteItem == null)
                {
                    return;
                }

                if (listProduct.Count() > 0)
                {
                    DisplayName   = null;
                    Address       = null;
                    Phone         = null;
                    ContractDay   = DateTime.Today;
                    SelectedItems = null;
                    LoadDialogErrorDelete();
                    return;
                }

                DataProvider.Ins.Entities.SupplierTable.Remove(DeleteItem);
                DataProvider.Ins.Entities.SaveChanges();

                ListSupplier = new List <SupplierTable>(DataProvider.Ins.Entities.SupplierTable);

                DisplayName   = null;
                Address       = null;
                Phone         = null;
                ContractDay   = DateTime.Today;
                SelectedItems = null;

                IsActiveSnackBar = true;
                Message          = "Xóa Thành Công!";

                System.Timers.Timer timer = new System.Timers.Timer();
                timer.Interval            = 3000;
                timer.Enabled             = true;
                timer.Elapsed            += ShowSnackBar;
                timer.Start();
            });

            SearchCommand = new RelayCommand <object>((p) =>
            {
                return(true);
            },
                                                      (p) =>
            {
                if (SearchTerm == null)
                {
                    return;
                }

                ListSupplier = new List <SupplierTable> (DataProvider.Ins.Entities.SupplierTable.Where(
                                                             x => x.DisplayName.ToLower().Contains(SearchTerm) ||
                                                             x.Address.ToLower().Contains(SearchTerm) || x.ContractDay.ToString().ToLower().Contains(SearchTerm) ||
                                                             x.Phone.ToLower().Contains(SearchTerm)
                                                             ));
            });

            EditCommand = new RelayCommand <object>((p) =>
            {
                return(true);
            },
                                                    (p) =>
            {
                LoadDialogEdit();
            });
        }