Example #1
0
        private async void Btn_update_Click(object sender, RoutedEventArgs e)
        {//update
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "update") || SectionData.isAdminPermision())
                {
                    if (unit.unitId > 0)
                    {
                        //validate values
                        validateEmptyValues();

                        if (!tb_name.Text.Equals(""))
                        {
                            // check if new unit doesn't match old units
                            var unitObj = units.ToList().Find(x => x.name == tb_name.Text);
                            if (unitObj is null || unitObj.name == unit.name)
                            {
                                unit.name  = tb_name.Text;
                                unit.notes = tb_notes.Text;

                                int res = await unitModel.save(unit);

                                if (res > 0)
                                {
                                    Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn);
                                }
                                else
                                {
                                    Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                                }

                                await RefreshUnitsList();

                                Tb_search_TextChanged(null, null);
                            }
                            else
                            {
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorDuplicateUnitNameToolTip"), animation: ToasterAnimation.FadeIn);
                            }
                        }
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSelectItemFirst"), animation: ToasterAnimation.FadeIn);
                    }
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
Example #2
0
        private async void Btn_saveReportlang_Click(object sender, RoutedEventArgs e)
        {
            //  string msg = "";
            int msg = 0;

            if (cb_reportlang.SelectedIndex != -1)
            {
                replangrow           = replangList.Where(r => r.valId == (int)cb_reportlang.SelectedValue).FirstOrDefault();
                replangrow.isDefault = 1;
                msg = await setvalueModel.Save(replangrow);

                //  replangrow.valId=
                await MainWindow.GetReportlang();
                await fillRepLang();

                if (msg > 0)
                {
                    Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                }
            }
        }
Example #3
0
        private bool validateDistroy()
        {
            bool valid = true;

            SectionData.validateEmptyTextBox(tb_reasonOfDestroy, p_errorReasonOfDestroy, tt_errorReasonOfDestroy, "trEmptyReasonToolTip");
            if (tb_reasonOfDestroy.Text.Equals(""))
            {
                valid = false;
                return(valid);
            }
            if (invItemLoc == null || invItemLoc.id == 0)
            {
                SectionData.validateEmptyComboBox(cb_item, p_errorItem, tt_errorItem, "trEmptyItemToolTip");
                SectionData.validateEmptyComboBox(cb_unit, p_errorUnit, tt_errorUnit, "trErrorEmptyUnitToolTip");
                if (cb_item.SelectedIndex == -1 || cb_unit.SelectedIndex == -1)
                {
                    valid = false;
                    return(valid);
                }
            }
            if (int.Parse(tb_amount.Text) < lst_serials.Items.Count)
            {
                valid = false;
                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorSerialMoreItemCountToolTip"), animation: ToasterAnimation.FadeIn);
            }
            return(valid);
        }
        private async Task <bool> validateInputs()
        {
            bool valid = true;

            SectionData.validateEmptyTextBox(tb_fromQuantity, p_errorFromQuantity, tt_errorFromQuantity, "trEmptyQuantityToolTip");
            SectionData.validateEmptyComboBox(cb_toUnit, p_errorToUnit, tt_errorToUnit, "trErrorEmptyDesUnitToToolTip");
            SectionData.validateEmptyComboBox(cb_fromUnit, p_errorFromUnit, tt_errorFromUnit, "trErrorEmptySrcUnitToolTip");
            if (tb_fromQuantity.Text.Equals("") || cb_fromUnit.SelectedIndex == -1 || cb_toUnit.SelectedIndex == -1)
            {
                valid = false;
                return(valid);
            }
            int quantity = int.Parse(tb_fromQuantity.Text);

            if (cb_sectionLocation.SelectedIndex == -1)
            {
                int branchQuantity = await ItemLocation.getUnitAmount((int)cb_fromUnit.SelectedValue, MainWindow.branchID.Value);

                if (branchQuantity < quantity)
                {
                    tb_fromQuantity.Text = branchQuantity.ToString();
                    //setToquantityMessage();
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorAmountNotAvailableFromToolTip"), animation: ToasterAnimation.FadeIn);
                    valid = false;
                    return(valid);
                }
            }
            if (isSmall == null && _ConversionQuantity > quantity)
            {
                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorNoEnoughQuantityToolTip"), animation: ToasterAnimation.FadeIn);
                valid = false;
                return(valid);
            }
            return(valid);
        }
Example #5
0
        private async void Btn_print_Click(object sender, RoutedEventArgs e)
        {//print
            try
            {
                HelpClass.StartAwait(grid_main);
                #region

                if (packuser.packageUserId <= 0)
                {
                    //no book saved
                    Toaster.ShowWarning(Window.GetWindow(this), message: "You have to book first", animation: ToasterAnimation.FadeIn);
                }
                else
                {
                    result = await BuildReport();

                    if (result == "0")
                    {
                        // not payed yet
                        Toaster.ShowWarning(Window.GetWindow(this), message: "The customer must pay first", animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        LocalReportExtensions.PrintToPrinterbyNameAndCopy(rep, FillCombo.getdefaultPrinters(), FillCombo.rep_print_count == null ? short.Parse("1") : short.Parse(FillCombo.rep_print_count));
                    }
                }
                #endregion
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Example #6
0
        private async Task openCloseBox(string status)
        {
            CashTransfer cashTransfer = new CashTransfer();

            cashTransfer.processType  = "box";
            cashTransfer.transType    = status;
            cashTransfer.cash         = MainWindow.posLogIn.balance;
            cashTransfer.createUserId = MainWindow.userID.Value;
            cashTransfer.posId        = (int)MainWindow.posID;
            if (status == "o")
            {
                cashTransfer.transNum = await cashTransfer.generateCashNumber("bc");
            }
            else
            {
                cashTransfer.transNum = await cashTransfer.getLastOpenTransNum((int)MainWindow.posID);
            }
            int res = await posModel.updateBoxState((int)MainWindow.posID, status, Convert.ToInt32(isAdmin), MainWindow.userLogin.userId, cashTransfer);

            if (res > 0)
            {
                await MainWindow.refreshBalance();

                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn);
            }
            else
            {
                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
            }
        }
        private void Btn_save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!isPurchase &&
                    (invoice.paid >= invoice.totalNet || (hasCredit == true && creditValue > invoice.totalNet - invoice.paid) || (hasCredit == true && creditValue == 0)))
                {
                    if (invoice.totalNet - invoice.paid > 0)
                    {
                        cashTrasnfer = new CashTransfer();

                        ///////////////////////////////////////////////////
                        cashTrasnfer.agentId     = invoice.agentId;
                        cashTrasnfer.invId       = invoice.invoiceId;
                        cashTrasnfer.processType = "balance";
                        cashTrasnfer.cash        = invoice.totalNet - invoice.paid;
                        listPayments.Add(cashTrasnfer);
                    }
                    isOk = true;
                    this.Close();
                }
                else if (isPurchase && hasCredit == true)
                {
                    if (listPayments.Where(x => x.processType == "cash").Count() > 0 &&
                        listPayments.Where(x => x.processType == "cash").FirstOrDefault().cash > MainWindow.posLogIn.balance)
                    {
                        isOk = false;
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopNotEnoughBalance"), animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        if (invoice.totalNet - invoice.paid > 0)
                        {
                            cashTrasnfer = new CashTransfer();

                            ///////////////////////////////////////////////////
                            cashTrasnfer.agentId     = invoice.agentId;
                            cashTrasnfer.invId       = invoice.invoiceId;
                            cashTrasnfer.processType = "balance";
                            cashTrasnfer.cash        = invoice.totalNet - invoice.paid;
                            listPayments.Add(cashTrasnfer);
                        }
                        //lst_payments.Items.Add(s);
                        ///////////////////////////////////////////////////
                        isOk = true;
                        this.Close();
                    }
                }
                else // if (invoice.paid < invoice.totalNet && hasCredit == false &&)
                {
                    isOk = false;
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trAmountPaidEqualInvoiceValue"), animation: ToasterAnimation.FadeIn);
                }
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_update_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                //update
                if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "update") || SectionData.isAdminPermision())
                {
                    if (section.sectionId > 0)
                    {
                        if (validate(section))
                        {
                            section.name = tb_name.Text;
                            //section.branchId = Convert.ToInt32(cb_branch.SelectedValue);
                            section.note         = tb_note.Text;
                            section.updateUserId = MainWindow.userID;

                            int s = await sectionModel.save(section);

                            if (s > 0)
                            {
                                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn);
                            }
                            else
                            {
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                            }

                            await RefreshSectionsList();

                            Tb_search_TextChanged(null, null);
                        }
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSelectItemFirst"), animation: ToasterAnimation.FadeIn);
                    }
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #9
0
        private async void Btn_download_Click(object sender, RoutedEventArgs e)
        {//download
            try
            {
                HelpClass.StartAwait(grid_main);

                HelpClass.validateWindow(requiredControlList, this);
                if (cb_type.SelectedIndex != -1)
                {
                    //string activeState = "rn";//rn OR up  from buton
                    string activeState = cb_type.SelectedValue.ToString();

                    PackageUser pumodel = new PackageUser();
                    ReportCls   rc      = new ReportCls();
                    SendDetail  sd      = new SendDetail();
                    sd = await pumodel.ActivateServerOffline(packageUser.packageUserId, activeState);

                    packagesSend packtemp = new packagesSend();
                    if (sd.packageSend.result > 0)
                    {
                        //encode
                        string myContent = JsonConvert.SerializeObject(sd);

                        saveFileDialog.Filter = "File|*.ac;";
                        if (saveFileDialog.ShowDialog() == true)
                        {
                            string DestPath = saveFileDialog.FileName;

                            bool res = false;

                            res = rc.encodestring(myContent, DestPath);
                            // rc.DelFile(pdfpath);
                            //  rc.decodefile(DestPath,@"D:\stringlist.txt");
                            if (res)
                            {
                                //done
                                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                            }
                            else
                            {
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                            }
                        }
                    }
                    else
                    {
                        //error
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }

                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_add_Click(object sender, RoutedEventArgs e)
        { //add
            try
            {
                HelpClass.StartAwait(grid_main);
                //if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "add"))
                //{

                //      if (HelpClass.validate(requiredControlList, this) && HelpClass.IsValidEmail(this))
                {
                    sysEmail.emailId = 0;
                    sysEmail.name    = tb_name.Text;
                    sysEmail.email   = tb_email.Text;
                    // sysEmail.password = pb_password.Password;
                    sysEmail.password = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(pb_password.Password));

                    sysEmail.port  = int.Parse(tb_port.Text);
                    sysEmail.isSSL = tgl_isSSL.IsChecked.Value;
                    //  sysEmail.isMajor = tgl_isMajor.IsChecked.Value;
                    sysEmail.smtpClient = tb_smtpClient.Text;
                    sysEmail.side       = cb_side.SelectedValue.ToString();
                    // sysEmail.branchId = (int)cb_branchId.SelectedValue;
                    sysEmail.notes        = tb_notes.Text;
                    sysEmail.createUserId = MainWindow.userLogin.userId;
                    sysEmail.updateUserId = MainWindow.userLogin.userId;
                    sysEmail.isActive     = 1;

                    int s = await sysEmail.Save(sysEmail);

                    if (s.Equals(-4))
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trMajorEmaillAlreadyExists"), animation: ToasterAnimation.FadeIn);
                    }
                    else if (!s.Equals(0))
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn);

                        Clear();
                        await RefreshUsersList();
                        await Search();
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                }
                //}
                //else
                //    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        //************************************************
        //******************* update property***************
        private async void Btn_update_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "update") || SectionData.isAdminPermision())
                {
                    //update
                    if (property.propertyId > 0)
                    {
                        property.name         = tb_name.Text;
                        property.createUserId = MainWindow.userID;
                        property.updateUserId = MainWindow.userID;

                        int res = await propertyModel.save(property);

                        if (res > 0)
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }

                        await RefreshPropertiesList();

                        Tb_search_TextChanged(null, null);
                        //var poss = await propertyModel.getProperty();
                        //dg_property.ItemsSource = poss;
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSelectItemFirst"), animation: ToasterAnimation.FadeIn);
                    }
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_update_Click(object sender, RoutedEventArgs e)
        {//update
            try
            {
                HelpClass.StartAwait(grid_main);
                if (sysEmail.emailId > 0)
                {
                    if (HelpClass.validate(requiredControlList, this) && HelpClass.IsValidEmail(this))
                    {
                        sysEmail.email = tb_email.Text;
                        //   sysEmail.password = pb_password.Password;
                        sysEmail.password     = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(pb_password.Password));
                        sysEmail.name         = tb_name.Text;
                        sysEmail.port         = int.Parse(tb_port.Text);
                        sysEmail.isSSL        = tgl_isSSL.IsChecked.Value;
                        sysEmail.isMajor      = true;
                        sysEmail.smtpClient   = tb_smtpClient.Text;
                        sysEmail.side         = cb_side.SelectedValue.ToString();
                        sysEmail.branchId     = 1;
                        sysEmail.notes        = tb_notes.Text;
                        sysEmail.createUserId = MainWindow.userLogin.userId;
                        sysEmail.updateUserId = MainWindow.userLogin.userId;
                        //sysEmail.isActive = 1;
                        //  string s = await sysEmail.Save(sysEmail);
                        int s = await sysEmail.Save(sysEmail);

                        if (s.Equals(-4))
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trMajorEmaillAlreadyExists"), animation: ToasterAnimation.FadeIn);
                        }
                        else if (!s.Equals(0))
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn);
                            await RefreshUsersList();
                            await Search();
                        }
                        else
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }
                    }
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSelectItemFirst"), animation: ToasterAnimation.FadeIn);
                }



                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Example #13
0
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {//save
            try
            {
                HelpClass.StartAwait(grid_main);

                countryPackageDate = new CountryPackageDate();

                if (!chkIfExist())
                {
                    if (HelpClass.validateWindow(requiredControlList, this))
                    {
                        countryPackageDate.countryId  = Convert.ToInt32(cb_country.SelectedValue);
                        countryPackageDate.packageId  = packageID;
                        countryPackageDate.monthCount = Convert.ToInt32(cb_month.SelectedValue);
                        countryPackageDate.price      = decimal.Parse(tb_price.Text);
                        if (Convert.ToInt32(cb_month.SelectedValue) == 0)
                        {
                            countryPackageDate.islimitDate = false;
                        }
                        else
                        {
                            countryPackageDate.islimitDate = true;
                        }
                        countryPackageDate.notes        = tb_notes.Text;
                        countryPackageDate.isActive     = 1;
                        countryPackageDate.createUserId = MainWindow.userLogin.userId;
                        countryPackageDate.updateUserId = MainWindow.userLogin.userId;

                        int s = await countryPackageDateModel.Save(countryPackageDate);

                        if (s <= 0)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn);

                            Clear();
                            await RefreshCountryPackageDateList();
                            await Search();
                        }
                    }
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAlreadyExist"), animation: ToasterAnimation.FadeIn);
                }
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void previewRowinDatagrid(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
                {
                    if (vis is DataGridRow)
                    {
                        POSOpenCloseModel row = (POSOpenCloseModel)dgClosing.SelectedItems[0];
                        cashTransID     = row.cashTransId;
                        openCashTransID = row.openCashTransId.Value;
                        await getopquery(row);

                        if (opquery.Count() == 0)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trNoChange"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            string pdfpath = "";

                            pdfpath = @"\Thumb\report\temp.pdf";
                            pdfpath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, pdfpath);

                            BuildOperationReport();
                            LocalReportExtensions.ExportToPDF(rep, pdfpath);
                            wd_previewPdf w = new wd_previewPdf();
                            w.pdfPath = pdfpath;
                            if (!string.IsNullOrEmpty(w.pdfPath))
                            {
                                w.ShowDialog();
                                w.wb_pdfWebViewer.Dispose();
                            }
                            Window.GetWindow(this).Opacity = 1;
                        }
                    }
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #15
0
 public void OnNavigatedTo(NavigationEventArgs e)
 {
     try
     {
         Toaster.ShowWarning(ObjectHolder.MainForm, Status.Status_Head_CyberGhost_6, Alerts.Logout_Message, 1, 0, 10.0);
     }
     catch (Exception ex)
     {
         LogHelper.LogMessage(string.Format("COULD NOT SHOW TOASTER {0}", ex.Message));
     }
 }
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {//save
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_locationRange);
                }

                if (validate(location))
                {
                    int s = 0;
                    generateLocationListX(location);
                    foreach (var item in locations)
                    {
                        if (AllLocations.Where(x => x.name == item.name && x.branchId == MainWindow.branchID).Count() == 0)
                        {
                            item.createUserId = MainWindow.userID;
                            item.updateUserId = MainWindow.userID;
                            item.note         = "";
                            item.isActive     = 1;
                            item.sectionId    = null;
                            item.branchId     = MainWindow.branchID;

                            s = await location.save(item);
                        }
                    }

                    if (!s.Equals("-1"))
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn);
                        Btn_clear_Click(null, null);
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_locationRange);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_locationRange);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #17
0
        private async void Btn_preview_Click(object sender, RoutedEventArgs e)
        {//preview
            try
            {
                HelpClass.StartAwait(grid_main);

                #region


                string pdfpath = "";
                //
                pdfpath = @"\Thumb\report\temp.pdf";
                pdfpath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, pdfpath);

                if (packuser.packageUserId <= 0)
                {
                    //no book saved
                    Toaster.ShowWarning(Window.GetWindow(this), message: "You have to book first", animation: ToasterAnimation.FadeIn);
                }
                else
                {
                    result = await BuildReport();

                    if (result == "0")
                    {
                        // not payed yet
                        Toaster.ShowWarning(Window.GetWindow(this), message: "The customer must pay first", animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        Window.GetWindow(this).Opacity = 0.2;
                        LocalReportExtensions.ExportToPDF(rep, pdfpath);
                        wd_previewPdf w = new wd_previewPdf();
                        w.pdfPath = pdfpath;
                        if (!string.IsNullOrEmpty(w.pdfPath))
                        {
                            w.ShowDialog();
                            w.wb_pdfWebViewer.Dispose();
                        }
                        Window.GetWindow(this).Opacity = 1;
                    }
                }
                #endregion

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void excelRowinDatagrid(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
                {
                    if (vis is DataGridRow)
                    {
                        POSOpenCloseModel row = (POSOpenCloseModel)dgClosing.SelectedItems[0];
                        cashTransID     = row.cashTransId;
                        openCashTransID = row.openCashTransId.Value;
                        await getopquery(row);

                        if (opquery.Count() == 0)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trNoChange"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            BuildOperationReport();

                            this.Dispatcher.Invoke(() =>
                            {
                                saveFileDialog.Filter = "EXCEL|*.xls;";
                                if (saveFileDialog.ShowDialog() == true)
                                {
                                    string filepath = saveFileDialog.FileName;
                                    LocalReportExtensions.ExportToExcel(rep, filepath);
                                }
                            });
                        }
                    }
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #19
0
 private Boolean validate()
 {
     if (MainWindow.posLogIn.balance == 0)
     {
         Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trZeroBalance"), animation: ToasterAnimation.FadeIn);
         return(false);
     }
     SectionData.validateEmptyComboBox(cb_pos, p_errorPos, tt_errorPos, "trErrorEmptyPosToolTip");
     if (cb_pos.SelectedIndex == -1)
     {
         return(false);
     }
     return(true);
 }
Example #20
0
        private async void Btn_archive_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (MainWindow.groupObject.HasPermissionAction(archivingPermission, MainWindow.groupObjects, "one") || MainWindow.groupObject.HasPermissionAction(createInventoryPermission, MainWindow.groupObjects, "one"))
                {
                    if (invItemsLocations.Count > 0)
                    {
                        if (_InventoryType == "n")
                        {
                            await addInventory("a"); // a:archived
                        }
                        else if (_InventoryType == "d")
                        {
                            var inv = await inventory.getByBranch("n", MainWindow.branchID.Value);

                            if (inv.inventoryId == 0)
                            {
                                await addInventory("n"); // n:normal
                            }
                            else
                            {
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trWarningOneInventory"), animation: ToasterAnimation.FadeIn);
                            }
                        }
                    }
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #21
0
        private async void Btn_printCount_Click(object sender, RoutedEventArgs e)
        {//save print count
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                SectionData.validateEmptyTextBox(tb_printCount, p_errorPrintCount, tt_errorPrintCount, "trEmptyPrintCount");
                if (!tb_printCount.Text.Equals(""))
                {
                    if (printCount == null)
                    {
                        printCount = new SetValues();
                    }
                    printCount.value     = tb_printCount.Text;
                    printCount.isSystem  = 1;
                    printCount.isDefault = 1;
                    printCount.settingId = printCountId;

                    int s = await valueModel.Save(printCount);

                    if (!s.Equals(0))
                    {
                        //update tax in main window
                        MainWindow.Allow_print_inv_count = printCount.value;

                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
        private async void moveRowinDatagrid(object sender, RoutedEventArgs e)
        {//move
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
                {
                    if (vis is DataGridRow)
                    {
                        POSOpenCloseModel row = (POSOpenCloseModel)dgClosing.SelectedItems[0];

                        Statistics statisticsModel = new Statistics();
                        IEnumerable <OpenClosOperatinModel> cashesQuery;
                        cashesQuery = await statisticsModel.GetTransBetweenOpenClose(row.openCashTransId.Value, row.cashTransId);

                        cashesQuery = cashesQuery.Where(c => c.transType != "c" && c.transType != "o");
                        if (cashesQuery.Count() == 0)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trNoChange"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            Window.GetWindow(this).Opacity = 0.2;
                            wd_transBetweenOpenClose w = new wd_transBetweenOpenClose();
                            w.openCashTransID  = row.openCashTransId.Value;
                            w.closeCashTransID = row.cashTransId;
                            w.ShowDialog();
                            Window.GetWindow(this).Opacity = 1;
                        }
                    }
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
        private void Tb_serialNum_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }


                if (e.Key == Key.Return && !tb_amount.Text.Equals(""))
                {
                    string s         = tb_serialNum.Text;
                    int    itemCount = int.Parse(tb_amount.Text);

                    if (!s.Equals(""))
                    {
                        int found = lst_serials.Items.IndexOf(s);

                        if (_serialCount == itemCount)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trWarningItemCountIs:") + " " + itemCount, animation: ToasterAnimation.FadeIn);
                        }
                        else if (found == -1)
                        {
                            lst_serials.Items.Add(tb_serialNum.Text);
                            _serialCount++;
                        }
                        else
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trWarningSerialExists"), animation: ToasterAnimation.FadeIn);
                        }
                    }
                    tb_serialNum.Clear();
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #24
0
        private async void Btn_exportToExcel_Click(object sender, RoutedEventArgs e)
        {//excel
            try
            {
                HelpClass.StartAwait(grid_main);

                #region
                //Thread t1 = new Thread(() =>
                //{
                if (packuser.packageUserId <= 0)
                {
                    //no book saved
                    Toaster.ShowWarning(Window.GetWindow(this), message: "You have to book first", animation: ToasterAnimation.FadeIn);
                }
                else
                {
                    result = await BuildReport();

                    if (result == "0")
                    {
                        // not payed yet
                        Toaster.ShowWarning(Window.GetWindow(this), message: "The customer must pay first", animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            saveFileDialog.Filter = "EXCEL|*.xls;";
                            if (saveFileDialog.ShowDialog() == true)
                            {
                                string filepath = saveFileDialog.FileName;
                                LocalReportExtensions.ExportToExcel(rep, filepath);
                            }
                        });
                    }

                    //});
                    //t1.Start();
                }
                #endregion
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_add_Click(object sender, RoutedEventArgs e)
        {//add
            try
            {
                HelpClass.StartAwait(grid_main);
                program = new Programs();
                if (validate())
                {
                    string isExist = await program.isExistCode(tb_code.Text.Trim());

                    if (isExist == "0")
                    {
                        program.programCode  = tb_code.Text.Trim();
                        program.name         = tb_name.Text;
                        program.details      = tb_details.Text;
                        program.notes        = tb_notes.Text;
                        program.isActive     = 1;
                        program.createUserId = MainWindow.userLogin.userId;
                        program.updateUserId = MainWindow.userLogin.userId;

                        int s = await program.Save(program);

                        if (s <= 0)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn);
                            Clear();
                            await RefreshProgramsList();
                            await Search();
                        }
                    }
                    else
                    {
                        MessageBox.Show("exist ");
                    }
                }

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Example #26
0
        private async Task activate()
        {//activate
            countryPackageDate.isActive = 1;
            int s = await countryPackageDateModel.Save(countryPackageDate);

            if (s <= 0)
            {
                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
            }
            else
            {
                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopActive"), animation: ToasterAnimation.FadeIn);
                await RefreshCountryPackageDateList();
                await Search();
            }
        }
Example #27
0
        private async Task activate()
        {//activate
            user.isActive = 1;
            int s = await user.Save(user);

            if (s <= 0)
            {
                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
            }
            else
            {
                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopActive"), animation: ToasterAnimation.FadeIn);
                await RefreshUsersList();
                await Search();
            }
        }
        private void Btn_save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_serialNum);
                }
                if (_serialCount <= itemCount)
                {
                    if (lst_serials.Items.Count == itemCount)
                    {
                        serialList = new List <string>();
                        for (int i = 0; i < lst_serials.Items.Count; i++)
                        {
                            serialList.Add(lst_serials.Items[i].ToString());
                        }

                        _serialCount = 0;
                        valid        = true;
                        DialogResult = true;
                        this.Close();
                    }
                    else
                    {
                        //Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trShouldInputOneSerialNumberAtLeast"), animation: ToasterAnimation.FadeIn);
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSerialNumbersEqualItemsNumber"), animation: ToasterAnimation.FadeIn);
                    }
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorSerialMoreItemCountToolTip"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_serialNum);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_serialNum);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #29
0
        private async void Btn_itemsTaxNote_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SectionData.StartAwait(grid_main);
                Window.GetWindow(this).Opacity = 0.2;

                wd_notes w = new wd_notes();
                w.maxLength = 100;
                //   w.note = "Test note...";
                itemtax_note_row = printList.Where(X => X.name == "itemtax_note").FirstOrDefault();
                itemtax_note     = itemtax_note_row.value;

                w.note = itemtax_note;
                w.ShowDialog();
                if (w.isOk)
                {
                    // MessageBox.Show(w.note);
                    //save
                    int res = 0;
                    itemtax_note_row.value = w.note.Trim();
                    res = await setvalueModel.Save(itemtax_note_row);



                    if (res > 0)
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                    await FillprintList();

                    await MainWindow.Getprintparameter();
                }

                Window.GetWindow(this).Opacity = 1;
                SectionData.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                SectionData.EndAwait(grid_main);
                SectionData.ExceptionMessage(ex, this);
            }
        }
Example #30
0
        private async void Btn_savePrintHeader_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                //  SectionData.validateEmptyComboBox(cb_serverStatus, p_errorServerStatus, tt_errorServerStatus, "trEmptyServerStatus");
                if (!cb_printHeader.Text.Equals(""))
                {
                    int res = 0;
                    show_header_row.value = cb_printHeader.SelectedValue.ToString();
                    res = await setvalueModel.Save(show_header_row);

                    //   int res = await progDetailsModel.updateIsonline(isOnline);


                    if (res > 0)
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                    await FillprintList();

                    fillPrintHeader();
                    await MainWindow.Getprintparameter();
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }