private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model              = new Client(session);
                model.ClientID     = 0;
                model.ClientTypeID = clientRepo.GetClientTypeByCode(Enums.ClientType.DOBAVITELJ.ToString(), model.Session);
            }
            else if (!add && model == null)
            {
                model = GetClientProvider().GetSupplierModel();
            }

            model.Name                 = txtName.Text;
            model.LongName             = txtLongName.Text;
            model.Address              = txtAddress.Text;
            model.Postcode             = txtPostalcode.Text;
            model.PostName             = txtCity.Text;
            model.Country              = txtCountry.Text;
            model.Email                = txtEmail.Text;
            model.Phone                = txtPhone.Text;
            model.FAX                  = txtFax.Text;
            model.BankAccount          = txtBankAccount.Text;
            model.TaxNumber            = txtTaxNumber.Text;
            model.RegistrationNumber   = txtRegistrationNumber.Text;
            model.IdentificationNumber = txtIdentificationNumber.Text;
            model.Taxpayer             = chbxTaxPayer.Checked;
            model.EUMember             = chbxEUMember.Checked;
            model.Notes                = MemoNotes.Text;

            clientID = clientRepo.SaveClient(model, PrincipalHelper.GetUserID());

            return(true);
        }
        protected void DocumentUpload_DeleteAttachments(object sender, EventArgs e)
        {
            model = GetDeliveryNoteProvider().GetDeliveryNoteModel();
            if (model != null)
            {
                int            hasPipe      = 0;
                string         fileToDelete = (sender as UploadAttachment).currentFile.Name;
                DocumentEntity obj          = GetAttachmentFromDB(fileToDelete);

                if (obj != null)
                {
                    string item = obj.Url + ";" + obj.Name;
                    string strPhysicalFolder = Server.MapPath(obj.Url);
                    if (File.Exists(strPhysicalFolder))
                    {
                        File.Delete(strPhysicalFolder);
                    }

                    if (model.XMLFilePath.Contains("|"))
                    {
                        hasPipe = 1;
                    }
                    else
                    {
                        hasPipe = 0;
                    }

                    model.XMLFilePath = model.XMLFilePath.Remove(model.XMLFilePath.IndexOf(item) - hasPipe, item.Length + hasPipe);
                    deliveryNoteRepo  = new DeliveryNoteRepository(model.Session);
                    deliveryNoteRepo.SaveDeliveryNote(model, PrincipalHelper.GetUserID());
                }
            }
        }
Exemple #3
0
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model            = new Employee(session);
                model.EmployeeID = 0;
            }
            else if (!add && model == null)
            {
                model = GetEmployeeProvider().GetEmployeeModel();
            }

            model.Firstname = txtName.Text;
            model.Lastname  = txtLastName.Text;
            model.BirthDate = DateEditBirthDate.Date;
            model.Address   = txtAddress.Text;
            model.Postcode  = txtPostcode.Text;
            model.Post      = txtCity.Text;

            model.Email = txtEmail.Text;
            model.Phone = txtPhone.Text;

            model.Notes = MemoNotes.Text;

            if (!String.IsNullOrEmpty(model.Picture))
            {
                UploadProfile.ProfileImage.Src = model.Picture.Replace(AppDomain.CurrentDomain.BaseDirectory, "\\");
            }

            employeeID = employeeRepo.SaveEmployee(model, PrincipalHelper.GetUserID());

            return(true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new IssueDocumentPosition(session);
                model.IssueDocumentPositionID = 0;
            }
            else if (!add && model == null)
            {
                model = GetIssueDocumentProvider().GetIssueDocumentPositionModel();
            }

            model.IssueDocumentID = issueDocumentRepo.GetIssueDocumentByID(GetIntValueFromSession(Enums.IssueDocumentSession.IssueDocumentID), model.Session);

            int supplierID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupSupplier));

            if (model.SupplierID != null)
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.SupplierID.Session);
            }
            else
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.Session);
            }

            //model.Quantity = CommonMethods.ParseDecimal(txtQuantity.Text);
            model.UID250 = !String.IsNullOrEmpty(txtUID250.Text) ? txtUID250.Text : model.UID250;
            //model.Name = txtName.Text;
            model.Notes = MemoNotes.Text;

            issueDocumentRepo.SaveIssueDocumentPosition(model, PrincipalHelper.GetUserID());

            return(true);
        }
        protected void btnProcessXMLFile_Click(object sender, EventArgs e)
        {
            if (model == null)
            {
                model = GetDeliveryNoteProvider().GetDeliveryNoteModel();
            }

            if (model != null && GetDeliveryNoteProvider().GetDeliveryNoteStatus() == Enums.DeliveryNoteStatus.Not_Processed)
            {
                string[]       split    = model.XMLFilePath.Split('|');
                DocumentEntity document = null;
                foreach (var item in split)
                {
                    string[] fileData = item.Split(';');
                    document      = new DocumentEntity();
                    document.Url  = fileData[0];
                    document.Name = fileData[1];
                }
                string physicalPath = Server.MapPath(document.Url);

                //TODO: Shrani DeliveryNote in nastavi na status In_Process
                GetDeliveryNoteProvider().SetDeliveryNoteStatus(Enums.DeliveryNoteStatus.In_Process);
                AddOrEditEntityObject((userAction == (int)Enums.UserAction.Add ? true : false));
                int userId = PrincipalHelper.GetUserID();
                Task.Run(() =>
                {
                    ParseXML(physicalPath, userId);
                    //TODO obvestiti uproabnika o daljšem obdobju parsanja...glej status.
                });
            }
            this.Master.NavigationBarMain.DataBind();
            ClearSessionsAndRedirect(false, true, true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new MobileTransaction(session);
                model.MobileTransactionID = 0;
            }
            else if (!add && model == null)
            {
                model = GetMobileTransactionProvider().GetMobileTransactionModel();
            }

            /*int productID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupProduct));
             * if (model.ProductID != null)
             *  model.ProductID = productRepo.GetProductByID(productID, model.ProductID.Session);
             * else
             *  model.ProductID = productRepo.GetProductByID(productID);*/


            model.Notes = MemoNotes.Text;

            mobileTransRepo.SaveMobileTransaction(model, PrincipalHelper.GetUserID());

            return(true);
        }
Exemple #7
0
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model           = new Product(session);
                model.ProductID = 0;
            }
            else if (!add && model == null)
            {
                model = GetProductProvider().GetProductModel();
            }

            model.Name = txtName.Text;

            int supplierID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupSupplier));

            if (model.SupplierID != null)
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.SupplierID.Session);
            }
            else
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID);
            }

            model.SupplierCode = txtSupplierCode.Text;
            model.PSN          = txtPSN.Text;

            int categoryID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupCategory));

            if (model.CategoryID != null)
            {
                model.CategoryID = categoryRepo.GetCategorieByID(categoryID, model.CategoryID.Session);
            }
            else
            {
                model.CategoryID = categoryRepo.GetCategorieByID(categoryID);
            }

            int measuringUnitID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupMeasuringUnit));

            if (model.MeasuringUnitID != null)
            {
                model.MeasuringUnitID = measuringUnitRepo.GetMeasuringUnitByID(measuringUnitID, model.MeasuringUnitID.Session);
            }
            else
            {
                model.MeasuringUnitID = measuringUnitRepo.GetMeasuringUnitByID(measuringUnitID);
            }

            model.Notes = MemoNotes.Text;

            productRepo.SaveProduct(model, PrincipalHelper.GetUserID());

            return(true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new DeliveryNote(session);
                model.DeliveryNoteID = 0;
            }
            else if (!add && model == null)
            {
                model = GetDeliveryNoteProvider().GetDeliveryNoteModel();
            }

            model.DeliveryNoteDate    = DateEditDeliveryNoteDate.Date;
            model.DeliveryNoteNumber  = txtDeliveryNoteNumber.Text;
            model.RecivedMaterialDate = DateEditDeliveryNoteDate.Date;

            int supplierID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupSupplier));

            if (model.SupplierID != null)
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.SupplierID.Session);
            }
            else
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID);
            }

            int locationID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupLocation));

            if (model.LocationID != null)
            {
                model.LocationID = locationRepo.GetLocationByID(locationID, model.LocationID.Session);
            }
            else
            {
                model.LocationID = locationRepo.GetLocationByID(locationID);
            }

            model.Notes = MemoNotes.Text;

            /*if (!String.IsNullOrEmpty(model.Picture))
             * {
             *  //UploadProfile.ProfileImage.Src = model.Picture.Replace(AppDomain.CurrentDomain.BaseDirectory, "\\");
             * }*/

            if (GetDeliveryNoteProvider().GetDeliveryNoteStatus() == Enums.DeliveryNoteStatus.Error && !String.IsNullOrEmpty(processError))
            {
                model.ProcessError = processError;
            }

            model.DeliveryNoteStatusID = deliveryNoteRepo.GetDeliveryNoteStatusByCode(GetDeliveryNoteProvider().GetDeliveryNoteStatus(), model.Session);

            deliveryNoteID = deliveryNoteRepo.SaveDeliveryNote(model, PrincipalHelper.GetUserID());

            return(true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model        = new Users(session);
                model.UserID = 0;
            }
            else if (!add && model == null)
            {
                model = GetEmployeeProvider().GetUserModel();
            }

            int employeeID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupEmployee));

            if (model.EmployeeID != null)
            {
                model.EmployeeID = employeeRepo.GetEmployeeByID(employeeID, model.EmployeeID.Session);
            }
            else
            {
                model.EmployeeID = employeeRepo.GetEmployeeByID(employeeID);
            }

            model.Username = txtUsername.Text;
            model.Password = txtPassword.Text;

            int roleID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupRole));

            if (model.RoleID != null)
            {
                model.RoleID = userRepo.GetRoleByID(roleID, model.RoleID.Session);
            }
            else
            {
                model.RoleID = userRepo.GetRoleByID(roleID);
            }

            model.GrantAppAccess = chbxGrantAccess.Checked;

            model.Notes = MemoNotes.Text;

            userRepo.SaveUser(model, PrincipalHelper.GetUserID());

            return(true);
        }
Exemple #10
0
        private bool AddOrEditEntityObject(bool add = false, bool completeIssueDocument = false)
        {
            if (add)
            {
                model = new IssueDocument(session);
                model.IssueDocumentID = 0;
                model.IssueStatus     = issueDocumentRepo.GetIssueDocumentStatusByCode(Enums.IssueDocumentStatus.DELOVNA, model.Session);
            }
            else if (!add && model == null)
            {
                model = GetIssueDocumentProvider().GetIssueDocumentModel();
            }

            model.IssueNumber = txtIssueDocumentNumber.Text;
            model.Name        = txtName.Text;
            model.IssueDate   = DateEditIssueDocumentDate.Date;

            int buyerID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupBuyer));

            if (model.BuyerID != null)
            {
                model.BuyerID = clientRepo.GetClientByID(buyerID, model.BuyerID.Session);
            }
            else
            {
                model.BuyerID = clientRepo.GetClientByID(buyerID);
            }

            model.InternalDocument = txtInternalDocument.Text;
            model.InvoiceNumber    = txtInvoiceNumber.Text;
            model.Notes            = MemoNotes.Text;
            model.PermissionDoc    = txtPermissonDoc.Text;


            if (completeIssueDocument)
            {
                model.IssueStatus = issueDocumentRepo.GetIssueDocumentStatusByCode(Enums.IssueDocumentStatus.ZAKLJUCENO, model.Session);
                utilityRepo.ClearStockByIssueDocumentID(model.IssueDocumentPositions.ToList());
            }

            issueDocumentID = issueDocumentRepo.SaveIssueDocument(model, PrincipalHelper.GetUserID());

            return(true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new InventoryStock(session);
                model.InventoryStockID = 0;
            }
            else if (!add && model == null)
            {
                model = GetInventoryStockProvider().GetInventoryStockModel();
            }

            int productID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupProduct));

            if (model.ProductID != null)
            {
                model.ProductID = productRepo.GetProductByID(productID, model.ProductID.Session);
            }
            else
            {
                model.ProductID = productRepo.GetProductByID(productID);
            }

            int locationID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupLocation));

            if (model.LocationID != null)
            {
                model.LocationID = locationRepo.GetLocationByID(locationID, model.LocationID.Session);
            }
            else
            {
                model.LocationID = locationRepo.GetLocationByID(locationID);
            }


            model.Quantity = CommonMethods.ParseDecimal(txtQuantity.Text);
            model.Notes    = MemoNotes.Text;

            productRepo.SaveInventoryStock(model, PrincipalHelper.GetUserID());

            return(true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new MeasuringUnit(session);
                model.MeasuringUnitID = 0;
            }
            else if (!add && model == null)
            {
                model = GetMeasuringUnitProvider().GetMeasuringUnitModel();
            }

            model.Name   = txtName.Text;
            model.Symbol = txtSymbol.Text;
            model.Notes  = MemoNotes.Text;

            measureRepo.SaveMeasuringUnit(model, PrincipalHelper.GetUserID());

            return(true);
        }
Exemple #13
0
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model             = new Categorie(session);
                model.CategorieID = 0;
            }
            else if (!add && model == null)
            {
                model = GetCategorieProvider().GetCategorieModel();
            }

            model.Name  = txtName.Text;
            model.Code  = txtCode.Text;
            model.Notes = MemoNotes.Text;

            categorieRepo.SaveCategorie(model, PrincipalHelper.GetUserID());

            return(true);
        }
Exemple #14
0
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model            = new Location(session);
                model.LocationID = 0;
            }
            else if (!add && model == null)
            {
                model = GetLocationProvider().GetLocationModel();
            }

            model.Name           = txtName.Text;
            model.IsBuyer        = chbxIsBuyer.Checked;
            model.Notes          = MemoNotes.Text;
            model.AdditionalInfo = memAdditionalData.Text;
            model.IsWarehouse    = CheckBoxIsWarehouse.Checked;

            locationRepo.SaveLocation(model, PrincipalHelper.GetUserID());

            return(true);
        }
        protected void DocumentUpload_UploadComplete(object sender, EventArgs e)
        {
            model = GetDeliveryNoteProvider().GetDeliveryNoteModel();
            if (model != null)
            {
                string pipe = "";
                if (!String.IsNullOrEmpty(model.XMLFilePath))
                {
                    pipe = "|";
                }

                deliveryNoteRepo   = new DeliveryNoteRepository(model.Session);
                model.XMLFilePath += pipe + (sender as UploadAttachment).currentFile.Url + ";" + (sender as UploadAttachment).currentFile.Name;
                deliveryNoteRepo.SaveDeliveryNote(model, PrincipalHelper.GetUserID());
                GetDeliveryNoteProvider().SetDeliveryNoteModel(model);

                //TODO: parse XML


                //HtmlGenericControl control = (HtmlGenericControl)attachmentsItem.FindControl("attachmentsBadge");
                //control.InnerText = model.Priloge.Split('|').Length.ToString();
            }
        }
Exemple #16
0
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new ContactPerson(session);
                model.ContactPersonID = 0;
                model.ClientID        = clientRepo.GetClientByID(clientID);
            }
            else if (!add && model == null)
            {
                model = GetClientProvider().GetContactPersonModel();
            }

            model.Name        = txtName.Text;
            model.Phone       = txtPhone.Text;
            model.MobilePhone = txtMobilePhone.Text;
            model.Email       = txtEmail.Text;
            model.FAX         = txtFax.Text;
            model.Notes       = MemoNotes.Text;

            clientRepo.SaveContactPerson(model, PrincipalHelper.GetUserID());

            return(true);
        }
        private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model          = new Client(session);
                model.ClientID = 0;
                //Zaenkrat ko s tme popup-om shranjujemo samo dobavitelje
                model.ClientTypeID = clientRepo.GetClientTypeByCode(Enums.ClientType.DOBAVITELJ.ToString(), model.Session);
            }
            else if (!add && model == null)
            {
                model = GetClientProvider().GetSupplierModel();
            }

            model.Name    = txtName.Text;
            model.Country = txtCountry.Text;
            model.Phone   = txtPhone.Text;
            model.Email   = txtEmail.Text;
            model.Notes   = MemoNotes.Text;

            clientRepo.SaveClient(model, PrincipalHelper.GetUserID());

            return(true);
        }
Exemple #18
0
        protected void CallbackPanelMobileTransaction_Callback(object sender, CallbackEventArgsBase e)
        {
            if (e.Parameter == "RefreshGrid")
            {
                ASPxGridViewMobileTransaction.DataBind();
            }
            else if (e.Parameter == "TransferToIssueDocument")
            {
                //pridobimo seznam izbranih lokacij
                List <int> selectedItems = ASPxGridViewMobileTransaction.GetSelectedFieldValues("InventoryDeliveriesLocationID.LocationToID.BuyerID.ClientID").OfType <int>().ToList();

                //preverimi če imajo vse izbrane transkacije enakega kupca
                int count = selectedItems.Count(si => si == selectedItems[0]);
                if (selectedItems.Count > 0 && selectedItems.Count == count)
                {
                    List <int> selectedItemsID = ASPxGridViewMobileTransaction.GetSelectedFieldValues("MobileTransactionID").OfType <int>().ToList();
                    issueDocumentRepo.CreateIssueDocumentFromMobileTransactions(selectedItemsID, PrincipalHelper.GetUserID(), selectedItems[0]);
                    ASPxGridViewMobileTransaction.Selection.UnselectAll();
                    CallbackPanelMobileTransaction.JSProperties["cpErrorIssueDocumentCreated"] = true;
                }
                else
                {
                    CallbackPanelMobileTransaction.JSProperties["cpErrorDifferentBuyers"] = true;
                    ASPxGridViewMobileTransaction.Selection.UnselectAll();
                    return;
                }
            }
            else
            {
                object mobileTransaction = ASPxGridViewMobileTransaction.GetRowValues(ASPxGridViewMobileTransaction.FocusedRowIndex, "MobileTransactionID");
                bool   openPopup         = SetSessionsAndOpenPopUp(e.Parameter, Enums.MobileTransactionSession.MobileTransactionID, mobileTransaction);

                if (openPopup)
                {
                    PopupControlMobileTransaction.ShowOnPageLoad = true;
                }
            }
        }