Beispiel #1
0
        public static List <Custo> SelectCustoAll()
        {
            List <Custo>    custos = new List <Custo>();
            string          sql    = "select * from USERINFO u,USERTYPE t,PASSPORTTYPE p,sextype s where u.CustoType=t.UserType and u.PassportType=p.PassportId and s.sexId = u.CustoSex";
            MySqlDataReader dr     = DBHelper.ExecuteReader(sql);

            while (dr.Read())
            {
                Custo cso = new Custo();
                cso.CustoNo      = (string)dr["CustoNo"];
                cso.CustoName    = dr["CustoName"].ToString();
                cso.SexName      = Convert.ToString(dr["SexName"]);
                cso.CustoTel     = Convert.ToString(dr["CustoTel"]);
                cso.PassportType = Convert.ToInt32(dr["PassportType"]);
                cso.CustoID      = dr["CustoID"].ToString();
                if (!DBNull.Value.Equals(dr["CustoAdress"]))
                {
                    cso.CustoAdress = (string)dr["CustoAdress"];
                }
                else
                {
                    cso.CustoAdress = "";
                }
                cso.CustoBirth   = DateTime.Parse(dr["CustoBirth"].ToString());
                cso.CustoType    = Convert.ToInt32(dr["CustoType"]);
                cso.typeName     = (string)dr["TypeName"];
                cso.PassportName = (string)dr["PassportName"];
                custos.Add(cso);
            }
            dr.Close();
            DBHelper.Closecon();
            return(custos);
        }
Beispiel #2
0
        private void picSearch_Click(object sender, EventArgs e)
        {
            picSearch.BackgroundImage = Resources.搜索__1;
            List <Custo> c = new List <Custo>();

            picAddCusto.BackgroundImage = Resources.添_加a;
            picSearch.BackgroundImage   = Resources.搜索__1a;
            if (txtCardID.Text != "")
            {
                Custo cto = DAL.CustoDao.SelectCustoInfoByCardId(txtCardID.Text);
                if (c != null)
                {
                    c.Add(cto);
                    dgvCustomerList.DataSource = c;
                }
                else
                {
                    MessageBox.Show("用户不存在!", "提示");
                }
            }
            else
            {
                c = DAL.CustoDao.SelectCustoAll();
                dgvCustomerList.DataSource = c;
            }
            picSearch.BackgroundImage = Resources.搜索__1a;
        }
        public Produto(string codigo, string referencia, string descricao, string descricaoReduzida, string detalhamento, string ean, Ncm ncm, Categoria categoria, UnidadeMedida unidadeMedida, Fornecedor fornecedor, decimal valorUnidadeMedica, Custo custo, decimal valorUnitario, int quantidade)
        {
            Codigo            = codigo;
            Referencia        = referencia;
            Descricao         = descricao;
            DescricaoReduzida = descricaoReduzida;
            Detalhamento      = detalhamento;
            Ean                = ean;
            Ncm                = ncm;
            Categoria          = categoria;
            UnidadeMedida      = unidadeMedida;
            Fornecedor         = fornecedor;
            ValorUnidadeMedica = valorUnidadeMedica;
            Custo              = custo;
            ValorUnitario      = valorUnitario;
            Quantidade         = quantidade;

            AddNotifications(Ncm, Categoria, UnidadeMedida, Fornecedor, Custo, new Contract()
                             .Requires()
                             .HasMinLen(Codigo, 1, "Produto.Codigo", "Codigo deve conter pele menos 1 caracter")
                             .HasMaxLen(Codigo, 100, "Produto.Codigo", "Codigo deve conter no máximo 100 caracteres")
                             .HasMinLen(Descricao, 1, "Produto.Descricao", "Descrição deve conter pele menos 1 caracter")
                             .HasMaxLen(Descricao, 100, "Produto.Descricao", "Descrição deve conter no máximo 100 caracteres")
                             .HasMinLen(Detalhamento, 1, "Produto.Detalhamento", "Codigo deve conter pele menos 1 caracter")
                             .HasMaxLen(Detalhamento, 100, "Produto.Detalhamento", "Detalhamento deve conter no máximo 100 caracteres")
                             );
        }
Beispiel #4
0
        public async Task <IActionResult> PutCusto(int id, Custo custo)
        {
            if (id != custo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(custo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                if (!CustoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw ex;
                }
            }

            return(NoContent());
        }
        public Result <Custo> SaveCustomer(Custo c)
        {
            var    result = new Result <Custo>();
            string query  = "select * from customer where customer_no = '" + c.customer_no + "'";
            var    dt     = DataAccess.GetDataTable(query);

            if (dt == null || dt.Rows.Count == 0)
            {
                query = "Insert into customer values ('" + c.customer_Name + "','" + c.customer_contact_no + "','" + c.customer_email + "','" + c.customer_address + ")";
            }
            else
            {
                query = "Update customer set customer_name = '" + c.customer_Name + "',customer_contact_no='" + c.customer_contact_no + "',customer_email='" + c.customer_email + "',customer_address='" + c.customer_address + "' where id = '" + c.customer_no + "'";
            }

            result.HasError = DataAccess.ExecuteQuery(query) <= 0;
            if (result.HasError)
            {
                result.Message = "Wrong";
            }
            else
            {
                result.Data = c;
            }

            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// Preenche as propriedades do objeto ExtratoFinanceiro
        /// </summary>
        /// <param name="extratoFinanceiroDto"></param>
        /// <param name="mesComRubricas"></param>
        /// <param name="mes"></param>
        /// <param name="anoPlanejado"></param>
        private void PreencherExtratoFinanceiro(ExtratoFinanceiroDto extratoFinanceiroDto,
                                                IEnumerable <RubricaMesDto> mesComRubricas, CsMesDomain mes,
                                                int anoPlanejado)
        {
            Decimal aportePlanejado = CalcularAportePlanejado(mesComRubricas);

            Custo aporteReal = CalcularAporteReal(mesComRubricas);

            Custo despesasAdministrativas = CalcularDespesasAdministrativas(mesComRubricas);
            Custo despesasDesenvolvimento = CalcularDespesasDesenvolvimento(mesComRubricas);

            Custo despesasReais = despesasAdministrativas + despesasDesenvolvimento;

            extratoFinanceiroDto.Total.Acumulado += aporteReal - despesasReais;

            String anoPlanejadoString = Convert.ToString(anoPlanejado);

            int mesJavascript = SelecionarMesJavascript(mes);

            extratoFinanceiroDto.Anos[anoPlanejadoString][mesJavascript] = new DespesasAportes
            {
                AportePlanejado = aportePlanejado,
                AporteRealizado = aporteReal,
                DespesasReaisAdministrativas = despesasAdministrativas,
                DespesasReaisDesenvolvimento = despesasDesenvolvimento,
                Acumulado = extratoFinanceiroDto.Total.Acumulado
            };

            extratoFinanceiroDto.Total.AportePlanejado += aportePlanejado;
            extratoFinanceiroDto.Total.AporteRealizado += aporteReal;

            extratoFinanceiroDto.Total.DespesasReaisAdministrativas += despesasAdministrativas;
            extratoFinanceiroDto.Total.DespesasReaisDesenvolvimento += despesasDesenvolvimento;
        }
Beispiel #7
0
        /// <summary>
        /// Preenche as propriedades do objeto Detalhamento
        /// </summary>
        /// <param name="extratoProjetoDto">Objeto extratoProjetoDto</param>
        /// <param name="mesComRubricas">Objetos RubricaMesDto</param>
        /// <param name="mes">mês de que se fala</param>
        /// <param name="anoPlanejado">ano de que se fala</param>
        private void PreencherExtratoProjeto(ExtratoProjetoDto extratoProjetoDto, IEnumerable <RubricaMesDto> mesComRubricas,
                                             CsMesDomain mes,
                                             int anoPlanejado)
        {
            Decimal orcamentoDesenvolvimento = CalcularOrcamentoDesenvolvimento(mesComRubricas);
            Custo   despesasDesenvolvimento  = CalcularDespesasDesenvolvimento(mesComRubricas);

            Decimal orcamentoAdministrativo = CalcularOrcamentoAdministrativo(mesComRubricas);
            Custo   despesasAdministrativas = CalcularDespesasAdministrativas(mesComRubricas);

            Custo resultadoMensal = (orcamentoAdministrativo + orcamentoDesenvolvimento) -
                                    despesasAdministrativas - despesasDesenvolvimento;

            extratoProjetoDto.Total.Acumulado += resultadoMensal;

            String anoPlanejadoString = Convert.ToString(anoPlanejado);

            int mesJavascript = SelecionarMesJavascript(mes);

            extratoProjetoDto.Anos[anoPlanejadoString][mesJavascript] = new OrcamentoDespesas
            {
                OrcamentoAprovadoAdministracao   = orcamentoAdministrativo,
                OrcamentoAprovadoDesenvolvimento = orcamentoDesenvolvimento,
                DespesasAdministrativas          = despesasAdministrativas,
                DespesasDesenvolvimento          = despesasDesenvolvimento,
                ResultadoMensal = resultadoMensal,
                Acumulado       = extratoProjetoDto.Total.Acumulado
            };

            extratoProjetoDto.Total.OrcamentoAprovadoAdministracao   += orcamentoAdministrativo;
            extratoProjetoDto.Total.OrcamentoAprovadoDesenvolvimento += orcamentoDesenvolvimento;
            extratoProjetoDto.Total.DespesasAdministrativas          += despesasAdministrativas;
            extratoProjetoDto.Total.DespesasDesenvolvimento          += despesasDesenvolvimento;
            extratoProjetoDto.Total.ResultadoMensal = extratoProjetoDto.Total.Acumulado;
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Data,Descricao,valor")] Custo custo)
        {
            if (id != custo.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(custo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustoExists(custo.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(custo));
        }
Beispiel #9
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Custo custo = new Custo()
                {
                    CustoNo      = txtCustoNo.Text.Trim(),
                    CustoName    = txtCustoName.Text.Trim(),
                    CustoSex     = cbSex.SelectedIndex,
                    CustoTel     = txtTel.Text.Trim(),
                    PassportType = cbPassportType.SelectedIndex,
                    CustoID      = txtCardID.Text.Trim(),
                    CustoAdress  = txtCustoAdress.Text.Trim(),
                    CustoBirth   = dtpBirthday.Value,
                    CustoType    = cbCustoType.SelectedIndex
                };
                new CustoService().InsertCustomerInfo(custo);

                Room r = new Room()
                {
                    CheckTime   = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    CustoNo     = custo.CustoNo,
                    RoomStateId = 1,
                    RoomNo      = dgvReserList.SelectedRows[0].Cells["clRoomNo"].Value.ToString()
                };

                new RoomService().UpdateRoomInfo(r);
                new ReserService().DeleteReserInfo(dgvReserList.SelectedRows[0].Cells["clReserNo"].Value.ToString());
                scope.Complete();
            }
            MessageBox.Show("操作成功");
            dgvReserList.AutoGenerateColumns = false;
            dgvReserList.DataSource          = new ReserService().SelectReserAll();
        }
Beispiel #10
0
        public static Custo SelectCustoInfoByCardId(string input)
        {
            Custo           cto = null;
            string          sql = "select * from USERINFO u,PASSPORTTYPE p,USERTYPE ut where u.PassportType=p.PassportId and u.CustoType=ut.UserType and CustoID = '" + input + "'";
            MySqlDataReader dr  = DBHelper.ExecuteReader(sql);

            if (dr.Read())
            {
                cto              = new Custo();
                cto.CustoNo      = (string)dr["CustoNo"];
                cto.CustoName    = (string)dr["CustoName"];
                cto.CustoSex     = Convert.ToInt32(dr["CustoSex"]);
                cto.CustoTel     = (string)dr["CustoTel"];
                cto.PassportType = Convert.ToInt32(dr["PassportType"]);
                cto.PassportName = (string)dr["PassportName"];
                cto.CustoID      = (string)dr["CustoID"];
                cto.CustoAdress  = (string)dr["CustoAdress"];
                cto.CustoBirth   = DateTime.Parse(dr["CustoBirth"].ToString());
                cto.CustoType    = Convert.ToInt32(dr["CustoType"]);
                cto.typeName     = (string)dr["TypeName"];
            }
            dr.Close();
            DBHelper.Closecon();
            return(cto);
        }
Beispiel #11
0
        /// <summary>
        /// 根据客户编号查询客户信息
        /// </summary>
        /// <param name="cno"></param>
        /// <returns></returns>
        public static Custo SelectCustoByCustoNo(string cno)
        {
            Custo           cto = null;
            MySqlConnection con = DBHelper.GetConnection();

            con.Open();
            MySqlDataReader dr = DBHelper.ExecuteReader("select * from USERINFO where CustoNo='" + cno + "'");

            if (dr.Read())
            {
                cto              = new Custo();
                cto.CustoNo      = dr["CustoNo"].ToString();
                cto.CustoName    = dr["CustoName"].ToString();
                cto.CustoSex     = Convert.ToInt32(dr["CustoSex"]);
                cto.CustoTel     = dr["CustoTel"].ToString();
                cto.PassportType = Convert.ToInt32(dr["PassportType"].ToString());
                cto.CustoID      = dr["CustoID"].ToString();
                cto.CustoAdress  = dr["CustoAdress"].ToString();
                cto.CustoBirth   = DateTime.Parse(dr["CustoBirth"].ToString());
                cto.CustoType    = Convert.ToInt32(dr["CustoType"].ToString());
            }
            dr.Close();
            DBHelper.Closecon();
            return(cto);
        }
Beispiel #12
0
        public void BloquearAbaixoCusto(Custo custo)
        {
            if (custo == null)
            {
                throw new ArgumentNullException("custo");
            }

            _db.BloquearAbaixoCusto(custo);
        }
Beispiel #13
0
        private void btnOK_BtnClick(object sender, EventArgs e)
        {
            try
            {
                if (txtCustoName.Text == "")
                {
                    MessageBox.Show("添加失败,必填信息不可为空");
                }
                else
                {
                    Custo custo = new Custo()
                    {
                        CustoNo      = txtCustoNo.Text,
                        CustoName    = txtCustoName.Text,
                        CustoSex     = cbSex.SelectedIndex,
                        CustoBirth   = dtpBirthday.Value,
                        CustoType    = cbCustoType.SelectedIndex,
                        PassportType = cbPassportType.SelectedIndex,
                        CustoID      = txtCardID.Text,
                        CustoTel     = txtTel.Text,
                        CustoAdress  = txtCustoAdress.Text
                    };
                    bool t = new CustoService().InsertCustomerInfo(custo);
                    if (t == true)
                    {
                        MessageBox.Show("添加成功");

                        #region 获取添加操作日志所需的信息
                        OperationLog o = new OperationLog();
                        o.OperationTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                        o.Operationlog     = "编号:" + LoginInfo.WorkerNo + "【" + FrmMain.wk_WorkerName + "】" + "于" + DateTime.Now + "添加了一名客户,客户编号为:" + custo.CustoNo;
                        o.OperationAccount = LoginInfo.WorkerNo;
                        o.datains_usr      = LoginInfo.WorkerNo;
                        o.datains_date     = DateTime.Now;
                        new OperationlogService().InsertOperationLog(o);
                        #endregion
                    }

                    foreach (Control Ctrol in this.Controls)
                    {
                        if (Ctrol is Sunny.UI.UITextBox)
                        {
                            Ctrol.Text = "";
                        }
                        if (Ctrol is Sunny.UI.UIComboBox)
                        {
                            this.cbSex.SelectedIndex          = 0;
                            this.cbCustoType.SelectedIndex    = 0;
                            this.cbPassportType.SelectedIndex = 0;
                        }
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #14
0
        private Dictionary <string, string> MontarParametrosPesquisar(Custo custo)
        {
            Dictionary <string, string> lstParametros = new Dictionary <string, string>();

            lstParametros.Add("@idCusto", custo.idCusto.Equals(0) ? null : custo.idCusto.ToString());
            lstParametros.Add("@Descricao", string.IsNullOrEmpty(custo.Descricao) ? null : custo.Descricao);
            lstParametros.Add("@UnitTest", custo.UnitTest.Equals(0) ? null : custo.UnitTest.ToString());
            return(lstParametros);
        }
Beispiel #15
0
 public void CmpInfo(Room rom, Custo user)
 {
     foreach (Control rmb in flpRoom.Controls)
     {
         if (rmb.Tag.ToString() != rom.RoomNo)
         {
         }
     }
 }
        public async Task <IActionResult> Create([Bind("Id,Data,Descricao,valor")] Custo custo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(custo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(custo));
        }
Beispiel #17
0
        public static int InsertCustomerInfo(Custo custo)
        {
            string NewID  = Md5LockedUtil.MD5Encrypt32(custo.CustoID);
            string NewTel = Md5LockedUtil.MD5Encrypt32(custo.CustoTel);

            string sql = "insert USERINFO(CustoNo,CustoName,CustoSex,CustoTel,PassportType,CustoID,CustoAdress,CustoBirth,CustoType)";

            sql += " values('" + custo.CustoNo + "','" + custo.CustoName + "','" + custo.CustoSex + "','" + NewTel + "','" + custo.PassportType + "','" + NewID + "','" + custo.CustoAdress + "','" + custo.CustoBirth + "','" + custo.CustoType + "') ";

            return(DBHelper.ExecuteNonQuery(sql));
        }
Beispiel #18
0
        public IActionResult Post([FromBody] Custo custo)
        {
            try
            {
                _custoRepository.Adicionar(custo);

                return(Created("api/Custo", custo));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
Beispiel #19
0
        public async Task <ActionResult <Custo> > PostCusto(Custo custo)
        {
            try
            {
                _context.Custos.Add(custo);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("GetCusto", new { id = custo.Id }, custo));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.BadRequest, ex.Message));
            }
        }
Beispiel #20
0
        public void AdicionarCusto(Custo custo)
        {
            if (ReceberCustoCollection == null)
            {
                ReceberCustoCollection = new ObservableCollection <Custo>();
            }

            if (custo.NomeCusto != null)
            {
                ReceberCustoCollection.Add(new Custo {
                    NomeCusto = custo.NomeCusto, ValorCusto = custo.ValorCusto
                });
            }
        }
Beispiel #21
0
        private void FrmSelectCustoInfo_Load(object sender, EventArgs e)
        {
            txtCustoNo.Text = ucRoomList.rm_CustoNo;
            Custo c = CustoService.SelectCustoByCustoNo(txtCustoNo.Text);

            txtAddress.Text               = c.CustoAdress;
            txtCustoName.Text             = c.CustoName;
            txtPassportNum.Text           = c.CustoID;
            txtTel.Text                   = c.CustoTel;
            cboCustoSex.Text              = c.CustoSex;
            cboCustoType.SelectedIndex    = c.CustoType;
            cboPassportType.SelectedIndex = c.PassportType;
            dtpBirth.Value                = c.CustoBirth;
        }
Beispiel #22
0
        private Custo ConvertToEntity(DataRow row)
        {
            if (row == null)
            {
                return(null);
            }
            Custo c = new Custo();

            c.customer_no         = int.Parse(row["customer_no"].ToString());
            c.customer_Name       = row["customer_name"].ToString();
            c.customer_contact_no = row["customer_contact_no"].ToString();
            c.customer_email      = row["customer_email"].ToString();
            c.customer_address    = row["customer_address"].ToString();
            return(c);
        }
Beispiel #23
0
        public void Execute(IPluginExecutionContext context)
        {
            Custo custo = new Custo(new Organizacao(context.OrganizationName))
            {
                Id = PluginHelper.GetEntityId(context)
            };

            if (custo.Agenda != null)
            {
                if (!custo.Agenda.VerificaAlteracaoPorStatus())
                {
                    throw new InvalidPluginExecutionException("Este registro não pode ser excluido: A Agenda esta inativa!");
                }
            }
        }
Beispiel #24
0
        public static List <Custo> SelectCanUseCustoAll()
        {
            List <Custo>    custos = new List <Custo>();
            string          sql    = "select * from USERINFO";
            MySqlDataReader dr     = DBHelper.ExecuteReader(sql);

            while (dr.Read())
            {
                Custo custo = new Custo();
                custo.CustoNo = (string)dr["CustoNo"];
                custos.Add(custo);
            }
            dr.Close();
            DBHelper.Closecon();
            return(custos);
        }
Beispiel #25
0
 private void dgvCustomer_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         string customer_no = dgvCustomer.Rows[e.RowIndex].Cells[0].Value.ToString();
         Custo  cmr         = currentData.FirstOrDefault(cm => cm.customer_no.ToString() == customer_no);
         if (cmr != null)
         {
             this.txtCustomerId.Text        = cmr.customer_no.ToString();
             this.txtCustomerName.Text      = cmr.customer_Name;
             this.txtCustomerContactNo.Text = cmr.customer_contact_no;
             this.txtCustomerEmail.Text     = cmr.customer_email;
             this.txtCustomerAddress.Text   = cmr.customer_address;
         }
     }
 }
Beispiel #26
0
 private void txtCustoNo_Validated(object sender, EventArgs e)
 {
     try
     {
         Custo c = CustoManager.SelectCustoByCustoNo(txtCustoNo.Text);
         txtCustoName.Text = c.CustoName;
         txtCustoTel.Text  = c.CustoTel;
         txtCustoType.Text = CustoTypeManager.SelectTypeNameByCustoTypeId(c.CustoType);
     }
     catch
     {
         txtCustoName.Text = "";
         txtCustoTel.Text  = "";
         txtCustoType.Text = "";
     }
 }
        /// <summary>
        /// 随机客户编号(用于注册)
        /// </summary>
        /// <returns></returns>
        public static string GetRandomCustoNo()
        {
            string CustoNo = "";
            Random rand    = new Random();

            CustoNo = rand.NextDouble() + "";
            CustoNo = "TS1" + CustoNo.Substring(2, 3);
            Custo card = SelectCardInfoByCustoNo(CustoNo);

            while (card != null)
            {
                CustoNo = rand.NextDouble() + "";
                CustoNo = "TS1" + CustoNo.Substring(2, 3);
                card    = SelectCardInfoByCustoNo(CustoNo);
            }
            return(CustoNo);
        }
Beispiel #28
0
        public Result <Custo> DeleteCustomer(Custo e, string a)
        {
            var    result = new Result <Custo>();
            string query  = "delete from emp where emp_no = " + a + ";";

            result.HasError = DataAccess.ExecuteQuery(query) <= 0;
            if (result.HasError)
            {
                result.Message = "Wrong";
            }
            else
            {
                result.Data = e;
            }

            return(result);
        }
        public static int InsertCusto(Custo cto)
        {
            int    n   = 0;
            string sql = "insert USERINFO(CustoNo,CustoName,CustoSex,CustoTel,PassportType,CustoID,CustoAdress,CustoBirth,CustoType) values(@CustoNo," +
                         "@CustoName,@CustoSex,@CustoTel,@PassportType,@CustoID,@CustoAdress,@CustoBirth,@CustoType)";

            n = DBHelper.ExecuteNonQuery(sql, CommandType.Text,
                                         new SqlParameter[] {
                new SqlParameter("@CustoNo", cto.CustoNo),
                new SqlParameter("@CustoName", cto.CustoName),
                new SqlParameter("@CustoSex", cto.CustoSex),
                new SqlParameter("@CustoTel", cto.CustoTel),
                new SqlParameter("@PassportType", cto.PassportType),
                new SqlParameter("@CustoID", cto.CustoID),
                new SqlParameter("@CustoAdress", cto.CustoAdress),
                new SqlParameter("@CustoBirth", cto.CustoBirth),
                new SqlParameter("@CustoType", cto.CustoType)
            });
            return(n);
        }
Beispiel #30
0
        public List <Custo> PesquisarCusto(Custo custo)
        {
            DataAccess dao = new DataAccess();
            Dictionary <string, string> lstParametros = new Dictionary <string, string>();
            List <Custo> lstCustos = new List <Custo>();

            try
            {
                lstParametros = MontarParametrosPesquisar(custo);

                using (DataSet ds = dao.Pesquisar("SP_CUSTOS_CONSULTAR", lstParametros))
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        lstCustos.Add(new Custo()
                        {
                            idCusto   = int.Parse(dr["idCusto"].ToString()),
                            Descricao = dr["Descricao"].ToString()
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                string parametrosSQL = string.Empty;
                parametrosSQL = helper.ConcatenarParametrosSQL(lstParametros);

                LogErro log = new LogErro()
                {
                    procedureSQL  = "SP_CUSTOS_CONSULTAR",
                    parametrosSQL = parametrosSQL,
                    mensagemErro  = ex.ToString()
                };

                bizLogErro.IncluirLogErro(log);

                throw ex;
            }

            return(lstCustos);
        }