static Admin()
        {
            // Initialize the dataset
            dsSale = new SalesDataset();

            // Initialize the table adapters
            receiptTableAdapter daSales = new receiptTableAdapter();

            try
            {
                // Fill the data adapter with data from the dataset
                daSales.Fill(dsSale.receipt);
            }
            catch { }
        }
Exemple #2
0
        static SalesNew()
        {
            dsAddSale = new EmmasDataSet();
            receiptTableAdapter    daReceipt   = new receiptTableAdapter();
            orderLineTableAdapter  daOrderLine = new orderLineTableAdapter();
            salesInvenTableAdapter daInventory = new salesInvenTableAdapter();

            try
            {
                daReceipt.Fill(dsAddSale.receipt);
                daOrderLine.Fill(dsAddSale.orderLine);
                daInventory.Fill(dsAddSale.salesInven);
            }
            catch { }
        }
        static salesUpdate()
        {
            //load data at the beginning of the session
            dsEmma = new EmmasDataSet();
            receiptTableAdapter      daReceipt   = new receiptTableAdapter();
            orderLineTableAdapter    daOrderLine = new orderLineTableAdapter();
            orderProductTableAdapter daInventory = new orderProductTableAdapter();

            try
            {
                daReceipt.Fill(dsEmma.receipt);
                daOrderLine.Fill(dsEmma.orderLine);
                daInventory.Fill(dsEmma.orderProduct);
            }
            catch { }
        }
Exemple #4
0
        static Admin()
        {
            // Initialize the dataset
            dsSale   = new ReceiptDataSet();
            dsWeekly = new WeeklyReviewDataSet();

            // Initialize the table adapters
            receiptTableAdapter      daSales  = new receiptTableAdapter();
            WeeklyReviewTableAdapter daWeekly = new WeeklyReviewTableAdapter();

            try
            {
                // Fill the data adapter with data from the dataset
                daSales.Fill(dsSale.receipt);
            }
            catch { }
        }
        private void Save()
        {
            receiptTableAdapter   daReceipt   = new receiptTableAdapter();
            orderLineTableAdapter daOrderLine = new orderLineTableAdapter();

            try
            {
                daReceipt.Update(dsEmma.receipt);
                daOrderLine.Update(dsEmma.orderLine);
                dsEmma.AcceptChanges();
                this.lblSave.Text = "Sale has been updated successfully.";
            }
            catch
            {
                dsEmma.RejectChanges();
                this.lblSave.Text = "Unable to add sale - All changes have been rejected.";
            }
        }
Exemple #6
0
 private void BtnSaveUser_Click(object sender, EventArgs e)
 {
     try
     {
         if (TxtAdvance.Text == "" || TxtDiscount.Text == "" || TxtTotal.Text == "")
         {
             CommonFunctions.ShowError(this, "Fields cannot be empty");
         }
         else
         {
             //technovisionDataSet.receiptDataTable receiptT = new technovisionDataSet.receiptDataTable();
             technovisionDataSetTableAdapters.receiptTableAdapter tt = new receiptTableAdapter();
             if (int.Parse(tt.getReceiptCountByOrder(TxtOrderNo.Text, "SPEC").ToString()) == 0 || int.Parse(tt.getReceiptCountByOrder(TxtOrderNo.Text, "SPEC").ToString()) >= 2)
             {
                 CommonFunctions.ShowError(this, "You can not update the 'PAYMENT DETAILS' because there is two or more payments to this order. You can only update order when there was one payment.But Other details such as Diognosis Details, other Order details Except Payment Details will update as normally...");
                 spectaclesBindingSource.EndEdit();
                 spectaclesTableAdapter.Update(technovisionDataSet);
                 this.spectaclesTableAdapter.Fill(this.technovisionDataSet.spectacles);
                 CommonFunctions.ShowSuccess(this, "Successfully Changed Diognosis Details and other Order details...");
                 CommonFunctions.WriteUserLog(Session.Username, "Edited order number" + TxtOrderNo.Text + "...Critical");
                 new UI_ORDER_LIST().Show();
                 this.Dispose();
             }
             else if (int.Parse(tt.getReceiptCountByOrder(TxtOrderNo.Text, "SPEC").ToString()) == 1)
             {
                 tt.UpdatePaymentAmountByOrder(double.Parse(TxtAdvance.Text), TxtOrderNo.Text, "SPEC");
                 spectaclesBindingSource.EndEdit();
                 spectaclesTableAdapter.Update(technovisionDataSet);
                 this.spectaclesTableAdapter.Fill(this.technovisionDataSet.spectacles);
                 CommonFunctions.ShowSuccess(this, "Successfully Changed edit Details...");
                 CommonFunctions.WriteUserLog(Session.Username, "Edited order number" + TxtOrderNo.Text + "...Critical");
                 new UI_ORDER_LIST().Show();
                 this.Dispose();
             }
         }
     }
     catch (Exception ex)
     {
         CommonFunctions.ShowError(this, "Error occurred. error - " + ex.ToString());
         CommonFunctions.WriteToErrorLog(ex.Message.ToString());
     }
 }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            {
                receiptTableAdapter daSales = new receiptTableAdapter();
                try
                {
                    daSales.Fill(dsSales.receipt);
                }
                catch { }

                foreach (DataRow r in dsSales.receipt)
                {
                    MakeTable(r);
                }
            }
        }
Exemple #8
0
        private void Save()
        {
            receiptTableAdapter   daReceipt   = new receiptTableAdapter();
            orderLineTableAdapter daOrderLine = new orderLineTableAdapter();

            try
            {
                daReceipt.Update(dsAddSale.receipt);
                daOrderLine.Update(dsAddSale.orderLine);
                dsAddSale.AcceptChanges();
                this.lblSave.Text = "Sale has been added successfully.";
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Sale has been added successfully." + "');", true);
            }
            catch
            {
                dsAddSale.RejectChanges();
                this.lblSave.Text = "Unable to add sale - All changes have been rejected.";
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Unable to add sale - All changes have been rejected." + "');", true);
            }
        }
Exemple #9
0
        static Purchase()
        {
            receiptTableAdapter daReceipt = new receiptTableAdapter();

            daReceipt.Fill(dsReceipt.receipt);
            employeeTableAdapter daEmployee = new employeeTableAdapter();

            daEmployee.Fill(dsReceipt.employee);
            productTableAdapter daProducts = new productTableAdapter();

            productTable = daProducts.GetData();
            order_lineTableAdapter daLine = new order_lineTableAdapter();

            daLine.Fill(dsReceipt.order_line);
            service_orderTableAdapter daService = new service_orderTableAdapter();

            daService.Fill(dsReceipt.service_order);
            equipmentTableAdapter daEqu = new equipmentTableAdapter();

            daEqu.Fill(dsReceipt.equipment);
        }
Exemple #10
0
        protected void submit_Click(object sender, EventArgs e)
        {
            DataRow r = dsReceipt.receipt.NewRow();

            r["custID"]    = ListBox2.SelectedValue;
            r["empID"]     = dsReceipt.employee.Select("empLogin = '******'")[0]["id"];
            r["ordDate"]   = DateTime.Now;
            r["paymentID"] = ddlPayment.SelectedValue;
            dsReceipt.receipt.Rows.Add(r);
            object         adapter    = null;
            List <DataRow> ChildRows  = new List <DataRow>();
            DataTable      childTable = null;

            if (Mode == PageMode.Sale)
            {
                childTable = dsReceipt.order_line;
                for (int i = 0; i < selectedProducts?.Rows.Count; i++)
                {
                    if (Convert.ToInt32(Request.Form["ctl00$MainContent$gvSelectedProductsSales$ctl0" + (i + 2).ToString() + "$TextBox1"]) > 0)
                    {
                        DataRow l = dsReceipt.order_line.NewRow();
                        l["inventoryID"] = selectedProducts.Rows[i]["id"];
                        l["orlQuantity"] = Request.Form["ctl00$MainContent$gvSelectedProductsSales$ctl0" + (i + 2).ToString() + "$TextBox1"];
                        l["orlOrderReq"] = Convert.ToInt16(l["orlQuantity"]) > Convert.ToInt32(selectedProducts.Rows[i]["Stock"]);
                        l["orlPrice"]    = Convert.ToBoolean(l["orlOrderReq"]) ? Convert.ToDouble(selectedProducts.Rows[i]["Price"]) * 1.01 : Convert.ToDouble(selectedProducts.Rows[i]["Price"]);
                        ChildRows.Add(l);
                    }
                }
                adapter = new order_lineTableAdapter();
                if (ChildRows.Count == 0)
                {
                    dsReceipt.RejectChanges();
                    lblError.Text = "Please select at least one item to purchase";
                    return;
                }
            }
            else if (Mode == PageMode.Repair)
            {
                childTable = dsReceipt.service_order;
                DataRow eq = dsReceipt.equipment.NewRow();
                eq["equModel"]  = txtModel.Text;
                eq["equSerial"] = txtSerialNumber.Text;
                eq["custID"]    = r["custID"];
                eq["equtypeID"] = ddlType.SelectedValue;
                eq["equManuID"] = ddlManu.SelectedValue;
                dsReceipt.equipment.Rows.Add(eq);
                equipmentTableAdapter daEqu = new equipmentTableAdapter();
                daEqu.Update(dsReceipt.equipment);
                DataRow so = dsReceipt.service_order.NewRow();
                so["serordDateIn"]   = DateTime.Now;
                so["serordIssue"]    = RD.Text;
                so["serordWarranty"] = RadioButtonList1.SelectedValue == "1";
                so["serviceID"]      = ddlService.SelectedValue;
                //for reasons passing understanding,
                //the equipment table adapter does not update the id column in the dataset,
                //while the receipt adapter does
                so["equipID"] = Convert.ToInt32(dsReceipt.equipment.Max(row => row["id"])) + 1;
                ChildRows.Add(so);
                adapter = new service_orderTableAdapter();
            }
            receiptTableAdapter daReceipt = new receiptTableAdapter();

            daReceipt.Update(dsReceipt.receipt);
            foreach (DataRow cr in ChildRows)
            {
                cr["receiptId"] = r["id"];
                childTable.Rows.Add(cr);
            }
            if (adapter is service_orderTableAdapter daService)
            {
                daService.Update(dsReceipt.service_order);
            }
            else if (adapter is order_lineTableAdapter daOrder)
            {
                daOrder.Update(dsReceipt.order_line);
            }
            dsReceipt.AcceptChanges();
            Response.Redirect("~/Default");
        }