コード例 #1
0
 public DataSet GetAll(string empresaid, tb_co_detraccion BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoDetraccion_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@detraccionid", SqlDbType.Char, 5).Value = BE.detraccionid;
                 cmd.Parameters.Add("@detraccionname", SqlDbType.VarChar, 100).Value = BE.detraccionname;
                 cmd.Parameters.Add("@detraccionporcent", SqlDbType.Decimal).Value = BE.detraccionporcent;
                 cmd.Parameters.Add("@fechini", SqlDbType.DateTime).Value = BE.fechini;
                 cmd.Parameters.Add("@fechfin", SqlDbType.DateTime).Value = BE.fechfin;
                 cmd.Parameters.Add("@tipo", SqlDbType.Int).Value = BE.tipo;
                 cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #2
0
 public bool Delete(string empresaid, tb_co_detraccion BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoDetraccion_DELETE", cnx))
         {
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@detraccionid", SqlDbType.Char, 5).Value = BE.detraccionid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #3
0
 public DataSet GetAll(string empresaid, tb_co_detraccion BE)
 {
     //return tablaDA.GetAll(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAll(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
コード例 #4
0
        private BindingSource NewMethodServicio()
        {
            tb_co_detraccionBL BL = new tb_co_detraccionBL();
            tb_co_detraccion BE = new tb_co_detraccion();

            DataTable table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            DataRowCollection rows = table.Rows;

            object[] cell;
            Dictionary<string, string> dic = new Dictionary<string, string>();
            BindingSource binding = new BindingSource();

            foreach (DataRow item in rows)
            {
                cell = item.ItemArray;
                dic.Add(cell[0].ToString(), cell[0].ToString() + " (" + cell[2].ToString() + "%) - " + cell[1].ToString());
                cell = null;
            }
            binding.DataSource = dic;
            return binding;
        }
コード例 #5
0
        private void cboServicio_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (u_n_opsel > 0)
            {
                bool VMZOK = false;
                if (cboServicio.SelectedValue.ToString().Trim().Length == 0)
                {
                    txtPorcdet.Text = "";
                }
                else
                {
                    try
                    {
                        tb_co_detraccionBL BL = new tb_co_detraccionBL();
                        tb_co_detraccion BE = new tb_co_detraccion();

                        BE.detraccionid = cboServicio.SelectedValue.ToString();
                        tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                        // tmptabla = ocapa.CaeSoft_GetAllCuentaDetraccion(cmbservicio.SelectedValue, 0, "", "", "", 2);
                        if (BL.Sql_Error.Length == 0)
                        {
                            if (tmptabla.Rows.Count > 0)
                            {
                                txtPorcdet.Text = tmptabla.Rows[0]["detraccionporcent"].ToString();
                                VMZOK = true;
                            }
                        }
                        if (!VMZOK)
                        {
                            txtPorcdet.Text = "";
                        }
                    }
                    catch (Exception ex)
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                refrescacontroles();
            }
        }
コード例 #6
0
 public bool Update(string empresaid, tb_co_detraccion BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
コード例 #7
0
 public bool Insert(string empresaid, tb_co_detraccion BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
コード例 #8
0
 public bool Update(string empresaid, tb_co_detraccion BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoDetraccion_UPDATE", cnx))
         {
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@detraccionid", SqlDbType.Char, 5).Value = BE.detraccionid;
                 cmd.Parameters.Add("@detraccionname", SqlDbType.VarChar, 100).Value = BE.detraccionname;
                 cmd.Parameters.Add("@detraccionporcent", SqlDbType.Decimal).Value = BE.detraccionporcent;
                 cmd.Parameters.Add("@fechini", SqlDbType.DateTime).Value = BE.fechini;
                 cmd.Parameters.Add("@fechfin", SqlDbType.DateTime).Value = BE.fechfin;
                 cmd.Parameters.Add("@status", SqlDbType.Bit).Value = BE.status;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }