コード例 #1
0
 public static List<sp_ViewSupplierDetailsResult> displaysupdetails()
 {
     db = new db_MiletecDataContext();
     List<sp_ViewSupplierDetailsResult> list1 = db.sp_ViewSupplierDetails().ToList<sp_ViewSupplierDetailsResult>();
     return list1;
 
 }
コード例 #2
0
        public static List<sp_viewproductResult> displayProductDetails()
        {
            db = new db_MiletecDataContext();
            List<sp_viewproductResult> list2 = db.sp_viewproduct().ToList<sp_viewproductResult>();
            return list2;

        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string user;

            if (txtSupplierName.Text != "Supplier Name" && txtAddress.Text != "Address" && txtContact1.Text != "Contact No.1" && txtContact2.Text != "Contact No.2" &&
                txtContactPerson.Text != "Contact Person")
            {
                db   = new db_MiletecDataContext();
                user = Form1.UserID.ToString();
                db.sp_SupplierDetails(user, txtSupplierID.Text, txtSupplierName.Text, txtAddress.Text,
                                      int.Parse(txtContact1.Text), int.Parse(txtContact2.Text), txtContactPerson.Text);
                db.SubmitChanges();
                MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                GenID(txtSupplierID);
                Display();
                txtSupplierName.Text  = "Supplier Name";
                txtAddress.Text       = "Address";
                txtContact1.Text      = "Contact No.1";
                txtContact2.Text      = "Contact No.2";
                txtContactPerson.Text = "Contact Person";
            }
            else
            {
                MessageBox.Show("Please fill up everything first.", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
        public static string GenReplacementID(TextBox txtReplacementNo)
        {
            int    iicount = 0;
            string ID      = "";

            db = new db_MiletecDataContext();
            var query = db.sp_generate_DandR_ID();

            foreach (sp_generate_DandR_IDResult count in query)
            {
                iicount = count.count.Value;
                iicount = iicount++;
            }
            ++iicount;
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "ReplacementNo-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "ReplacementNo-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "ReplacementNo-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtReplacementNo.Text = ID);
        }
コード例 #5
0
        public static string GendelID(TextBox txtDeliveryNo)
        {
            int    iicount = 0;
            string ID      = "";

            db = new db_MiletecDataContext();
            var query = db.sp_getcustdeliveryID();

            foreach (sp_getcustdeliveryIDResult count in query)
            {
                iicount = count.count.Value;
                iicount = iicount++;
            }
            ++iicount;
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "DeliveryID-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "DeliveryID-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "DeliveryID-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtDeliveryNo.Text = ID);
        }
コード例 #6
0
        public static string GencusID(TextBox txtcustomerid)
        {
            int    iicount = 0;
            string ID      = "";

            db = new db_MiletecDataContext();
            var query = db.sp_genCustomerID();

            foreach (sp_genCustomerIDResult count in query)
            {
                //count customer registered in the database
                iicount = count.count.Value;
                //increment
                iicount = iicount++;
            }

            ++iicount;
            //substring from lengths 1-2, padleft 4-2
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "CustomerID-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "CustomerID-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "CustomerID-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtcustomerid.Text = ID);
        }
コード例 #7
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            string user;

            //if all fields are filled
            if (txtcustomername.Text != "Customer Name" && txtaddress.Text != "Address" && txtcontactno1.Text != "Contactno.1" && txtcontactno2.Text != "Contactno.1")
            {
                db   = new db_MiletecDataContext();
                user = Form1.UserID.ToString();
                db.sp_insert_customerdetails(user, txtcustomerid.Text, txtcustomername.Text, txtaddress.Text,
                                             txtcontactno1.Text, txtcontactno2.Text);
                db.SubmitChanges();
                MessageBox.Show("Save Successfuly!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                dgvcustomerdetails.DataSource = clsrepository.customer();
                txtcustomername.Text          = "Customer Name";
                txtaddress.Text    = "Address";
                txtcontactno1.Text = "Contactno.1";
                txtcontactno2.Text = "Contactno.2";
                GencusID(txtcustomerid);
            }
            //if some fields are empty
            else
            {
                MessageBox.Show("Please fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     db = new db_MiletecDataContext();
     db.sp_update_stock_price(double.Parse(txtPrice.Text), txtProductID.Text);
     db.SubmitChanges();
     dgvviewstocks.DataSource = clsrepository.dissock();
 }
コード例 #9
0
        public static List<sp_view_customerdetailsResult> customer()
        {

            db = new db_MiletecDataContext();
            List<sp_view_customerdetailsResult> cust = db.sp_view_customerdetails().ToList<sp_view_customerdetailsResult>();
            return cust;
        }
コード例 #10
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();

            if (txtQuantityOrder.Text != "Quantity Order" && txtShowSupplier.Text != "Supplier ID" && cmbProductID.Text != "" && txtProductName.Text != "Product Name")
            {
                if (int.Parse(txtQuantityOrder.Text) <= 0)
                {
                    MessageBox.Show("fill up quantity first!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Successfully Added!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    dgvOrderDetails.Rows.Add(cmbProductID.Text, txtProductName.Text, int.Parse(txtQuantityOrder.Text));
                    db.sp_OrderDetails(txtOrderID.Text, cmbProductID.Text, txtProductName.Text, int.Parse(txtQuantityOrder.Text), "To Deliver");
                    db.sp_Products(txtSupplierID.Text, cmbProductID.Text, txtProductName.Text, int.Parse(txtQuantityOrder.Text));
                    db.SubmitChanges();
                    cmbProductID.SelectedItem = null;
                    lblproductid.Text         = "Product ID";
                    txtProductName.Text       = "Product Name";
                    txtQuantityOrder.Text     = "Quantity Order";
                    btnPurchase.Enabled       = true;
                }
            }
            else
            {
                MessageBox.Show("Please fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #11
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     //Saves into the database
     db = new db_MiletecDataContext();
     if (dgvProductDetails.SelectedColumns.ToString() != null && txtcusID.Text != "")
     {
         db.sp_update_DeliveryCustomer(txtDeliveryNo.Text, DateTime.Parse(txtdatetodeliver.Text), txttimetodeliver.Text);
         db.SubmitChanges();
         MessageBox.Show("Successfuly saved!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         if (dgvProductDetails.Rows.Count == 0)
         {
             db.sp_update_CustomerDeilveryStatus(txttransactionid.Text, "Pending...");
             dgvDeliverditems.Rows.Clear();
             txttransactionid.Text = "Transaction ID";
             txtDateOrdered.Text   = "Date Ordered";
             txtcusID.Text         = "Customer ID";
             txtPreparedBy.Text    = "Prepared By";
             txtdatetodeliver.Text = "Date to Deliver";
             GendelID(txtDeliveryNo);
         }
     }
     else
     {
         MessageBox.Show("You must fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #12
0
 private void btnProceed_Click(object sender, EventArgs e)
 {
     db = new db_MiletecDataContext();
     db.sp_Order(txtOrderID.Text, txtSupplierID.Text, DateTime.Parse(dtpProductDetails.Text), txtOrderBy.Text, "To Deliver");
     gbSupplierDetails.Hide();
     gbProduct_Details.Show();
 }
コード例 #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string user;

            if (txtSupplierName.Text != "" && txtAddress.Text != "" && txtContact1.Text != "" && txtContact2.Text != "" &&
                txtContactPerson.Text != "")
            {
                db   = new db_MiletecDataContext();
                user = Form1.UserID.ToString();
                db.sp_SupplierDetails(user, txtSupplierID.Text, txtSupplierName.Text, txtAddress.Text,
                                      int.Parse(txtContact1.Text), int.Parse(txtContact2.Text), txtContactPerson.Text);
                db.SubmitChanges();
                MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                dgvsupplierdetails.DataSource = clsrepository.displaysupdetails();
                if (dgvsupplierdetails.Rows.Count == 0)
                {
                    btnProceed.Enabled = false;
                }
                else
                {
                    btnProceed.Enabled = true;
                }
            }
            else
            {
                MessageBox.Show("Please fill up everything first!!");
            }
        }
コード例 #14
0
 public static List<sp_view_stockResult> dissock()
 {
     db = new db_MiletecDataContext();
     List<sp_view_stockResult> disstock = db.sp_view_stock().ToList<sp_view_stockResult>();
     return disstock;
 
 }
コード例 #15
0
        public static string GenID(TextBox txtSupplierID)
        {
            int    iicount = 0;
            string ID      = "";

            db = new db_MiletecDataContext();
            var query = db.sp_GetSupplierDetails();

            foreach (sp_GetSupplierDetailsResult count in query)
            {
                iicount = count.Count.Value;
                iicount = iicount++;
            }
            ++iicount;
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "SupplierID-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "SupplierID-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "SupplierID-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtSupplierID.Text = ID);
        }
コード例 #16
0
        public static List<sp_displayCusdetailsResult> dispcust()
        {
            db = new db_MiletecDataContext();
            List<sp_displayCusdetailsResult> dispcust = db.sp_displayCusdetails().ToList<sp_displayCusdetailsResult>();
            return dispcust;

        }
コード例 #17
0
        public static void deletecus(tblcustomerdetail tbl)
        {
            db = new db_MiletecDataContext();
            db.sp_deleteCustomerdetails(tbl.CustomerID);


        }
コード例 #18
0
        public static string GenerateUserID(TextBox txtUserStaffID)
        {
            int    iicount = 0;
            string ID      = "";

            db = new db_MiletecDataContext();
            var query = db.sp_Get_User_ID();

            foreach (sp_Get_User_IDResult count in query)
            {
                iicount = count.Count.Value;
                iicount = iicount - 1;
            }
            ++iicount;
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "User-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "User-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "User-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtUserStaffID.Text = ID);
        }
コード例 #19
0
 private void frm_Customer_Details_Load(object sender, EventArgs e)
 {
     db = new db_MiletecDataContext();
     //display customer information
     dgvcustomerdetails.DataSource = clsrepository.customer();
     //auto-generate customer Id during form load
     GencusID(txtcustomerid);
 }
コード例 #20
0
        public static List<sp_view_customertrandetailsResult> customertransaction()
        {
            db = new db_MiletecDataContext();
            List<sp_view_customertrandetailsResult> custtransdetails = db.sp_view_customertrandetails().ToList<sp_view_customertrandetailsResult>();
            return custtransdetails;


        }
コード例 #21
0
        private void btnReplace_Click(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            if (txtNoofDamages.Text != "Damages (Quanity)" && txtDeliveryNo.Text != "Delivery No." && txtTransactionID.Text != "Transaction ID")
            {
                var query_StockQty = db.sp_RetrieveStocksQuantity(txtproductid.Text, productName);
                foreach (sp_RetrieveStocksQuantityResult entry in query_StockQty.ToList())
                {
                    productID  = entry.productid.ToString();
                    qtyLeft    = int.Parse(entry.availqty.ToString());
                    qtydamages = qtyLeft - int.Parse(txtNoofDamages.Text);

                    if (txtproductid.Text == productID)
                    {
                        db.sp_Update_StocksQty(txtproductid.Text, qtydamages);
                    }
                }

                if (qtyLeft >= int.Parse(txtNoofDamages.Text))
                {
                    if (Convert.ToInt32(txtNoofDamages.Text) > Convert.ToInt32(dgvTransactionDetails.CurrentRow.Cells[4].Value.ToString()))
                    {
                        MessageBox.Show("Quantity is larger than the ordered quantity");
                    }
                    else
                    {
                        MessageBox.Show("Damaged product replaced!!", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);


                        db.sp_insert_DamagesAndReplacement(txtReplacementNo.Text, txtTransactionID.Text, txtDeliveryNo.Text, txtproductid.Text, productName, DateTime.Now, int.Parse(txtNoofDamages.Text));
                        dgvReplacements.Rows.Add(txtproductid.Text, productName, txtNoofDamages.Text);
                    }
                }


                else if (qtyLeft < int.Parse(txtNoofDamages.Text))
                {
                    var query_StockQty1 = db.sp_RetrieveStocksQuantity(txtproductid.Text, productName);
                    foreach (sp_RetrieveStocksQuantityResult entry in query_StockQty1.ToList())
                    {
                        productID  = entry.productid.ToString();
                        qtyLeft    = int.Parse(entry.availqty.ToString());
                        qtydamages = qtyLeft + int.Parse(txtNoofDamages.Text);

                        if (txtproductid.Text == productID)
                        {
                            db.sp_Update_StocksQty(txtproductid.Text, qtydamages);
                        }
                    }
                    MessageBox.Show("Low Stocks");
                }
            }
            else
            {
                MessageBox.Show("Please fill up everything first!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #22
0
        public static List<sp_viewDeliveryResult> displayDelivery()
        {
            db = new db_MiletecDataContext();

            List<sp_viewDeliveryResult> list4 = db.sp_viewDelivery().ToList<sp_viewDeliveryResult>();
            return list4;


        }
コード例 #23
0
        private void frmViewUsers_Load(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            var query = db.sp_view_User();

            foreach (sp_view_UserResult list in query)
            {
                dgvViewUsers.DataSource = db.sp_view_User().ToList <sp_view_UserResult>();
            }
        }
コード例 #24
0
        public void Display()
        {
            db = new db_MiletecDataContext();
            var display = db.sp_ViewSupplierDetails();

            foreach (sp_ViewSupplierDetailsResult list in display)
            {
                dgvsupplierdetails.DataSource = db.sp_ViewSupplierDetails().ToList <sp_ViewSupplierDetailsResult>();
            }
        }
コード例 #25
0
        private void btnView_Click(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            tblcustomertrans_detail details = new tblcustomertrans_detail();

            details.transactionid = transDetails;
            if (transDetails == details.transactionid)
            {
                dgvTransactionDetails.DataSource = db.sp_view_TransactionDetails(transDetails);
            }
        }
コード例 #26
0
        private void txtDeliveryNo_TextChanged(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            tblCustomerDeliveryDetail getId = new tblCustomerDeliveryDetail();

            getId.DeliveryNo = txtDeliveryNo.Text;
            if (txtDeliveryNo.Text == getId.DeliveryNo)
            {
                dgvTransactionDetails.DataSource = db.sp_view_CustomerDeliveryDetails(txtDeliveryNo.Text);
            }
        }
コード例 #27
0
        private void btnShowDetails_Click(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            tblDeliveryDetail del = new tblDeliveryDetail();

            del.DeliveryNo = deliveryNo;
            if (deliveryNo == del.DeliveryNo)
            {
                dgvDeliveryDetails.DataSource = db.sp_view_DeliveryDetails(deliveryNo);
            }
        }
コード例 #28
0
        private void btnViewDetails_Click(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            tblCustomerDelivery delNo = new tblCustomerDelivery();

            delNo.DeliveryID = deliveryNo;
            if (deliveryNo == delNo.DeliveryID)
            {
                dgvDeliveryDetails.DataSource = db.sp_view_CustomerDeliveryDetails(deliveryNo);
            }
        }
        private void btnview_Click(object sender, EventArgs e)
        {
            db = new db_MiletecDataContext();
            tblOrderDetail orders = new tblOrderDetail();

            orders.OrderID = orderID;
            if (orderID == orders.OrderID)
            {
                dvgviewdetails.DataSource = db.sp_view_OrderDetails(orderID);
            }
        }
コード例 #30
0
        private void txttransactionid_TextChanged(object sender, EventArgs e)
        {
            //if the transaction was selected to be delivered, display transaction details
            db = new db_MiletecDataContext();
            tblcustomertrans_detail getId = new tblcustomertrans_detail();

            getId.transactionid = txttransactionid.Text;
            if (txttransactionid.Text == getId.transactionid)
            {
                dgvProductDetails.DataSource = db.sp_display_customerDetails(txttransactionid.Text);
            }
        }