コード例 #1
0
        private void txtCategory_TextChanged(Object eventSender, EventArgs eventArgs)
        {
            if (cmbCategory.Items.Count == 0)
            {
                modFunctions.LoadCombo("Categories", cmbCategory, "CategoryName", "CategoryID");
            }
            //UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (String.IsNullOrEmpty(txtCategory.Text))
            {
                cmbCategory.SelectedIndex = -1;
                return;
            }
            int Index         = -1;
            int tempForEndVar = cmbCategory.Items.Count;

            for (modMain.i = 0; modMain.i <= tempForEndVar; modMain.i++)
            {
                if (cmbCategory.GetItemData(modMain.i) == StringsHelper.ToDoubleSafe(txtCategory.Text))
                {
                    Index = modMain.i;
                    break;
                }
            }
            cmbCategory.SelectedIndex = modMain.i;
        }
コード例 #2
0
ファイル: frmHebrew.cs プロジェクト: Bruce-BiblCal/BiblCal
        private void cmdCompute_Click(Object eventSender, EventArgs eventArgs)
        {
            int Index = 0;

            if (StringsHelper.ToDoubleSafe(txtYear.Text) == 0)
            {
                txtYear.Text = "-1";
            }
            if (StringsHelper.ToDoubleSafe(txtYear.Text) < -4600)
            {
                txtYear.Text = "-4600";
            }
            if (StringsHelper.ToDoubleSafe(txtYear.Text) > 32000)
            {
                txtYear.Text = "32000";
            }
            int YearNum = Convert.ToInt32(Double.Parse(txtYear.Text));

            modBiblcalFunctions.GregorianYear = YearNum;
            txtOut.Text = "";
            if (modBiblcalFunctions.GregorianYear < 0)
            {
                modBiblcalFunctions.GregorianYear++;
            }
            int HYear = Convert.ToInt32(modBiblcalFunctions.GregorianYear + 3760);

            //Print out the Sacred year sequence
            txtOut.Text = txtOut.Text + modHebrewCalendarFunctions.TypeYear[modHebrewCalendarFunctions.TypeOfYear(YearNum - 1)] +
                          " for year " + HYear.ToString() + Environment.NewLine + Environment.NewLine + "Start of months for 'Sacred' Year" + Environment.NewLine;
            int NumOfMonths   = modHebrewCalendarFunctions.NumberOfMonths(YearNum);           //Get Number of Months in this year
            int tempForEndVar = NumOfMonths;

            for (Index = 1; Index <= tempForEndVar; Index++)
            {
                txtOut.Text = txtOut.Text + modHebrewCalendarFunctions.SHMonthName[Index] + " ";
                if (Index > 6)
                {
                    HYear = Convert.ToInt32(modBiblcalFunctions.GregorianYear + 3761);
                }
                else
                {
                    HYear = Convert.ToInt32(modBiblcalFunctions.GregorianYear + 3760);
                }
                txtOut.Text            = txtOut.Text + HYear.ToString() + " - ";
                modBiblcalFunctions.JD = modHebrewCalendarFunctions.StartOfMonth(Index, YearNum); //Get JD for start of each month
                PrintDayAndDate2(modBiblcalFunctions.JD);                                         //Print the Gregorian day and date of that JD
                txtOut.Text = txtOut.Text + Environment.NewLine;
            }
            txtOut.Text = txtOut.Text + Environment.NewLine;
            HolyDays(YearNum);             //Print the calculated Holy Days
        }
コード例 #3
0
        internal static int Warnings(int dType = 0)
        {
            modMain.DetectionType = dType;
            modConnection.ExecuteSql("Delete * from tblDetections");

            //-------expiration
            modConnection.ExecuteSql("SELECT * From tblStockList");
            foreach (DataRow iteration_row in modConnection.rs.Tables[0].Rows)
            {
                if (Convert.ToString(iteration_row["expiry_date"]) != "  /  /    ")
                {
                    modMain.d = DateTime.Parse(DateTime.Parse(Convert.ToString(iteration_row["expiry_date"])).ToString("MM/dd/yyyy"));
                    if (String.CompareOrdinal(modMain.d.ToString("MM"), DateTime.Today.ToString("MM")) >= 0 && StringsHelper.ToDoubleSafe(modMain.d.ToString("MM")) <= (Conversion.Val(DateTime.Today.ToString("MM")) + 2) && modMain.d.ToString("yyyy") == DateTime.Today.ToString("yyyy"))
                    {
                        modConnection.ExecuteSql2("Select * from tblInventory where ProductId = '" + Convert.ToString(iteration_row["productId"]) + "'");
                        if (!modConnection.rs2.EOF)
                        {
                            modMain.n = Convert.ToDouble(modConnection.rs2["quantity"]);
                        }
                        if (String.CompareOrdinal(Convert.ToDateTime(iteration_row["expiry_date"]).ToString("MM"), DateTime.Today.ToString("MM")) <= 0 && String.CompareOrdinal(Convert.ToDateTime(iteration_row["expiry_date"]).ToString("dd"), DateTime.Today.ToString("dd")) <= 0 && String.CompareOrdinal(Convert.ToDateTime(iteration_row["expiry_date"]).ToString("yyyy"), DateTime.Today.ToString("yyyy")) <= 0)
                        {
                            modMain.s = "This item is already expired. Please unregister this from Inventory and add new stocks." +
                                        Environment.NewLine + Environment.NewLine + "Item Description: " + Convert.ToString(iteration_row["Description"]) + Environment.NewLine + Environment.NewLine +
                                        "Expiry Date: " + Convert.ToDateTime(iteration_row["expiry_date"]).ToString("MMM. dd, yyyy") + Environment.NewLine +
                                        "Quantity on Inventory: " + modMain.n.ToString();
                            SaveDetection(Convert.ToString(iteration_row["productId"]), "Expired", modMain.s, "tblDetections");
                        }
                        else
                        {
                            modMain.s = (Double.Parse(Convert.ToDateTime(iteration_row["expiry_date"]).ToString("MM")) - Double.Parse(DateTime.Today.ToString("MM"))).ToString() + " Month(s) before Expiry. Please replace it with new stocks and delete your old stocks. " +
                                        Environment.NewLine + Environment.NewLine + "Item Description: " + Convert.ToString(iteration_row["Description"]) + Environment.NewLine + Environment.NewLine +
                                        "Expiry date: " + Convert.ToDateTime(iteration_row["expiry_date"]).ToString("MMM. dd, yyyy") + Environment.NewLine +
                                        "quantity on Inventory: " + modMain.n.ToString();
                            SaveDetection(Convert.ToString(iteration_row["productId"]), "Expiration", modMain.s, "tblDetections");
                        }
                    }
                }
            }

            //-------out of stock
            modConnection.ExecuteSql("SELECT * From tblInventory WHERE quantity < 10");
            foreach (DataRow iteration_row_2 in modConnection.rs.Tables[0].Rows)
            {
                modMain.s = "This item do not have enough quantity on your inventory. Please add stock for this item." + Environment.NewLine + Environment.NewLine +
                            "Item Description: " + Convert.ToString(iteration_row_2["Description"]) + Environment.NewLine + Environment.NewLine +
                            "Currently on Inventory: " + Convert.ToString(iteration_row_2["quantity"]);
                SaveDetection(Convert.ToString(iteration_row_2["productId"]), "Low Stock", modMain.s, "tblDetections");
            }

            //-------low inventory
            modConnection.ExecuteSql("Select * from tblInventory");
            if (modConnection.rs.RecordCount == 0 || modConnection.rs.RecordCount <= 10)
            {
                modMain.s = "You don`t have enough items on your inventory." +
                            "Please add items or register items from database to your inventory list." + Environment.NewLine + Environment.NewLine +
                            "Items on Inventory: " + modConnection.rs.RecordCount.ToString();
                SaveDetection("Inventory", "Low Inventory", modMain.s, "tblDetections");
            }

            //-------no sales for the month
            modConnection.ExecuteSql("Select * from tblInventory");
            foreach (DataRow iteration_row_3 in modConnection.rs.Tables[0].Rows)
            {
                if (StringsHelper.ToDoubleSafe(DateTime.Today.ToString("MM")) != 1)
                {
                    modMain.n = Double.Parse(DateTime.Today.ToString("MM")) - 1;
                    modConnection.ExecuteSql2("Select * from tblSales where ProductId = '" + Convert.ToString(iteration_row_3["productId"]) + "' and format([date_sold],'mm') = " + modMain.n.ToString() +
                                              "and format([date_sold],'yyyy') = " + DateTime.Today.ToString("yyyy"));
                    if (!modConnection.rs2.EOF)
                    {
                        if (Convert.ToDouble(modConnection.rs2["quantity"]) < 30)
                        {
                            modMain.i = 0;
                            foreach (DataRow iteration_row_4 in modConnection.rs2.Tables[0].Rows)
                            {
                                modMain.i = Convert.ToInt32(modMain.i + Convert.ToDouble(iteration_row_4["quantity"]));
                            }
                            modMain.s = "Sales of this item is less for this month." + Environment.NewLine + Environment.NewLine +
                                        "Last Month total sales: " + modMain.i.ToString();
                            SaveDetection(Convert.ToString(iteration_row_3["productId"]), "Less Sales", modMain.s, "tblDetections");
                        }
                    }
                }
            }

            //-----No supplier
            modConnection.ExecuteSql("Select * from tblSuppliers");
            if (modConnection.rs.RecordCount == 0)
            {
                modMain.s = "No supplier saved on database. Please add a supplier for item delivery.";
                SaveDetection("Suppliers", "No Supplier", modMain.s, "tblDetections");
            }

            //-----Items no registered
            modConnection.ExecuteSql("Select * from tblItems where on_inventory = 0");
            modMain.n = 0;
            foreach (DataRow iteration_row_5 in modConnection.rs.Tables[0].Rows)
            {
                modConnection.ExecuteSql2("SELECT * From tblStockList WHERE ProductId = '" + Convert.ToString(iteration_row_5["productId"]) + "' and Format$([expiry_date],'mm') Between " + Conversion.Val(DateTime.Today.ToString("MM")).ToString() + " And " + Conversion.Val((Double.Parse(DateTime.Today.ToString("MM")) + 2).ToString()).ToString() + " and format$(expiry_date, 'yyyy') = " + DateTime.Today.ToString("yyyy"));
                if (modConnection.rs2.EOF)
                {
                    modMain.n++;
                }
            }
            if (modMain.n > 0)
            {
                modMain.s = "Some items on your database are not registered on your inventory list. If you don`t register this items, " +
                            " they will not be included on your sales." + Environment.NewLine + Environment.NewLine +
                            "Unregistered Items: " + modMain.n.ToString();
                SaveDetection("Register", "Non-Registered", modMain.s, "tblDetections");
            }

            //-----Delivery Schedule exceeded
            modConnection.ExecuteSql("Select Sup.Company as Company, Sup.last_delivery as LastDelivery, sched.gap as Gap, sched.gap_value as GapVal from tblSuppliers as Sup " +
                                     "INNER JOIN tblDeliverySched as Sched ON Sup.sched_type = Sched.description");
            foreach (DataRow iteration_row_6 in modConnection.rs.Tables[0].Rows)
            {
                int tempRefParam  = Convert.ToInt32(Double.Parse(Convert.ToDateTime(iteration_row_6["lastdelivery"]).ToString("MM")));
                int tempRefParam2 = Convert.ToInt32(Double.Parse(Convert.ToDateTime(iteration_row_6["lastdelivery"]).ToString("dd")));
                int tempRefParam3 = Convert.ToInt32(Double.Parse(Convert.ToDateTime(iteration_row_6["lastdelivery"]).ToString("yyyy")));
                modMain.d = Scheduler(ref tempRefParam, ref tempRefParam2, ref tempRefParam3, Convert.ToInt32(iteration_row_6["GapVal"]), Convert.ToString(iteration_row_6["Gap"]));
                if (String.CompareOrdinal(modMain.d.ToString("MM"), DateTime.Today.ToString("MM")) <= 0 && String.CompareOrdinal(modMain.d.ToString("dd"), DateTime.Today.ToString("dd")) < 0 && Convert.ToString(iteration_row_6["Gap"]) != "(none)")
                {
                    modMain.s = "Delivery schedule of supplier, " + Convert.ToString(iteration_row_6["company"]) + ", is not updated. " +
                                "Please record all delivery transactions of your suppliers to update it's delivery schedule." + Environment.NewLine + Environment.NewLine +
                                "Last Delivery: " + Convert.ToDateTime(iteration_row_6["lastdelivery"]).ToString("MMM. dd, yyyy") + Environment.NewLine +
                                "Expected Date: " + modMain.d.ToString("MMM. dd, yyyy");
                    SaveDetection(Convert.ToString(iteration_row_6["company"]), "Delivery Sched", modMain.s, "tblDetections");
                }
            }
            modConnection.ExecuteSql("Select * from tblDetections");
            return(modConnection.rs.RecordCount);
        }