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 DeleteDevice()
        {
            SecurityTools.CheckForAccess(SecurityGroups.DeleteDevice);

            var blah = OtherFunctions.Message("Are you absolutely sure?  This cannot be undone and will delete all historical data, tracking and attachments.", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, "WARNING", this);

            if (blah == DialogResult.Yes)
            {
                if (AssetManagerFunctions.DeleteDevice(currentViewDevice.Guid))
                {
                    OtherFunctions.Message("Device deleted successfully.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Device Deleted", this);
                    currentViewDevice = null;
                    ParentForm.RefreshData();
                }
                else
                {
                    Logging.Logger("*****DELETION ERROR******: " + currentViewDevice.Guid);
                    OtherFunctions.Message("Failed to delete device succesfully!  Please let Bobby Lovell know about this.", MessageBoxButtons.OK, MessageBoxIcon.Error, "Delete Failed", this);
                    currentViewDevice = null;
                }
                this.Dispose();
            }
            else
            {
                return;
            }
        }
        private void OpenSibiLink(Device device)
        {
            try
            {
                SecurityTools.CheckForAccess(SecurityGroups.ViewSibi);

                if (string.IsNullOrEmpty(device.PO))
                {
                    OtherFunctions.Message("A valid PO Number is required.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Missing Info", this);
                    return;
                }
                else
                {
                    string sibiGuid = AssetManagerFunctions.GetSqlValue(SibiRequestCols.TableName, SibiRequestCols.PO, device.PO, SibiRequestCols.Guid);

                    if (string.IsNullOrEmpty(sibiGuid))
                    {
                        OtherFunctions.Message("No Sibi request found with matching PO number.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Not Found", this);
                    }
                    else
                    {
                        if (!Helpers.ChildFormControl.FormIsOpenByGuid(typeof(SibiManageRequestForm), sibiGuid))
                        {
                            new SibiManageRequestForm(this, sibiGuid);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
 private void SelectEmp()
 {
     if (!string.IsNullOrEmpty(selectedEmpInfo.Name) && !string.IsNullOrEmpty(selectedEmpInfo.Number))
     {
         AssetManagerFunctions.AddNewEmp(selectedEmpInfo);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         this.DialogResult = DialogResult.Abort;
         this.Close();
     }
 }
        private void AddDevice()
        {
            try
            {
                if (!CheckFields())
                {
                    OtherFunctions.Message("Some required fields are missing or invalid.  Please fill and/or verify all highlighted fields.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Missing Data", this);
                    return;
                }
                else
                {
                    if (AssetManagerFunctions.DeviceExists(AssetTagTextBox.Text.ToString().Trim(), SerialTextBox.Text.ToString().Trim()))
                    {
                        OtherFunctions.Message("A device with that serial and/or asset tag already exists.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Duplicate Device", this);
                        return;
                    }
                    bool Success = AddNewDevice();
                    if (Success)
                    {
                        ParentForm.RefreshData();
                        var blah = OtherFunctions.Message("New Device Added.   Add another?", MessageBoxButtons.YesNo, MessageBoxIcon.Information, "Complete", this);
                        if (!NoClearCheckBox.Checked)
                        {
                            ClearAll();
                        }
                        if (blah == DialogResult.No)
                        {
                            this.Dispose();
                        }
                    }
                    else
                    {
                        OtherFunctions.Message("Something went wrong while adding a new device.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Unexpected Result", this);
                    }

                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                OtherFunctions.Message("Unable to add new device.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Error", this);
            }
        }
Exemple #6
0
 // Wrapper to shorten calls.
 public string GetString(string name)
 {
     return(AssetManagerFunctions.GetDeployString(name));
 }
 public void UpdateAttachCountHandler(object sender, EventArgs e)
 {
     AssetManagerFunctions.SetAttachmentCount(AttachmentsToolButton, currentViewDevice.Guid, new DeviceAttachmentsCols());
 }
 private void PingHistLabel_Click(object sender, EventArgs e)
 {
     AssetManagerFunctions.ShowPingHistory(this, currentViewDevice);
 }
        public async void SetPingHistoryLink()
        {
            bool hasPingHist = await AssetManagerFunctions.HasPingHistory(currentViewDevice);

            PingHistLabel.Visible = hasPingHist;
        }