private AcroFields InputFormFields(Device device, PdfStamper pdfStamper)
        {
            AcroFields tmpFields = pdfStamper.AcroFields;
            string     unitPrice = GetUnitPrice();

            if (string.IsNullOrEmpty(unitPrice))
            {
                return(null);
            }
            tmpFields.SetField("topmostSubform[0].Page1[0].Department[0]", "FCBDD");
            // .SetField("topmostSubform[0].Page1[0].Asterisked_items_____must_be_completed_by_the_department[0]", CurrentDevice.strAssetTag)
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined[0]", device.Serial);
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_2[0]", MunisFunctions.GetVendorNameFromPO(device.PO));
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_3[0]", device.Description);
            //.SetField("topmostSubform[0].Page1[0]._1[0]", "6")
            // .SetField("topmostSubform[0].Page1[0]._2[0]", "7")
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_4[0]", device.PO);
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_5[0]", AssetManagerFunctions.GetMunisCodeFromAssetCode(device.Location));
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_6[0]", AttributeFunctions.DepartmentOf(device.Location));
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_7[0]", AssetManagerFunctions.GetMunisCodeFromAssetCode(device.EquipmentType));
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_8[0]", "GP");
            //.SetField("topmostSubform[0].Page1[0].undefined_9[0]", "13")
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_10[0]", "1");
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_11[0]", unitPrice);
            tmpFields.SetField("topmostSubform[0].Page1[0].undefined_12[0]", device.PurchaseDate.ToString("MM/dd/yyyy"));
            tmpFields.SetField("topmostSubform[0].Page1[0].Date[0]", DateTime.Now.ToString("MM/dd/yyyy"));
            return(tmpFields);
        }
 private void MunisSearchButton_Click(object sender, EventArgs e)
 {
     MunisUser = MunisFunctions.MunisUserSearch(this);
     if (!string.IsNullOrEmpty(MunisUser.Number))
     {
         CurrentUserTextBox.Text     = MunisUser.Name;
         CurrentUserTextBox.ReadOnly = true;
     }
 }
 private void MunisInfoButton_Click(object sender, EventArgs e)
 {
     try
     {
         MunisFunctions.LoadMunisInfoByDevice(currentViewDevice, this);
     }
     catch (Exception ex)
     {
         ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
     }
 }
示例#4
0
        public async void StartSearch()
        {
            try
            {
                // Prompt user for supervisor.
                var supervisorMunis = MunisFunctions.MunisUserSearch(this);

                // Make sure we have an employee number to work with.
                if (string.IsNullOrEmpty(supervisorMunis.Number))
                {
                    return;
                }

                var supervisorThis = new Employee(supervisorMunis.Name, supervisorMunis.Number);
                currentSupervisor = supervisorThis;

                // Setup form and display working spinner.
                this.Text += " for " + supervisorThis.Name;
                this.Show();
                workingSpinner.Visible = true;

                // Populate the employee list.
                employeeList = await GetEmployeeList();

                // Make sure the form hasn't been disposed.
                if (!this.IsDisposed)
                {
                    // Build employee hierarchy tree.
                    var empTree = GetSubordinates(supervisorThis);
                    currentTree = empTree;
                    // Build node tree from the employee tree.
                    var nodeTree = new TreeNode(empTree.Employee.Name);
                    nodeTree.Tag = empTree.Employee.Number;
                    BuildTree(empTree, nodeTree);
                    // Set the tree view control to the node tree.
                    HierarchyTree.Nodes.Add(nodeTree);
                    HierarchyTree.Nodes[0].Expand();
                    // Report completion.
                    statusLabel.Text = employeesFound + " employees found.";
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                // Stop the spinner and remove the big employee list from scope.
                workingSpinner.Visible = false;
                employeeList?.Clear();
                employeeList = null;
            }
        }
示例#5
0
        private void InitToolItems(ExtendedForm parentForm)
        {
            var toolItemList = new List <ToolStripMenuItem>();

            toolItemList.Add(NewToolItem("tsmUserOrgObLookup", "User Lookup", () => MunisFunctions.NameSearch(parentForm)));
            toolItemList.Add(NewToolItem("tsmOrgObLookup", "Org/Obj Lookup", () => MunisFunctions.OrgObjSearch(parentForm)));
            toolItemList.Add(NewToolItem("tsmPOLookUp", "PO Lookup", () => MunisFunctions.POSearch(parentForm)));
            toolItemList.Add(NewToolItem("tsmReqNumLookUp", "Requisition # Lookup", () => MunisFunctions.ReqSearch(parentForm)));
            toolItemList.Add(NewToolItem("tsmDeviceLookUp", "Device Lookup", () => MunisFunctions.AssetSearch(parentForm)));

            foreach (var item in toolItemList)
            {
                AddToolItem(item);
            }
        }
        private async void PriceFromMunis()
        {
            try
            {
                OtherFunctions.Message("Please Double-Click a MUNIS line item on the following window.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Input Needed");
                var SelectedPrice = await MunisFunctions.NewMunisReqSearch(MunisFunctions.GetReqNumberFromPO(currentDevice.PO), MunisFunctions.GetFYFromPO(currentDevice.PO), parentForm, true);

                decimal decPrice          = Convert.ToDecimal(SelectedPrice);
                var     SelectedUnitPrice = decPrice.ToString("C");
                currentDialog.SetControlValue(unitPriceTxtName, SelectedUnitPrice);
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
        public void ImportFromSibi(string itemGuid)
        {
            string   itemQuery      = Queries.SelectSibiRequestAndItemByItemGuid(itemGuid);
            DateTime POPurchaseDate = default(DateTime);

            using (var results = DBFactory.GetDatabase().DataTableFromQueryString(itemQuery))
            {
                controlParser.DisableFields();
                controlParser.FillDBFields(results, ImportColumnRemaps());
                MunisUser      = LevenshteinSearch.SmartEmployeeSearch(results.Rows[0][SibiRequestItemsCols.User].ToString().ToUpper());
                POPurchaseDate = MunisFunctions.GetPODate(results.Rows[0][SibiRequestCols.PO].ToString());
            }

            CurrentUserTextBox.Text = MunisUser.Name;
            CheckFields();
            PurchaseDatePicker.Value = POPurchaseDate;
            controlParser.EnableFields();
        }
 private void MunisSearchButton_Click(object sender, EventArgs e)
 {
     MunisUser = MunisFunctions.MunisUserSearch(this);
 }
示例#9
0
        /// <summary>
        /// Populates the PO and Reqisition status dictionaries which are used in the <see cref="SetMunisStatuses"/> method.
        /// </summary>
        /// <remarks>
        /// This is done to avoid querying the database too frequently. We only update the values from the database at more critical moments.
        /// </remarks>
        private async void GetMunisStatuses()
        {
            try
            {
                // Only allow one instance to run at a time.
                if (munisStatusRefreshing)
                {
                    return;
                }

                munisStatusRefreshing = true;

                poStatuses.Clear();
                reqStatuses.Clear();

                var dataSource = (DataTable)SibiResultGrid.DataSource;

                if (dataSource == null)
                {
                    return;
                }

                foreach (DataRow row in dataSource.Rows)
                {
                    if (row[SibiRequestCols.PO] != null)
                    {
                        var poVal = row[SibiRequestCols.PO].ToString();
                        int poInt = 0;

                        if (int.TryParse(poVal, out poInt))
                        {
                            var poStatus = await MunisFunctions.GetPOStatusFromPO(poInt);

                            if (!poStatuses.ContainsKey(poInt))
                            {
                                poStatuses.Add(poInt, poStatus);
                            }
                        }
                    }

                    if (row[SibiRequestCols.RequisitionNumber] != null)
                    {
                        var reqVal     = row[SibiRequestCols.RequisitionNumber].ToString();
                        var fiscalYear = ((DateTime)row[SibiRequestCols.NeedBy]).Year;
                        int reqInt     = 0;

                        if (int.TryParse(reqVal, out reqInt))
                        {
                            var reqStatus = await MunisFunctions.GetReqStatusFromReqNum(reqVal, fiscalYear);

                            var reqKey = reqInt.ToString() + fiscalYear.ToString();
                            if (!reqStatuses.ContainsKey(reqKey))
                            {
                                reqStatuses.Add(reqKey, reqStatus);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                munisStatusRefreshing = false;
            }
        }