Ejemplo n.º 1
0
        private CacheManager()
        {
            EquipmentDAO equipmentDAO         = DataManager.getEquipmentDAO();
            HelpDAO      helpDAO              = DataManager.getHelpDAO();
            StandardUnitMeasurementDAO sumDAO = DataManager.getStandardUnitMeasurementDAO();
            SignalDAO       signalDAO         = DataManager.getSignalDAO();
            LookupTablesDAO lookupTablesDAO   = DataManager.getLookupTablesDAO();

            loadCacheItem <dbConnector>(equipmentDAO, LuConnectorBean._TABLE_NAME,
                                        "getConnectors", LuConnectorBean._CONNECTOR_TYPE);
            loadCacheItem <LuNamespaceBean>(lookupTablesDAO, LuNamespaceBean._TABLE_NAME,
                                            "getNamespaceLookup", LuNamespaceBean._XMLNS);
            loadCacheItem <HelpMessageBean>(helpDAO, HelpMessageBean._TABLE_NAME,
                                            "getHelpMessages", HelpMessageBean._MESSAGE_KEY);
            loadCacheItem <StandardUnitMeasurementBean>(sumDAO, StandardUnitMeasurementBean._TABLE_NAME,
                                                        "getLimitsActiveStandardUnitMeasurementBeans", StandardUnitMeasurementBean._ID);
            loadCacheItem <StandardUnitPrefixBean>(sumDAO, StandardUnitPrefixBean._TABLE_NAME,
                                                   "getAllStandardUnitPrefixBeans", StandardUnitPrefixBean._ID);
            loadCacheItem <dbSignal>(signalDAO, SignalMasterBean._TABLE_NAME,
                                     "getAllSignals", SignalMasterBean._SIGNAL_ID);
            loadCacheItem <dbSignal>(signalDAO, TestSignalLibraryBean._TABLE_NAME,
                                     "GetAllTsfSignals", SignalMasterBean._SIGNAL_ID);
            loadCacheItem <dbCountry>(lookupTablesDAO, LuCountryBean._TABLE_NAME,
                                      "getActiveCountries", LuCountryBean._COUNTRY_CODE);
            loadCacheItem <DocumentType>(lookupTablesDAO, LuDocumentTypeBean._TABLE_NAME,
                                         "getDocumentTypes", LuDocumentTypeBean._TYPE_ID);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 비품 수정
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnModification_Click(object sender, EventArgs e)
        {
            DialogResult mbResult = MessageBox.Show("정말로 수정하시겠습니까? 수정기록은 남지 않습니다.", "비품수정", MessageBoxButtons.YesNo);

            if (mbResult == DialogResult.Yes)
            {
                if (tempEquipment.DetailName != txtDetailName.Text || tempEquipment.Location != txtLocation.Text || tempEquipment.PurchasePrice != float.Parse(txtPrice.Text) || tempEquipment.PurchaseDate != dtpPurchaseDate.Value.Date || tempEquipment.Note != txtNote.Text ||
                    tempEquipment.State != cbState.Text)
                {
                    EquipmentDAO dAO = new EquipmentDAO();
                    tempEquipment.DetailName    = txtDetailName.Text;
                    tempEquipment.Location      = txtLocation.Text;
                    tempEquipment.PurchasePrice = float.Parse(txtPrice.Text);
                    tempEquipment.PurchaseDate  = dtpPurchaseDate.Value.Date;
                    tempEquipment.Note          = txtNote.Text;
                    tempEquipment.State         = cbState.Text;

                    if (dAO.UpdateEquipment(tempEquipment))
                    {
                        MessageBox.Show("성공적으로 업데이트 했습니다.");
                    }
                    else
                    {
                        MessageBox.Show("업데이트에 실패했습니다.");
                    }
                }
            }
            btnSearch_Click(null, null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// DB로 저장
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtDetailName.Text == "")
            {
                MessageBox.Show("품목명을 입력해주세요");
                return;
            }
            EquipmentVO equipmentVO = new EquipmentVO()
            {
                DetailName    = txtDetailName.Text,
                Location      = txtLocation.Text,
                PurchasePrice = float.Parse(txtPrice.Text.Replace(",", "")),
                PurchaseDate  = dtpPurchaseDate.Value.Date,
                Note          = txtNote.Text
            };
            EquipmentDAO dAO = new EquipmentDAO();

            try
            {
                DialogResult resurt = MessageBox.Show("저장하시겠습니까?", "비품저장", MessageBoxButtons.YesNo);
                if (resurt == DialogResult.Yes)
                {
                    if (dAO.InsertEquipment(equipmentVO))
                    {
                        MessageBox.Show("성공적으로 저장되었습니다");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("저장실패" + ex.Message);
            }
        }
Ejemplo n.º 4
0
        List <EquipmentVO> tempEquipmentLst = new List <EquipmentVO>(); //페이지당 담을 데이터


        private void UcEquipment_Load(object sender, EventArgs e)
        {
            EquipmentDAO dAO = new EquipmentDAO();

            dgvEquipmentList.AllowUserToAddRows = false;
            chbDate.CheckState          = CheckState.Unchecked;
            dgvEquipmentList.DataSource = SetDataTable(dAO.AllequipmentVOsList());
            Paging();
        }
Ejemplo n.º 5
0
        private void FrmEquipment_Load(object sender, EventArgs e)
        {
            UcEquipment ucEquipment = new UcEquipment();

            ucEquipment.Location = new Point(0, 0);
            this.Controls.Add(ucEquipment);
            this.WindowState = FormWindowState.Maximized;
            EquipmentDAO dAO = new EquipmentDAO();
        }
Ejemplo n.º 6
0
 private DataManager()
 {
     equpmentDAO = new EquipmentDAO();
     signalDAO   = new SignalDAO();
     helpDAO     = new HelpDAO();
     standardUnitMeasurementDAO = new StandardUnitMeasurementDAO();
     lookupTablesDAO            = new LookupTablesDAO();
     documentDAO = new DocumentDAO();
     schemaDAO   = new SchemaDAO();
 }
        public IHttpActionResult Delete([FromUri] int id)
        {
            var rs = new EquipmentDAO().DeleteEquiptment(id);

            if (rs)
            {
                return(Ok());
            }

            return(Conflict());
        }
        public override void save()
        {
            base.save();
            EquipmentDAO dao = new EquipmentDAO();

            dao.deleteConnectorPins(ID);
            foreach (dbConnectorPin pin in pins)
            {
                pin.IncludeKeyOnInsert = true;
                pin.DataState          = eDataState.DS_ADD;
                pin.save();
            }
        }
        private void SaveCapabilities(IAtmlObject atmlObject, Capabilities capabilities)
        {
            var dao = new EquipmentDAO();

            dao.ClearEquipmentCapabilities(Guid.Parse(atmlObject.GetAtmlId()));
            if (!atmlObject.IsDeleted() && capabilities != null && capabilities.Items != null)
            {
                foreach (object item in capabilities.Items)
                {
                    var capability = item as Capability;
                    if (capability != null)
                    {
                        Save(atmlObject, capability);
                    }
                }
            }
        }
        public IHttpActionResult CheckQuantityAvailble(int id, int quantity)
        {
            string    messError = "";
            bool      rs        = new EquipmentDAO().isAvailbleQuantity(id, quantity);
            Equipment e         = new EquipmentDAO().GetEquipmentById(id);

            if (e != null)
            {
                messError = " Only " + e.Quantity + " items left in stock!";
            }
            if (rs)
            {
                return(Ok());
            }


            return(Content(HttpStatusCode.Conflict, messError));
        }
Ejemplo n.º 11
0
        private dbConnector PromptForNewConnector(String type, ComboBox cbPrimary, ComboBox cbSecondary)
        {
            dbConnector conn = null;

            if (type != null && cbPrimary.SelectedIndex == -1)
            {
                var dao = new EquipmentDAO();
                conn = dao.getConnector(type);
                if (conn == null)
                {
                    if (DialogResult.Yes ==
                        MessageBox.Show(
                            string.Format(
                                "Connector type \"{0}\" does not exist in the Connector Database, would you like to add it?",
                                type),
                            @"Add Connector",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Question))
                    {
                        conn                    = new dbConnector();
                        conn.DataState          = BASEBean.eDataState.DS_ADD;
                        conn.connectorType      = type;
                        conn.ID                 = Guid.NewGuid();
                        conn.IncludeKeyOnInsert = true;
                        conn.pinCount           = string.IsNullOrWhiteSpace(edtConnectorPinCount.Text)
                                            ? 0
                                            : int.Parse(edtConnectorPinCount.Text);
                        conn.save();
                    }
                }
                if (conn != null)
                {
                    cbPrimary.SelectedIndex = cbPrimary.Items.Add(conn);
                    cbSecondary.Items.Add(conn);
                }
            }
            else
            {
                conn = cbPrimary.SelectedItem as dbConnector;
            }
            return(conn);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 선택된 데이터 삭제
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (tempEquipment is null)
            {
                return;
            }
            EquipmentDAO dAO      = new EquipmentDAO();
            DialogResult mbResult = MessageBox.Show("정말로 삭제하시겠습니까? 삭제하면 기록에 남지 않습니다.", "비품삭제", MessageBoxButtons.YesNo);

            if (mbResult == DialogResult.Yes)
            {
                try
                {
                    dAO.DeleteEquipment(tempEquipment);
                }
                catch (Exception)
                {
                    MessageBox.Show("삭제하는데 실패 하였습니다", "삭제 실패", MessageBoxButtons.OK);
                }
            }
            btnSearch_Click(null, null);
        }
Ejemplo n.º 13
0
        private void ConnectorConfigurationForm_Saved(object sender, EventArgs e)
        {
            bool         added = false;
            Guid?        uuid  = _connector.ID;
            EquipmentDAO dao   = new EquipmentDAO();

            _configuration = dao.getConnectorConfiguration(uuid, edtConfigurationName.Text);
            if (_configuration == null)
            {
                _configuration                    = new dbConnectorConfiguration();
                _configuration.ID                 = Guid.NewGuid();
                _configuration.connectorId        = uuid;
                _configuration.configName         = edtConfigurationName.Text;
                _configuration.DataState          = BASEBean.eDataState.DS_ADD;
                _configuration.IncludeKeyOnInsert = true;
                added = true;
            }
            Configuration.Pins.Clear();
            int i = 1;

            if (_pins != null)
            {
                foreach (ConnectorPin connectorPin in _pins)
                {
                    dbConnectorPin pin = new dbConnectorPin();
                    pin.configId = _configuration.ID;
                    pin.pinIdx   = i++;
                    pin.pinName  = connectorPin.name;
                    if (connectorPin.Definition != null)
                    {
                        pin.pinDescription = connectorPin.Definition.Description;
                    }
                    Configuration.Pins.Add(pin);
                }
            }
            Configuration.save();
            LogManager.Info("Connector Pin Configuration \"{0}\" has been {1}", _configuration.configName, added ? "Added" : "Saved");
        }
 public NewCheckoutCreator()
 {
     _equipmentDAO = new EquipmentDAO();
 }
Ejemplo n.º 15
0
 public EquipmentsService()
 {
     lObjEquipmentDAO = new EquipmentDAO();
 }
        public static void Save(IAtmlObject atmlObject, Capability capability)
        {
            string id  = atmlObject.GetAtmlId();
            var    dao = new EquipmentDAO();

            if (capability.SignalDescription != null)
            {
                List <Signal> signals = SignalManager.ExtractSignalsFromExtension(capability.SignalDescription);
                foreach (Signal signal in signals)
                {
                    string   signalName      = signal.name;
                    string   signalNameSpace = signal.GetSignalNameSpace();
                    string   capabilityName  = capability.name;
                    object[] items           = signal.Items;

                    foreach (object item in items)
                    {
                        var element = item as XmlElement;
                        if (element != null)
                        {
                            XmlSchemaComplexType complexType;
                            string    elementName = element.Name;
                            string    localName   = element.LocalName;
                            XmlSchema schema      = SchemaManager.GetSchema(element.NamespaceURI);
                            SchemaManager.GetComplexType(element.NamespaceURI, localName, out complexType);
                            var xmlSchemaObjects =
                                new Dictionary <string, XmlSchemaObject>();
                            SchemaManager.ExtractAttributes(complexType, xmlSchemaObjects);


                            foreach (XmlAttribute attribute in element.Attributes)
                            {
                                string propertyName = attribute.Name;
                                string value        = attribute.Value;
                                try
                                {
                                    XmlSchemaAttribute schemaAttribute;
                                    SchemaManager.FindAttribute(element.NamespaceURI, localName, propertyName,
                                                                out schemaAttribute);
                                    bool   isPhysicalType = false;
                                    string typeName       = "";
                                    if (schemaAttribute != null)
                                    {
                                        XmlSchemaSimpleType simpleType = schemaAttribute.AttributeSchemaType;
                                        XmlQualifiedName    qn         = schemaAttribute.SchemaTypeName;
                                        isPhysicalType = SchemaManager.IsPhysicalType(simpleType);
                                        if (!isPhysicalType)
                                        {
                                            isPhysicalType = SchemaManager.IsPhysicalType(qn);
                                        }
                                    }

                                    Physical physical;

                                    try
                                    {
                                        physical = new Physical(value);
                                    }
                                    catch (Exception)
                                    {
                                        continue;
                                    }

                                    RangingInformation range = physical.GetMergedRange();
                                    //TODO: need SignalType, SignalNamespace
                                    if (range != null)
                                    {
                                        InstrumentCapabilitiesBean bean =
                                            dao.GetSignalCapabilityAttribute(Guid.Parse(id),
                                                                             capabilityName,
                                                                             signalName,
                                                                             propertyName);
                                        if (bean == null)
                                        {
                                            bean           = new InstrumentCapabilitiesBean();
                                            bean.DataState = BASEBean.eDataState.DS_ADD;
                                        }
                                        else
                                        {
                                            bean.DataState = atmlObject.IsDeleted()
                                                                 ? BASEBean.eDataState.DS_DELETE
                                                                 : BASEBean.eDataState.DS_EDIT;
                                        }
                                        //bean.signalType =;
                                        bean.capabilityName     = capabilityName;
                                        bean.signalNamespace    = signalNameSpace;
                                        bean.IncludeKeyOnInsert = true;
                                        bean.instrumentUuid     = id;
                                        bean.attribute          = propertyName;
                                        bean.signalName         = signalName;
                                        if (range.FromQuantity != null)
                                        {
                                            bean.lowValue = range.FromQuantity.NominalValue;
                                            bean.lowUnit  = range.FromQuantity.Unit.BaseUnitString;
                                        }
                                        if (range.ToQuantity != null)
                                        {
                                            bean.highValue = range.ToQuantity.NominalValue;
                                            bean.highUnit  = range.ToQuantity.Unit.BaseUnitString;
                                        }
                                        bean.save();
                                    }
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                            }
                        }
                        else
                        {
                            string       signalFunctionName = item.GetType().Name;
                            PropertyInfo piName             = item.GetType().GetProperty("name");
                            if (piName != null)
                            {
                                object value = piName.GetValue(item, null);
                                //if (value != null)
                                //   propertyName = value as string;
                            }
                            foreach (
                                PropertyInfo pi in
                                item.GetType()
                                .GetProperties(BindingFlags.Public | BindingFlags.Instance |
                                               BindingFlags.DeclaredOnly))
                            {
                                string propertyName = pi.Name;
                                object value        = pi.GetValue(item, null);
                                if (value != null)
                                {
                                    try
                                    {
                                        //TODO: need SignalType, SignalNamespace
                                        if (
                                            !SchemaManager.IsPhysicalType("urn:IEEE-1641:2010:STDBSC",
                                                                          signalFunctionName, propertyName))
                                        {
                                            continue;
                                        }
                                        var physicalValue = new Physical(value.ToString());
                                        Console.WriteLine(physicalValue.ToString());
                                        RangingInformation         range = physicalValue.GetMergedRange();
                                        InstrumentCapabilitiesBean bean  =
                                            dao.GetSignalCapabilityAttribute(Guid.Parse(id),
                                                                             capabilityName,
                                                                             signalName,
                                                                             pi.Name);
                                        if (bean == null)
                                        {
                                            bean           = new InstrumentCapabilitiesBean();
                                            bean.DataState = BASEBean.eDataState.DS_ADD;
                                        }
                                        else
                                        {
                                            bean.DataState = atmlObject.IsDeleted()
                                                                 ? BASEBean.eDataState.DS_DELETE
                                                                 : BASEBean.eDataState.DS_EDIT;
                                        }
                                        //bean.signalType =;
                                        bean.capabilityName     = capabilityName;
                                        bean.signalNamespace    = signalNameSpace;
                                        bean.IncludeKeyOnInsert = true;
                                        bean.instrumentUuid     = id;
                                        bean.attribute          = pi.Name;
                                        bean.signalName         = signalName;
                                        if (range != null)
                                        {
                                            if (range.FromQuantity != null)
                                            {
                                                bean.lowValue = range.FromQuantity.NominalValue;
                                                bean.lowUnit  = range.FromQuantity.Unit.BaseUnitString;
                                            }
                                            if (range.ToQuantity != null)
                                            {
                                                bean.highValue = range.ToQuantity.NominalValue;
                                                bean.highUnit  = range.ToQuantity.Unit.BaseUnitString;
                                            }
                                        }
                                        bean.save();
                                    }
                                    catch (Exception err)
                                    {
                                        LogManager.Error(err,
                                                         "Error Saving Capability [{0}] - Item:{1}, Value:{2}",
                                                         capability.name,
                                                         item.GetType().Name,
                                                         value
                                                         );
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
 public EquipmentViewer()
 {
     _equipmentDAO = new EquipmentDAO();
 }
Ejemplo n.º 18
0
        private static MailMessage MountBusinessPartnerBilling(DataConnector connector, String businessPartnerCode, Boolean enviarDemonstrativo)
        {
            ContractDAO     contractDAO     = new ContractDAO(connector.MySqlConnection);
            SubContractDAO  subContractDAO  = new SubContractDAO(connector.MySqlConnection);
            ContractItemDAO contractItemDAO = new ContractItemDAO(connector.MySqlConnection);
            EquipmentDAO    equipmentDAO    = new EquipmentDAO(connector.SqlServerConnection);

            List <ContractItemDTO> itemList = contractItemDAO.GetItems("businessPartnerCode = '" + businessPartnerCode + "'");
            Dictionary <int, List <ContractItemDTO> > itemGroups = new Dictionary <int, List <ContractItemDTO> >();

            foreach (ContractItemDTO item in itemList)
            {
                // Cria um novo grupo caso não encontre um grupo para este subcontrato
                if (!itemGroups.ContainsKey(item.subContrato_id))
                {
                    itemGroups.Add(item.subContrato_id, new List <ContractItemDTO>());
                }

                // Adiciona o item ao grupo do subcontrato
                List <ContractItemDTO> group = itemGroups[item.subContrato_id];
                group.Add(item);
            }

            String billingInfo = "Cliente: " + ObterNomeCliente(connector, businessPartnerCode) + "<br/><br/>";

            foreach (int subContractId in itemGroups.Keys)
            {
                List <ContractItemDTO> group = itemGroups[subContractId];
                String itemEnumeration       = "";
                foreach (ContractItemDTO contractItem in group)
                {
                    if (!String.IsNullOrEmpty(itemEnumeration))
                    {
                        itemEnumeration += ", ";
                    }
                    itemEnumeration += contractItem.codigoCartaoEquipamento;
                }
                List <EquipmentDTO> equipamentList = equipmentDAO.GetEquipments(itemEnumeration);
                String equipmentEnumeration        = "";
                foreach (EquipmentDTO equipment in equipamentList)
                {
                    if (!String.IsNullOrEmpty(equipmentEnumeration))
                    {
                        equipmentEnumeration += ", ";
                    }
                    equipmentEnumeration += equipment.ManufSN;
                }
                SubContractDTO subContract    = subContractDAO.GetSubContract(subContractId);
                ContractDTO    contract       = contractDAO.GetContract(subContract.contrato_id);
                Boolean        activeContract = true;
                if ((contract.status == 3) || (contract.status == 4))
                {
                    activeContract = false;
                }
                if (activeContract) // Não fatura caso o status do contrato seja finalizado ou cancelado
                {
                    String   parcela         = ObterParcelaContrato(connector, contract);
                    String   vendedor        = ObterNomeVendedor(connector, contract);
                    DateTime dataVencimento  = MountDate(contract.diaVencimento, contract.referencialVencimento);
                    String   contractInfo    = "Contrato: " + contract.numero + "<br/>" + "Parcela: " + parcela + "<br/>" + "Vendedor: " + vendedor + "<br/>" + "Data Vencimento: " + dataVencimento.ToString("dd/MM/yyyy") + "<br/>";
                    String   subContractInfo = subContract.siglaTipo + " - " + equipmentEnumeration + "<br/>";
                    billingInfo += contractInfo + subContractInfo + "<br/>";
                }
            }

            List <String> reportFiles = new List <String>();

            if (enviarDemonstrativo)
            {
                reportFiles = BuildReportFiles("faturamentoCliente.php", "businessPartnerCode=" + businessPartnerCode);
            }

            MailMessage mailMessage = new MailMessage();

            mailMessage.Subject = "Faturamento de contrato";
            mailMessage.Body    = "Email gerado automaticamente, não responder." + "<br/><br/>" + billingInfo;
            foreach (String filename in reportFiles)
            {
                mailMessage.Attachments.Add(new Attachment(filename));
            }

            return(mailMessage);
        }
Ejemplo n.º 19
0
        private static MailMessage MountContractBilling(DataConnector connector, int contractId, int subContractId, Boolean enviarDemonstrativo)
        {
            ContractDAO     contractDAO     = new ContractDAO(connector.MySqlConnection);
            SubContractDAO  subContractDAO  = new SubContractDAO(connector.MySqlConnection);
            ContractItemDAO contractItemDAO = new ContractItemDAO(connector.MySqlConnection);
            EquipmentDAO    equipmentDAO    = new EquipmentDAO(connector.SqlServerConnection);

            ContractDTO           contract        = contractDAO.GetContract(contractId);
            String                contractItems   = "";
            List <SubContractDTO> subContractList = subContractDAO.GetSubContracts("contrato_id=" + contract.id);

            foreach (SubContractDTO subContract in subContractList)
            {
                List <ContractItemDTO> itemList = contractItemDAO.GetItems("subcontrato_id = " + subContract.id);
                String equipmentEnumeration     = "";
                foreach (ContractItemDTO contractItem in itemList)
                {
                    if (!String.IsNullOrEmpty(equipmentEnumeration))
                    {
                        equipmentEnumeration += ", ";
                    }
                    equipmentEnumeration += contractItem.codigoCartaoEquipamento;
                }
                List <EquipmentDTO> equipamentList = equipmentDAO.GetEquipments(equipmentEnumeration);
                String serialNumbers = "";
                foreach (EquipmentDTO equipment in equipamentList)
                {
                    if (!String.IsNullOrEmpty(serialNumbers))
                    {
                        serialNumbers += ", ";
                    }
                    serialNumbers += equipment.ManufSN;
                }
                if (String.IsNullOrEmpty(serialNumbers))
                {
                    serialNumbers = "Nenhum item encontrado";
                }
                contractItems += subContract.siglaTipo + " - " + serialNumbers + "<br/>";
            }

            String   cliente        = ObterNomeCliente(connector, contract.pn);
            String   parcela        = ObterParcelaContrato(connector, contract);
            String   vendedor       = ObterNomeVendedor(connector, contract);
            DateTime dataVencimento = MountDate(contract.diaVencimento, contract.referencialVencimento);
            String   billingInfo    = "Contrato: " + contract.numero + "<br/>" + "Itens: " + contractItems + "<br/>" + "Cliente: " + cliente + "<br/>" + "Parcela: " + parcela + "<br/>" + "Vendedor: " + vendedor + "<br/>" + "Data Vencimento: " + dataVencimento.ToString("dd/MM/yyyy") + "<br/>";

            List <String> reportFiles = new List <String>();

            if (enviarDemonstrativo)
            {
                reportFiles = BuildReportFiles("faturamentoContrato.php", "contractId=" + contractId + "&subContractId=" + subContractId);
            }

            MailMessage mailMessage = new MailMessage();

            mailMessage.Subject = "Faturamento de contrato";
            mailMessage.Body    = "Email gerado automaticamente, não responder." + "<br/><br/>" + billingInfo;
            foreach (String filename in reportFiles)
            {
                mailMessage.Attachments.Add(new Attachment(filename));
            }

            return(mailMessage);
        }
        public HttpResponseMessage Update(Equipment equipment)
        {
            var rs = new EquipmentDAO().UpdateEquipment(equipment);

            return(rs == true ?  new HttpResponseMessage(HttpStatusCode.OK) : new HttpResponseMessage(HttpStatusCode.BadRequest));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 검색 기능 버튼 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            currentPage = 1;
            EquipmentDAO dAO       = new EquipmentDAO();
            string       tempState = "";

            if (rbDiscard.Checked)
            {
                tempState = "폐기";
            }
            else if (rbUsing.Checked)
            {
                tempState = "사용중";
            }
            else if (rbReplacementRequest.Checked)
            {
                tempState = "교체요망";
            }

            if (chbDate.Checked)
            {
                if (!(dtpStartDate.Value < dtpEndDate.Value))
                {
                    DateTime temp = dtpEndDate.Value;
                    dtpEndDate.Value   = dtpStartDate.Value;
                    dtpStartDate.Value = temp;
                }

                EquipmentVO equipment = new EquipmentVO()
                {
                    DetailName    = txtSearchForName.Text,
                    Location      = txtSearchForLocation.Text,
                    PurchaseDate  = dtpStartDate.Value,
                    PurchasePrice = float.Parse(txtSearchForPrice.Text),
                    State         = tempState
                };

                DateTime endDate = dtpEndDate.Value;
                try
                {
                    dgvEquipmentList.DataSource = SetDataTable(dAO.SelectSearch(equipment, endDate));
                }
                catch (Exception)
                {
                    MessageBox.Show("검색오류");
                }
            }
            else
            {
                EquipmentVO equipment = new EquipmentVO()
                {
                    DetailName    = txtSearchForName.Text,
                    Location      = txtSearchForLocation.Text,
                    PurchaseDate  = DateTime.Parse("1753-1-1"),
                    PurchasePrice = float.Parse(txtSearchForPrice.Text),
                    State         = tempState
                };
                dgvEquipmentList.DataSource = SetDataTable(dAO.SelectSearch(equipment, DateTime.Parse("1753-1-1")));
            }
            Paging();
        }