protected void Button1_Click(object sender, EventArgs e)
        {
            //System.Threading.Thread.Sleep(2000);
            foreach (GridViewRow row in GridView1.Rows)
            {
                // protect not to fill invalid even in disable javaScript state
                // lack of check balance in code

                if (checkValidation(row))
                {
                    String  txtOriginal = row.Cells[6].Text;
                    TextBox txtEditable = (TextBox)row.FindControl("TextBox1");

                    if (checkEdit(txtOriginal, txtEditable.Text))
                    {
                        deptId       = Convert.ToInt32(row.Cells[2].Text);
                        stationeryId = Convert.ToInt32(row.Cells[3].Text);

                        FulfillmentController fc = new FulfillmentController();
                        fc.actionUpdateQty(deptId, stationeryId, originalQty, editableQty);

                        refreshNeed = true;
                    }
                }
            }

            showSuccess(refreshNeed, "Successfully Saved.");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalysedProduct"/> class.
 /// </summary>
 /// <param name="projProd">The proj product.</param>
 /// Erstellt von Joshua Frey, am 20.01.2016
 public AnalysedProduct(ProjectProduct projProd)
 {
     this.ProjProd            = projProd;
     this.ProjCritContr       = new ProjectCriterionController();
     this.FulFillContr        = new FulfillmentController();
     this.AnalysisResultCrits = new List <AnalysisResultCrit>();
     this.ProjectId           = this.ProjProd.Project_Id;
     CalculateAnalysedProductResult();
 }
        public void getJSONByDepartmentAndItem(HttpContext context)
        {
            int deptId       = Convert.ToInt32(context.Request.Form["deptId"]);
            int stationeryId = Convert.ToInt32(context.Request.Form["stationeryId"]);

            Fulfillment_View  i = new FulfillmentController().actionGetFulfillmentViewByDepartmentAndStationery(deptId, stationeryId);
            MFulfillment_View m = new MFulfillment_View(i.id, i.department, i.stationery, i.stationery_name, i.requested_quantity, i.fulfill_quantity, i.unfulfill_quantity, (int)i.stock_control);

            context.Response.Write(JsonConvert.SerializeObject(m));
            context.Response.End();
        }
        private void actionChangeAllToFulfillment()
        {
            FulfillmentController f = new FulfillmentController();

            if (chkDateTime.Checked)
            {
                f.actionChangeAllToFulfillmentByDepartmentAndDateTime(deptId, Helper.CovertToCustomDateTime(txtDate.Text, txtTime.Text, txtTimeMin.Text, ddlTime.Text));
            }
            else
            {
                f.actionChangeAllToFulfillmentByDepartment(deptId);
            }
        }
        private void actionChangeAllToFulfillment()
        {
            FulfillmentController f = new FulfillmentController();

            if (chkDateTime.Checked)
            {
                DateTime dateTime = Helper.CovertToCustomDateTime(txtDate.Text, txtTime.Text, txtTimeMin.Text, ddlTime.Text);
                f.actionChangeAllToFulfillmentByDepartmentAndStationeryAndTime(deptId, stationeryId, dateTime);
            }
            else
            {
                f.actionChangeAllToFulfillmentByDepartmentAndStationery(deptId, stationeryId);
            }
        }
        public void getJSONByItem(HttpContext context)
        {
            int deptId = Convert.ToInt32(context.Request.Form["deptId"]);

            List <MFulfillment_View> mList = new List <MFulfillment_View>();
            List <Fulfillment_View>  list  = new FulfillmentController().actionGetFulfillmentViewByDepartment(deptId);

            foreach (Fulfillment_View i in list)
            {
                mList.Add(new MFulfillment_View(i.id, i.department, i.stationery, i.stationery_name, i.requested_quantity, i.fulfill_quantity, i.unfulfill_quantity, (int)i.stock_control));
            }

            context.Response.Write(JsonConvert.SerializeObject(mList));
            context.Response.End();
        }
示例#7
0
        //Konstruktor - Werden ProjectId und ProductId als Parameter übergeben
        public FulfillmentForEachProductPrinter(int projectId, int productId)
        {
            this.ProjCritContr = new ProjectCriterionController();
            ProjectController projCont = new ProjectController();

            this.Project = projCont.GetProjectById(projectId);

            this.ProjProduct = new ProductController();
            ProductController projProdController = new ProductController();

            this.Product = projProdController.GetProductById(productId);

            this.FulFillContr = new FulfillmentController();
            FulfillmentController fulCont = new FulfillmentController();

            this.FulfillmentForEachProduct = fulCont.GetAllFulfillmentsForSingleProduct(projectId, productId);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["id"].ToString() != string.Empty)
                {
                    deptId = Convert.ToInt32(Request.QueryString["id"].ToString());

                    GetDepartmentForFulfillment d = new DepartmentController().actionGetDepartmentForFulfillment(deptId);
                    ui_content_title_label.Text = "Requistions from " + d.department_name;
                    //lblDeptName.Text = d.department_name;
                    lblCollectionPoint.Text = d.name;
                    lblReptName.Text        = d.representative_name;
                }

                FulfillmentController fc = new FulfillmentController();
                BindGridView();
            }
        }
示例#9
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the comboBox_ProjCritProdFulf control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// Erstellt von Veit Berg, am 27.01.16
        private void comboBox_ProjCritProdFulf_SelectedIndexChanged(object sender, EventArgs e)
        {
            try{
                if (formloaded > 2)
                {
                    Product  selectedValue = new Product();
                    ComboBox cmb           = (ComboBox)sender;
                    int      selectedIndex = cmb.SelectedIndex;
                    if (cmb.SelectedIndex > -1)
                    {
                        selectedValue = (Product)cmb.SelectedValue;

                        if (selectedValue != null)
                        {
                            using (FulfillmentController fuFiCont = new FulfillmentController())
                            {
                                int i            = 0;
                                var projProdFulf = fuFiCont.GetAllFulfillmentsForSingleProduct(PID, selectedValue.Product_Id);

                                foreach (Fulfillment singleProjProdFulf in projProdFulf)
                                {
                                    int    row      = i;
                                    bool   selected = singleProjProdFulf.Fulfilled;
                                    String note     = singleProjProdFulf.Comment;
                                    dataGridView_ProjCritProdFulf.Rows[row].Cells["Erfüllung"].Value = selected;
                                    dataGridView_ProjCritProdFulf.Rows[row].Cells["Bemerkung"].Value = note;
                                    i++;
                                }
                            }
                        }
                    }
                }
                formloaded++;
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }
        }
        /// <summary>
        /// Eigentliche Print Methode um Pdf zu befüllen
        /// </summary>
        ///
        /// Erstellt von Adrian Glasnek

        private void PrintCriterionStructure(ref PdfPTable CritTable, List <ProjectProduct> productsInTable)
        {
            FulfillmentController fufiCont = new FulfillmentController();
            List <Fulfillment>    fufiList = fufiCont.GetAllFulfillmentsForOneProject(this.Project.Project_Id);

            //Übergebene Liste von Methode "GetSortedCriterionStructure()" in Liste sortedProjectCriterionStructure schreiben
            List <ProjectCriterion> sortedProjectCriterionStructure = this.ProjCritContr.GetSortedCriterionStructure(this.Project.Project_Id);

            // Generische Liste - Dictionary Wertepaar vom Typ int - Schlüssel und Wert
            Dictionary <int, int> enumerations = new Dictionary <int, int>()
            {
                { 1, 0 }
            };


            //Foreach-Schleife druckt sortierte Kriterien auf das Pdf Dokument
            foreach (ProjectCriterion projectCriterion in SortedProjectCriterionStructure)
            {
                //Definieren der intend Variable um die richtige "Einrückung" auf dem Pdf Dokument erzielen zu können
                int layer  = projectCriterion.Layer_Depth;
                int factor = 25;
                int intend;
                intend = layer * factor;

                //Aufzählunszahlen für die Kriterienstruktur in einen string schreiben
                string enumeration = GetEnumerationForCriterion(ref enumerations, layer);

                //Schriftgröße der angezeigten Kriterienstruktur bestimmen
                Font CritStructFont = FontFactory.GetFont("Arial", 10);
                Font numbers        = FontFactory.GetFont("Arial_BOLD", 7, Font.NORMAL);

                //Paragraph der die Zellen befüllt
                string CritsEnumeration = "[" + enumeration + "]" + " " + projectCriterion.Criterion.Description.ToString();

                Paragraph para = new Paragraph(CritsEnumeration, CritStructFont);
                //Einrückungsfaktor, das zugehörige Kriterien untereinander stehen
                para.IndentationLeft = intend;
                //Neue Tabellenzelle in der die Kriterienbeschreibung reingeschrieben wird
                PdfPCell Crits = new PdfPCell();
                //Der Zelle den Paragraphen übergeben
                Crits.AddElement(para);
                //Anzeigen von Linien im Pdf
                Crits.Border = 1;

                //Die Kriterienstruktur den zellen hinzufügen
                CritTable.AddCell(Crits);
                CritTable.AddCell(" ");
                if (projectCriterion.Weighting_Cardinal <= 0)
                {
                    CritTable.AddCell(new Paragraph("-", CritStructFont));
                }
                else
                {
                    CritTable.AddCell(new Paragraph("x", CritStructFont));
                }



                foreach (ProjectProduct projprod in productsInTable)
                {
                    //try catch Anweisung um Fehler abzufangen. Fehler: Für das Produkt sind keine oder nicht alle Erfülungen in der DB hinterlegt
                    try
                    {
                        //Abfrage der Erfüllungen
                        Fulfillment fulfillForThisProdAndThisCrit = fufiList.Single(
                            fufi => fufi.Project_Id == projectCriterion.Project_Id &&
                            fufi.Product_Id == projprod.Product_Id &&
                            fufi.Criterion_Id == projectCriterion.Criterion.Criterion_Id);

                        //Wenn ein Kriterium erfüllt ist wird ein x gesetzt ansonsten ein -
                        if (fulfillForThisProdAndThisCrit.Fulfilled == true)
                        {
                            CritTable.AddCell(new Paragraph("x", CritStructFont));
                        }
                        else
                        {
                            CritTable.AddCell(new Paragraph("-", CritStructFont));
                        }
                    }

                    catch
                    {
                        throw new ApplicationException("Warnung!\n Nicht für alle Produkte des Projekts sind Erfüllungen hinterlegt! Bitte überprüfen Sie Ihre Eingaben! ");
                    }
                }
            }
        }
示例#11
0
        /// <summary>
        /// Handles the Click event of the btn_ProjCritProdFulfSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// Erstellt von Veit Berg, am 27.01.16
        private void btn_ProjCritProdFulfSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox_ProjCritProdFulf.SelectedIndex != -1)
                {
                    using (FulfillmentController fulCont = new FulfillmentController())
                    {
                        bool saveSucceeded = true;
                        foreach (DataGridViewRow row in dataGridView_ProjCritProdFulf.Rows)
                        {
                            if (CommonMethods.CheckIfForbiddenDelimiterInDb((string)row.Cells["Bemerkung"].Value))
                            {
                                CommonMethods.MessageForbiddenDelimiterWasFoundInText();
                                break;
                            }
                            else
                            {
                                Fulfillment fulFi = new Fulfillment();
                                fulFi.Criterion_Id = (int)row.Cells[0].Value;
                                fulFi.Project_Id   = Project.Project_Id;
                                int     selectedIndex = comboBox_ProjCritProdFulf.SelectedIndex;
                                Product selectedValue = new Product();
                                selectedValue = (Product)comboBox_ProjCritProdFulf.SelectedItem;


                                fulFi.Product_Id = selectedValue.Product_Id;
                                fulFi.Comment    = (string)row.Cells["Bemerkung"].Value;
                                if ((bool)row.Cells["Erfüllung"].Value == true)
                                {
                                    fulFi.Fulfilled = true;
                                }
                                else if ((bool)row.Cells["Erfüllung"].Value == false)
                                {
                                    fulFi.Fulfilled = false;
                                }

                                if (!fulCont.UpdateFulfillmentEntry(fulFi))
                                {
                                    saveSucceeded = false;
                                }
                            }
                        }
                        if (saveSucceeded)
                        {
                            MessageBox.Show("Die Änderungen wurden erfolgreich gespeichert.");
                        }
                        else
                        {
                            MessageBox.Show("Beim Speichern ist ein Fehler unterlaufen.");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Sie müssen ein Produkt auswählen.");
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }
        }