Example #1
1
        public Template GetTemplate(SqlDataReader reader)
        {
            var htmlTemplate = reader["Template"].ToString();
            var name = reader["Name"].ToString();

            return new Template(name, htmlTemplate);
        }
        /// <summary>
        /// Creates a new instance of the ViewAuditoriaListaVerificacionDetalleCross class and populates it with data from the specified SqlDataReader.
        /// </summary>
        private static ViewAuditoriaListaVerificacionDetalleCrossInfo MakeViewAuditoriaListaVerificacionDetalleCross(SqlDataReader dataReader)
        {
            ViewAuditoriaListaVerificacionDetalleCrossInfo viewAuditoriaListaVerificacionDetalleCross = new ViewAuditoriaListaVerificacionDetalleCrossInfo();

            if (dataReader.IsDBNull(AuditoriaListaVerificacionDetalleCargoId) == false)
                viewAuditoriaListaVerificacionDetalleCross.AuditoriaListaVerificacionDetalleCargoId = dataReader.GetInt32(AuditoriaListaVerificacionDetalleCargoId);
            if (dataReader.IsDBNull(AuditoriaListaVerificacionDetalleId) == false)
                viewAuditoriaListaVerificacionDetalleCross.AuditoriaListaVerificacionDetalleId = dataReader.GetInt32(AuditoriaListaVerificacionDetalleId);
            if (dataReader.IsDBNull(AuditoriaListaVerificacionId) == false)
                viewAuditoriaListaVerificacionDetalleCross.AuditoriaListaVerificacionId = dataReader.GetInt32(AuditoriaListaVerificacionId);
            if (dataReader.IsDBNull(CargoId) == false)
                viewAuditoriaListaVerificacionDetalleCross.CargoId = dataReader.GetInt32(CargoId);
            if (dataReader.IsDBNull(Cargo) == false)
                viewAuditoriaListaVerificacionDetalleCross.Cargo = dataReader.GetString(Cargo);
            if (dataReader.IsDBNull(Activo) == false)
                viewAuditoriaListaVerificacionDetalleCross.Activo = dataReader.GetBoolean(Activo);
            if (dataReader.IsDBNull(AuditoriaPunto) == false)
                viewAuditoriaListaVerificacionDetalleCross.AuditoriaPunto = dataReader.GetString(AuditoriaPunto);
            if (dataReader.IsDBNull(AuditoriaControl) == false)
                viewAuditoriaListaVerificacionDetalleCross.AuditoriaControl = dataReader.GetString(AuditoriaControl);
            if (dataReader.IsDBNull(PuntajeRequerido) == false)
                viewAuditoriaListaVerificacionDetalleCross.PuntajeRequerido = dataReader.GetDecimal(PuntajeRequerido);
            if (dataReader.IsDBNull(Empresa) == false)
                viewAuditoriaListaVerificacionDetalleCross.Empresa = dataReader.GetString(Empresa);
            if (dataReader.IsDBNull(Orden) == false)
                viewAuditoriaListaVerificacionDetalleCross.Orden = dataReader.GetByte(Orden);

            return viewAuditoriaListaVerificacionDetalleCross;
        }
 public ChiTietPhieuXuatKho(SqlDataReader dataReader)
 {
     PhieuXuatKhoGuid = dataReader["PhieuXuatKhoGuid"] != null ? (Guid)dataReader["PhieuXuatKhoGuid"] : Guid.Empty;
     ItemStoreGuid = dataReader["ItemStoreGuid"] != null ? (Guid)dataReader["ItemStoreGuid"] : Guid.Empty;
     HoaDonBanHangGuid = dataReader["HoaDonBanHangGuid"] != null ? (Guid)dataReader["HoaDonBanHangGuid"] : Guid.Empty;
     SoLuong = dataReader["SoLuong"] != null ? (Int32)dataReader["SoLuong"] : 0;
 }
Example #4
1
    } // End of the constructor

    /// <summary>
    /// Create a new custom theme from a reader
    /// </summary>
    /// <param name="reader"></param>
    public CustomTheme(SqlDataReader reader)
    {
        // Set values for instance variables
        this.id = Convert.ToInt32(reader["id"]);
        this.name = reader["name"].ToString();

    } // End of the constructor
Example #5
1
        /// <summary>
        /// Loads the entity from a <b>SqlDataReader</b> object.
        /// </summary>
        /// <param name="dr">The data reader to read from.</param>
        /// <returns>Returns the number of columns read.</returns>
        /// <remarks>
        /// Always reads at the current cursor position, doesn't calls the <b>Read</b> function
        /// on the <b>SqlDataReader</b> object. Reads data columns by their ordinal position in
        /// the query and not by their names.
        /// </remarks>
        internal override int LoadFromDataReader(SqlDataReader dr)
        {
            int o = base.LoadFromDataReader(dr);

            ++o;    // skip guid
            this.workflowTypeName = dr.GetString(++o);
            this.dateStarted = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.dateFinished = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.jobExecutionStatus = (JobExecutionState)dr.GetInt32(++o);
            this.suspendTimeout = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.scheduleType = (ScheduleType)dr.GetInt32(++o);
            this.scheduleTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.recurringPeriod = (RecurringPeriod)dr.GetInt32(++o);
            this.recurringInterval = dr.GetInt32(++o);
            this.recurringMask = dr.GetInt64(++o);
            this.workflowInstanceId = dr.IsDBNull(++o) ? Guid.Empty : dr.GetGuid(o);
            this.adminRequestTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            if (!dr.IsDBNull(++o))
            {
                XmlSerializer ser = new XmlSerializer(typeof(JobAdminRequestData));
                StringReader sr = new StringReader(dr.GetString(o));
                this.adminRequestData = (JobAdminRequestData)ser.Deserialize(sr);
            }
            else
            {
                this.adminRequestData = null;
            }
            this.adminRequestResult = dr.GetInt32(++o);
            this.exceptionMessage = dr.IsDBNull(++o) ? null : dr.GetString(o);

            return o;
        }
Example #6
1
        public static List<Club> readTable(string SqlQuery, string serverName, string databaseName)
        {
            myConnection = new SqlConnection(serverName + ";" + databaseName + ";" + "Integrated Security=true");

            try
            {
                myConnection.Open();
                myCommand = new SqlCommand(SqlQuery, myConnection);
                myReader = myCommand.ExecuteReader();
                ClubList.Clear();
                while(myReader.Read()) {
                    //Console.WriteLine(myReader[0].ToString());
                    //code here to map query output to club objects and put into list
                    ClubList.Add(new Club
                    {
                        id = myReader[0].ToString(),
                        //name = myReader[1].ToString(),
                        //address = myReader[2].ToString(),
                        //city = myReader[3].ToString(),
                        //state = myReader[4].ToString()
                    });
                }
            } catch (Exception e) {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                myConnection.Close();
            }
            return ClubList;
        }
Example #7
1
 public HashSum(SqlDataReader reader, String secret = "PZS")
 {
     DataTable dt = new DataTable();
     dt.Load(reader);
     dt.TableName = secret;
     this.dt = dt;
 }
Example #8
1
 public DBHelper()
 {
     connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
     objConnection = dbConection;
     objCommand = null;
     objReader = null;
 }
        // Apresentar os registros da pesquisa desejada.
        public void loadlist()
        {
            listBox1.Items.Clear();
            listBox2.Items.Clear();
            listBox3.Items.Clear();
            listBox4.Items.Clear();
            listBox5.Items.Clear();
            listBox6.Items.Clear();
            listBox7.Items.Clear();

            conexao.Open();
            comando.CommandText = "SELECT * FROM Contatos";
            LerDados = comando.ExecuteReader();
            if (LerDados.HasRows)
            {
                while (LerDados.Read())
                {
                    listBox1.Items.Add(LerDados[0].ToString());
                    listBox2.Items.Add(LerDados[1].ToString());
                    listBox3.Items.Add(LerDados[2].ToString());
                    listBox4.Items.Add(LerDados[3].ToString());
                    listBox5.Items.Add(LerDados[4].ToString());
                    listBox6.Items.Add(LerDados[5].ToString());
                    listBox7.Items.Add(LerDados[6].ToString());

                }
            }
            conexao.Close();
        }
Example #10
1
 public ObjetoDominio Cargar(long id, SqlDataReader filas)
 {
     string titulo = (string)filas["Titulo"];
     Album resultado = new Album(id, titulo);
     CargarCanciones(resultado, filas);
     return resultado;
 }
 /** Descripcion:
  *
  * REQ: SqlDataReader, int
  *
  * RET: static string
  */
 public static string SafeGetString(SqlDataReader reader, int colIndex)
 {
     if (!reader.IsDBNull(colIndex))
         return reader.GetString(colIndex);
     else
         return string.Empty;
 }
Example #12
1
        public List<List<String>> convert(SqlDataReader reader)
        {
            if (reader != null)
            {
                List<List<String>> list = new List<List<String>>();

                while (reader.Read())
                {
                    List<String> tmp = new List<String>();
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        string s = "";
                        try
                        {
                            s = reader.GetString(i);
                        }
                        catch (SqlNullValueException)
                        {
                            s = "null";
                        }

                        tmp.Add(s);

                    }
                    list.Add(tmp);
                }
                return list;
            }
            return null;
        }
    public static PMSAgency Read(SqlDataReader reader)
    {
        PMSAgency retval = new PMSAgency();

        for (int i = 0; i < reader.FieldCount; i++)
        {
            switch (reader.GetName(i))
            {
                case "GroupSegment":
                    retval.Segment = Helper.ToString(reader[i]);
                    break;
                case "AType":
                    retval.ActionType = Helper.ToString(reader[i]);
                    break;
                case "Agency":
                    retval.AgencyName = Helper.ToString(reader[i]);
                    break;
                case "Market":
                    retval.Market = Helper.ToString(reader[i]);
                    break;
                case "RepGroup":
                    retval.RepGroup = Helper.ToString(reader[i]);
                    break;
               case "SiteID":
                    retval.SiteID = Helper.ToInt32(reader[i]);
                    break;
            }
        }
        return retval;
    }
 private void Name_TextChanged(object sender, EventArgs e)
 {
     myConn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.mdf;Integrated Security=True;User Instance=True");
     myConn.Open();
     string commandString = @"SELECT * FROM Asset WHERE [Asset Name] = '" + name.Text + "'";
     SqlCommand cmd = new SqlCommand(commandString, myConn);
     rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         if (rdr != null)
         {
             rdr.Dispose();
         }
     SqlDataAdapter adapter = new SqlDataAdapter(@"SELECT Asset.[Asset ID], Asset.[Asset Name], Asset.[Asset Category], Category.[Category Type], Status.[Status] , History.* FROM Asset JOIN History ON Asset.[Asset ID] = History.[Asset ID] JOIN Status ON Status.[Status ID] = Asset.[Asset Status] JOIN Category ON Category.[Category ID] = Asset.[Asset Category] WHERE [Asset Name]  = '"+ name.Text+ "'", myConn);
     DataTable t = new DataTable();
     adapter.Fill(t);
     t.Columns.RemoveAt(5);
     t.Columns.RemoveAt(10);
     dataGridView1.DataSource = t;
     dataGridView1.Columns[2].Visible = false;
     this.dataGridView1.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
     dataGridView1.Refresh();
     myConn.Close();
     }
     else
     {
         MessageBox.Show("Not in database!!");
         this.Dispose();
     }
 }
        public String GetLastIDInserted(String pStrDBTable)
        {
            String mStrSQL = "SELECT IDENT_CURRENT('" + pStrDBTable + "')";
            String mStrLastIDInserted = "";

            try
            {
                oCommand = new SqlCommand(mStrSQL,oConnection);
                oReader = oCommand.ExecuteReader();
                oTable = new DataTable();
                oTable.Load(oReader);

                foreach (DataRow oDataRow in oTable.Rows)
                {
                    foreach (DataColumn oDataColumn in oTable.Columns)
                    {
                        mStrLastIDInserted = oDataRow[oDataColumn.ColumnName].ToString();
                    }
                }
            }
            catch (DataException Ex)
            {
                mStrLastIDInserted = "";
            }
            oCommand = null;
            oReader = null;
            oTable = null;
            return mStrLastIDInserted;
        }
Example #16
1
 public bool CloseCommand()
 {
     bool flag = true;
     try
     {
         if (connection != null)
         {
             if (sqlReader != null)
             {
                 sqlReader.Close();
                 sqlReader.Dispose();
                 sqlReader = (SqlDataReader)null;
             }
             if (sqlCommand != null)
             {
                 sqlCommand.Dispose();
                 sqlCommand = (SqlCommand)null;
             }
         }
     }
     catch (Exception ex)
     {
         flag = false;
         hasError = true;
         errorMessage = "Database command error : " + ex.Message;
     }
     return flag;
 }
Example #17
1
        private void cbo()
        {
            sb = new StringBuilder();
            sb.Remove(0, sb.Length);
            sb.Append("SELECT SupplierId,SupplierName FROM SUPPLIER;");
            sb.Append("SELECT UserId,UserName FROM UserLogin;");

            string sqlIni = sb.ToString();
            com = new SqlCommand();
            com.CommandText = sqlIni;
            com.CommandType = CommandType.Text;
            com.Connection = Conn;
            dr = com.ExecuteReader();

            if (dr.HasRows)
            {
                //supplier
                DataTable dtSupplier = new DataTable();
                dtSupplier.Load(dr);
                cboSupplier.BeginUpdate();
                cboSupplier.DisplayMember = "SupplierName";
                cboSupplier.ValueMember = "SupplierId";
                cboSupplier.DataSource = dtSupplier;
                cboSupplier.EndUpdate();
                //User
                DataTable dtUserId = new DataTable();
                dtUserId.Load(dr);
                cboUserId.BeginUpdate();
                cboUserId.DisplayMember = "UserName";
                cboUserId.ValueMember = "UserId";
                cboUserId.DataSource = dtUserId;
                cboUserId.EndUpdate();

            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.cadenaconexion =
            "Data Source=LOCALHOST;Initial Catalog=HOSPITAL;User ID=SA";
        this.cn = new SqlConnection(this.cadenaconexion);
        this.com = new SqlCommand();

        //LA PRIMERA VEZ...
        if (this.Page.IsPostBack == false)
        {
            this.lstdepartamentos.AutoPostBack = true;
            this.com.Connection = this.cn;
            this.com.CommandType = System.Data.CommandType.Text;
            this.com.CommandText = "SELECT * FROM DEPT";
            this.cn.Open();
            this.lector = this.com.ExecuteReader();
            while (this.lector.Read())
            {
                ListItem it = new ListItem();
                it.Text = this.lector["DNOMBRE"].ToString();
                it.Value = this.lector["DEPT_NO"].ToString();
                this.lstdepartamentos.Items.Add(it);
            }
            this.lector.Close();
            this.cn.Close();
    }
}
Example #19
1
        /// <summary>
        /// Creates a new instance of the ViewSeguridadUsuario class and populates it with data from the specified SqlDataReader.
        /// </summary>
        private static ViewSeguridadUsuarioInfo MakeViewSeguridadUsuario(SqlDataReader dataReader)
        {
            ViewSeguridadUsuarioInfo viewSeguridadUsuario = new ViewSeguridadUsuarioInfo();

            if (dataReader.IsDBNull(SeguridadUsuarioId) == false)
                viewSeguridadUsuario.SeguridadUsuarioId = dataReader.GetInt32(SeguridadUsuarioId);
            if (dataReader.IsDBNull(SeguridadRolId) == false)
                viewSeguridadUsuario.SeguridadRolId = dataReader.GetInt32(SeguridadRolId);
            if (dataReader.IsDBNull(Rol) == false)
                viewSeguridadUsuario.Rol = dataReader.GetString(Rol);
            if (dataReader.IsDBNull(NombreUsuario) == false)
                viewSeguridadUsuario.NombreUsuario = dataReader.GetString(NombreUsuario);
            if (dataReader.IsDBNull(Nombres) == false)
                viewSeguridadUsuario.Nombres = dataReader.GetString(Nombres);
            if (dataReader.IsDBNull(Apellidos) == false)
                viewSeguridadUsuario.Apellidos = dataReader.GetString(Apellidos);
            if (dataReader.IsDBNull(PaswordHash) == false)
                viewSeguridadUsuario.PaswordHash = dataReader.GetString(PaswordHash);
            if (dataReader.IsDBNull(Salt) == false)
                viewSeguridadUsuario.salt = dataReader.GetString(Salt);
            if (dataReader.IsDBNull(Activo) == false)
                viewSeguridadUsuario.Activo = dataReader.GetBoolean(Activo);
            if (dataReader.IsDBNull(NombreCompleto) == false)
                viewSeguridadUsuario.NombreCompleto = dataReader.GetString(NombreCompleto);

            return viewSeguridadUsuario;
        }
Example #20
1
        private void button1_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();
            CN = new SqlConnection(cadenaconexion);
            CMD = new SqlCommand("SELECT * FROM Prueba", CN);
            CMD.CommandType = CommandType.Text;

            try
            {
                CN.Open();
                RDR = CMD.ExecuteReader();
                while (RDR.Read())
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.Text = (string)RDR["id"].ToString();
                    lvi.SubItems.Add((string)RDR["nombre"]);
                    listView1.Items.Add(lvi);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                CN.Close();
            }
        }
 internal SqlCachedBuffer(SqlDataReader dataRdr, int columnOrdinal, long startPosition)
 {
     int num;
     this._cachedBytes = new ArrayList();
     long dataIndex = startPosition;
     do
     {
         byte[] buffer = new byte[0x800];
         num = (int) dataRdr.GetBytesInternal(columnOrdinal, dataIndex, buffer, 0, 0x800);
         dataIndex += num;
         if (this._cachedBytes.Count == 0)
         {
             this.AddByteOrderMark(buffer, num);
         }
         if (0 < num)
         {
             if (num < buffer.Length)
             {
                 byte[] dst = new byte[num];
                 Buffer.BlockCopy(buffer, 0, dst, 0, num);
                 buffer = dst;
             }
             this._cachedBytes.Add(buffer);
         }
     }
     while (0 < num);
 }
Example #22
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtSkillHead.Text.Trim() == "") // Cannot be blank
         {
             lblMessage.Text = "Field can't be blank";
         }
         else
         {
             query = "select Head from SkillHead where Head='" + txtSkillHead.Text + "'";
             reader = db.data_read(query);
             if (reader.Read())
             {
                 lblMessage.Text = "Skill Head already exists";
             }
             else
             {
                 query = "insert into SkillHead (Id,Head) values ('" + AutoGeneration() + "','" + txtSkillHead.Text + "')";
                 db.database_command(query);
                 txtSkillHead.Text = "";
                 lblMessage.Text = "Skill head added";
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
        public List<ModeloNegocio.MicroredSchool> getAllMicroredSchoolForIdMicrored(int idMicrored)
        {
            List<ModeloNegocio.MicroredSchool> lista = new List<ModeloNegocio.MicroredSchool>();
            Cmd = new SqlCommand();
            Cmd.Connection = Conn;
            try
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.CommandText = "PA_GET_MICRORED_SCHOOL_FOR_MICRORED_ID";

                Cmd.Parameters.Add("@microred_id", SqlDbType.Int).Value = idMicrored;
                Dtr = Cmd.ExecuteReader();

                while (Dtr.Read())
                {
                    ModeloNegocio.MicroredSchool microredSchool = new ModeloNegocio.MicroredSchool();
                    microredSchool.Id = Convert.ToInt32(Dtr["id"]);
                    microredSchool.School_id = Convert.ToInt32(Dtr["school_id"]);
                    microredSchool.Microred_id = Convert.ToInt32(Dtr["microred_id"]);

                    if (DBNull.Value.Equals(Dtr["created_at"])) microredSchool.Created_at = DateTime.Now ; else microredSchool.Created_at = DateTime.Parse(Dtr["created_at"].ToString());

                    if (DBNull.Value.Equals(Dtr["updated_at"])) microredSchool.Updated_at = DateTime.Now ; else microredSchool.Updated_at = DateTime.Parse(Dtr["updated_at"].ToString());

                    lista.Add(microredSchool);
                }
                Conn.Close();

            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            return lista;
        }
 /** Descripcion:
  *
  * REQ: SqlDataReader,int
  *
  * RET: static int
  */
 public static int SafeGetInt32(SqlDataReader reader, int colIndex)
 {
     if (!reader.IsDBNull(colIndex))
         return reader.GetInt32(colIndex);
     else
         return -1;
 }
Example #25
0
 // CHECK IF SALES PERSON EXIST IN DATBASE
 public static string CheckSalesPersonLogIn(SqlDataReader dr)
 {
     bool noExist = true;
     bool isActive = true;
     string clear = null;
     while (dr.Read())
     {
         clear = dr.GetString(0);
         isActive = dr.GetBoolean(5);
         noExist = false;
     }
     if (!isActive)
     {
         MessageBox.Show("Sorry, you are fired!", "LOL", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return null;
     }
     else if (noExist)
     {
         MessageBox.Show("Not in the register.", "Unregistered Sales Person", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return null;
     }
     else
     {
         return clear;
     }
 }
Example #26
0
 public override void fillData(SqlDataReader reader)
 {
     drivinglicence = (string)reader.GetValue(0);
     drivinglicencetype = (string)reader.GetValue(1);
     point = (int)reader.GetValue(2);
     ID = (string)reader.GetValue(3);
 }
Example #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     objConn = new SqlConnection();
     objConn.ConnectionString = strConnString;
     objConn.Open();
     string sql_hl = "";
     string sql_vd = "";
     if (!string.IsNullOrEmpty(Request.QueryString["hl"] as string)) { sql_hl = "and Haulier_Abbr='" + Request.QueryString["hl"].ToString() + "' "; }
     if (!string.IsNullOrEmpty(Request.QueryString["vd"] as string)) { sql_vd = "and Vendor_Code in (select Vendor_Code from Vendor_Group where VendorID='" + Request.QueryString["vd"].ToString() + "') "; }
     if (!string.IsNullOrEmpty(Request.QueryString["dc"] as string)) { sql_hl = "and DC_NO='" + Request.QueryString["dc"].ToString() + "' "; }
     string sql_detail = "select Vendor_Code,Vendor_Name,Haulier_Abbr,DC_No,Delivery_Location,Currency, " +
     "case when upper(RateType) like '%Box%' then No_Of_QTY end  as Boxes, " +
     "case when upper(RateType) like '%Pallet%' then No_Of_QTY end  as Pallets,  " +
     "case when upper(RateType) like '%Tray%' then No_Of_QTY end  as Trays, " +
     "case when upper(RateType) like '%Cases%' then No_Of_QTY end  as Cases,  " +
     "case when upper(RateType) like '%Load%' then No_Of_QTY end  as Loads,  " +
     "sum(Rate_Per_unit*No_Of_Qty) as Cost , " +
     "sum(Total_Cost) as TotalCost, " +
     "sum(Total_Cost_Charging) as Total_Revenue, " +
     "sum(Total_Cost_Charging-(Total_Cost)) as Profit " +
     "from transportation " +
     "Where Year_Week_Upload='" + Request.QueryString["yw"].ToString() + "' " +
     "" + sql_hl + "" +
     "" + sql_vd + "" +
     //"and Vendor_Name<>'DUMMY' " +
     "and Calc_Date is not null Group by Vendor_Code,Vendor_Name,Haulier_Abbr,DC_No,Delivery_Location,Currency, " +
     "case when upper(RateType) like '%Box%' then No_Of_QTY end , " +
     "case when upper(RateType) like '%Pallet%' then No_Of_QTY end , " +
     "case when upper(RateType) like '%Tray%' then No_Of_QTY end , " +
     "case when upper(RateType) like '%Cases%' then No_Of_QTY end , " +
     "case when upper(RateType) like '%Load%' then No_Of_QTY end ,TransID Order by Vendor_Name";
     SqlCommand rs_detail = new SqlCommand(sql_detail, objConn);
     obj_detail = rs_detail.ExecuteReader();
 }
Example #28
0
    public BaseFlowerLinkRaceRank(SqlDataReader reader)
    {
        if(reader ==null)
            throw new Exception();

        this.InitData(reader);
    }
Example #29
0
        public int countRows(int tipoUsuario)
        {
            Cmd = new SqlCommand();
            Cmd.Connection = Conn;
            int total_rows = 0;
            try
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.CommandText = "[otaku_bcp].PA_COUNT_ROWS_TYPE_USER";
                Cmd.Parameters.Add("@IdType", SqlDbType.Int).Value = tipoUsuario;
                Dtr = Cmd.ExecuteReader();

                while (Dtr.Read())
                {

                    total_rows = Convert.ToInt32(Dtr["total_rows"]);

                }
                Conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            return total_rows;
        }
Example #30
0
        public int clienteRegistrado( string Tipo_ID, int Numero_ID)
        {
            con1.cnn.Open();
            int contador = 0;
            try
            {

                string query = "SELECT id_tipo_doc, num_doc FROM LPP.CLIENTES WHERE id_tipo_doc = (SELECT tipo_cod FROM LPP.TIPO_DOCS WHERE tipo_descr = '" + Tipo_ID + "') AND num_doc = " + Numero_ID + "";
                SqlCommand command = new SqlCommand(query, con1.cnn);
                dr = command.ExecuteReader();
                while (dr.Read())
                {

                    contador++;
                }
                dr.Close();

            }
            catch (Exception )
            {
                con1.cnn.Close();
                return contador;

            }
            con1.cnn.Close();
            //MessageBox.Show("El Cliente ya existe");
            return 0;
        }
    protected void SubmitForm(object sender, EventArgs e)
    {
        String uname            = String.Format("{0}", Request.Form["uname"]);
        String pword            = String.Format("{0}", Request.Form["pword"]);
        String connectionString = "Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = " + "D:\\workSpaces\\studio2017\\repos\\Hostel Management System Rushi\\Hostel Management System Rushi\\App_Data\\Database.mdf" + "; Integrated Security = True";

        System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connectionString);
        con.Open();
        Console.WriteLine("connection opened successfully");
        System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select * from Users where uname='" + uname + "' and pword='" + pword + "'", con);

        System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader();

        if (reader.Read())
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Show", "alert('Login Successful');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Show", "alert('Login Failed');", true);
        }
        con.Close();
        Console.WriteLine("connection closed successfully");
    }
    private void Table_Notas(string ID)
    {
        string stringSelect = "select t1.id_aa, t2.nome, t1.nota " +
                              "from tbl_aluno_avaliacao t1 " +
                              "inner join tbl_alunos t2 on (t1.id_aluno = t2.ID_Aluno ) " +
                              "where t1.id_avaliacao = " + ID;

        OperacaoBanco operacaoUsers = new OperacaoBanco();

        System.Data.SqlClient.SqlDataReader rcrdsetUsers = operacaoUsers.Select(stringSelect);

        str.Clear();
        string ScriptDados;

        while (rcrdsetUsers.Read())
        {
            string bt1 = "<a class='w3-btn w3-round w3-hover-red w3-text-green' onclick='ExcluirAl(this," +
                         Convert.ToString(rcrdsetUsers[0]) +
                         ")'><i class='fa fa-trash-o' aria-hidden='true'></i></a>&nbsp;&nbsp;";

            ScriptDados = "<tr>";
            str.Append(ScriptDados);

            ScriptDados = "<td>" + bt1 + Convert.ToString(rcrdsetUsers[1]) + "</td>";
            str.Append(ScriptDados);

            ScriptDados = "<td>" + Convert.ToString(rcrdsetUsers[2]) + "</td>";
            str.Append(ScriptDados);

            ScriptDados = "</tr>";
            str.Append(ScriptDados);
        }
        ConexaoBancoSQL.fecharConexao();

        Literal_table.Text = str.ToString();
    }
Example #33
0
    private void dadosCorpo()
    {
        string stringselect = "select ID_viagem, veiculo, motorista, format(data_viagem,'dd/MM/yyyy') as d1 " +
                              "from Tbl_Viagens " +
                              "where ID_Inst =" + InstID +
                              "order by data_viagem";

        OperacaoBanco operacao = new OperacaoBanco();

        System.Data.SqlClient.SqlDataReader dados = operacao.Select(stringselect);

        while (dados.Read())
        {
            string Coluna0 = Convert.ToString(dados[0]); //id

            string Coluna1 = Convert.ToString(dados[1]);
            string Coluna2 = Convert.ToString(dados[2]);
            string Coluna3 = Convert.ToString(dados[3]);

            // <!--*******Customização*******-->
            string bt1 = "<a class='w3-btn w3-round w3-hover-blue w3-text-green' href='Viagens_Ficha.aspx?v1=" + Coluna0 + "'><i class='fa fa-id-card-o' aria-hidden='true'></i></a>";
            string bt2 = "<a class='w3-btn w3-round w3-hover-red w3-text-green' onclick='Excluir(" + Coluna0 + ")'><i class='fa fa-trash-o' aria-hidden='true'></i></a>&nbsp;&nbsp;";

            string stringcomaspas = "******" +
                                    "<td>" + bt1 + bt2 + Coluna1 + "</td>" +
                                    "<td>" + Coluna2 + "</td>" +
                                    "<td>" + Coluna3 + "</td>" +
                                    "</tr>";

            str.Append(stringcomaspas);
            TotaldeRegistros += 1;
        }
        ConexaoBancoSQL.fecharConexao();

        lblTotalRegistros.Text = TotaldeRegistros.ToString();
    }
Example #34
0
File: Main.cs Project: crowell/Door
    private static void Events_KeyboardUp(object sender, KeyboardEventArgs args)
    {
        if (args.Key == Key.KeypadEnter)
        {
            ResetScreen();
            DispSDLText(mVideoScreen, "HELLO WORLD", -1, 300);
            mVideoScreen.Update();
            SdlDotNet.Core.Timer.DelaySeconds(5); //delay so to show the animation
            ResetScreen();
            PrintWelcomeMessage();
        }
        else if (args.Key == Key.Escape)
        {
            System.Console.WriteLine("Escape pressed, Quitting");
            Environment.Exit(0);
        }
        else if (args.EventStruct.key.keysym.scancode != 0x24)
        {
            string str = args.KeyboardCharacter.ToString();
            mID2.Append(args.KeyboardCharacter.ToString());
        }

        else
        {
            string id = mID2.ToString();
            mID2 = new StringBuilder(); // zero out the mID2
            if (mStringReplace)
            {
                id = id.Substring(10, id.Length - 1);
                char[] idstr = id.ToCharArray();
                idstr[0] = 'u';
                id       = idstr.ToString();
            }

            System.Data.SqlClient.SqlConnection doorDB =
                new System.Data.SqlClient.SqlConnection("user id=uid;" +
                                                        "password=pwrod;server=url;Trusted_Connection=yes;" +
                                                        "database=database;connection timeout=30");
            try
            {
                doorDB.Open();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            string query = String.Format("SELECT id, first FROM users where swipe=\"{0}\"", id);
            System.Data.SqlClient.SqlCommand    qCommand = new System.Data.SqlClient.SqlCommand(query, doorDB);
            System.Data.SqlClient.SqlDataReader qReader  = null;
            StringBuilder sb = new StringBuilder("Hello ");
            try
            {
                qReader = qCommand.ExecuteReader();
                while (qReader.Read())
                {
                    sb.Append(qReader[1].ToString());
                    query = String.Format("insert into log(user,time) VALUES(\"{0}\",NOW())", qReader[0]);
                    ResetScreen();
                    DispSDLText(mVideoScreen, sb.ToString(), -1, 100);
                    //now unlock the door
                    mArduino.Write("u\r");
                    mVideoScreen.Update();
                    SdlDotNet.Core.Timer.DelaySeconds(5); //delay so to show the animation
                    ResetScreen();
                    PrintWelcomeMessage();
                }
                try
                {
                    doorDB.Close();
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
            }
        }
    }
Example #35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        login = Session["loginVal"].ToString();
        string        sql1 = "Select * from adminlogin where username='******'";
        SqlDataReader sdr1 = DB.CommonDatabase.DataReader(sql1);

        if (sdr1.Read())
        {
            name    = sdr1["ContactPerson"].ToString();
            emailid = sdr1["Email"].ToString();
        }

        if (login.Contains('@'))
        {
            userid = login;
        }
        else
        {
            userid = emailid;
        }

        finaldata3 = Request.QueryString["Finalstr"];
        bookingid  = finaldata3;
        string sql = "select * from HopOnHopOffBookingDetails where  bookingid='" + finaldata3 + "'";

        System.Data.SqlClient.SqlDataReader sdr = DB.CommonDatabase.DataReader(sql);
        if (sdr.Read())
        {
            bookingdetails = sdr.GetString(2);
            bookingdate    = sdr.GetString(3);
            status         = sdr.GetString(4);
        }
        arr      = bookingdetails.Split('~');
        dayinfo  = bookingdetails.Split('!')[1].Split('$')[0].TrimEnd('~');
        passinfo = bookingdetails.Split('~')[0];


        MailMessage mm;

        mm = new MailMessage("*****@*****.**", "*****@*****.**"); //[email protected]  "*****@*****.**", "*****@*****.**"
        // mm.Body = string.Format("Hi");
        mm.Subject = userid + " , " + name + " , " + bookingdate + " , " + arr[1];
        mm.Body    = string.Format("<form id='Form1' runat='server'><div style='height: 25px;'></div>");
        mm.Body   += ("<div class='row' align='center' style='font-size: x-large; font-weight: bold'>");
        mm.Body   += ("SightSeeing Confirmation</div><div style='height: 15px;'></div>");
        mm.Body   += ("<div class='container' style='border: 2px solid #ccc; max-width: 850px; min-height: 30px;font-size: large;'>");
        mm.Body   += ("<div class='row'><div class='col-md-6' style='border-right: 2px solid #ccc;'><div class='col-md-12' style='height:15px;'></div>");
        mm.Body   += ("<div class='col-md-6'><b>Booking ID :</b></div>");
        mm.Body   += ("<div class='col-md-6'>" + bookingid + "</div><div class='col-md-6'>");
        mm.Body   += ("<b>Booking Date :</b></div><div class='col-md-6'>" + bookingdate + "</div>");
        mm.Body   += ("<div class='col-md-6'><b>Status :</b></div><div class='col-md-6'>");
        mm.Body   += ("" + status + "</div><div class='col-md-12' style='height:15px;'></div></div>");
        mm.Body   += ("<div class='col-md-6' align='right'><b>Travel Rez Online<br />61-C Kalu Sarai, hauz Khas,<br />Delhi-110016<br />47050000</b></div>");
        mm.Body   += ("</div><div class='row' align='center' style='background-color: #808080; color: #000000;");
        mm.Body   += ("min-height: 35px; margin-bottom: 5px; border-top: 2px solid #ccc;border-bottom: 2px solid #ccc;>");
        mm.Body   += ("<b>SightSeeing Details:</b></div><div class='row'><div class='col-md-3'>");
        mm.Body   += ("<b>Country :</b></div><div class='col-md-3'>" + arr[0].Split('/')[4] + "</div>");
        mm.Body   += ("<div class='col-md-3'><b>City :</b></div><div class='col-md-3'>" + arr[1] + "</div>");
        mm.Body   += ("</div><div class='row' style='margin-top: 10px; min-height: 30px;'><div class='col-md-3'><b>SightSeeing Name:</b></div><div class='col-md-3'>");
        mm.Body   += (arr[1] + "</div></div>");
        for (int i = 0; i < dayinfo.Split('~').Length; i = i + 2)
        {
            mm.Body += ("<div class='row' style='margin-top: 3px'><div class='col-md-6'>");
            mm.Body += dayinfo.Split('~')[i + 1];
            mm.Body += (":</div><div class='col-md-6'>INR");
            mm.Body += ("" + dayinfo.Split('~')[i] + "</div></div>");
        }
        mm.Body += ("<div class='row' align='center' style='background-color: #808080; color: #000000;");
        mm.Body += ("border-top: 2px solid #ccc; min-height: 35px; margin-top: 5px; margin-bottom: 5px'>");
        mm.Body += ("<b>Passenger Details:</b></div>");
        for (int j = 0; j < passinfo.Split('/')[0].Split(',').Length - 1; j++)
        {
            mm.Body += ("<div class='row' style='margin-top: 3px; min-height: '><div class='col-md-4'>" + passinfo.Split('/')[0].Split(',')[j] + "</div>");
            mm.Body += ("<div class='col-md-4'>" + passinfo.Split('/')[1].Split(',')[j] + "</div><div class='col-md-4'>");
            mm.Body += ("" + passinfo.Split('/')[2].Split(',')[j] + "</div></div>");
        }
        mm.Body += ("<div class='row' align='center' style='background-color: #808080; color: #000000;border-top: 2px solid #ccc; min-height: 35px'>");
        mm.Body += ("<b>Fare Details:</b></div>");
        var total = 0;

        for (int i = 0; i < dayinfo.Split('~').Length; i = i + 2)
        {
            total += Convert.ToInt16(dayinfo.Split('~')[i]);
        }
        mm.Body += ("<div class='row' style='border-top: 2px solid #ccc;'><div class='col-md-6'></div>");
        mm.Body += ("<div class='col-md-6' align='right'><b>Total Amount:</b></div></div>");
        mm.Body += ("<div class='row' style='border-top: 2px solid #ccc;'><div class='col-md-6'></div><div class='col-md-6' align='right'>");
        mm.Body += ("INR" + total + "</div></div></div><div class='gap'></div></form>");


        //mm.Subject = aemail.Value + " , " + aname.Value + " , " + dest.Value + " , " + sdt.Value;
        //var
        //Mr,/gr,/hrh,/45,/South Africa~Cape Town~1~0~0~0!968~1 Day Hop On Hop Off~
        //Mr,/abhishek,/kumar,/34,/South Africa~Cape Town~1~0~0~0!968~                                    1 Day Hop On Hop Off
        //~$OOU!Admin Staff!TRAVREZ99!!Travstarz holidays and Destination pvt ltd!Hauz Khas!01147050034!8928129089!Abhishek Kumar
        //!INR!New Delhi!Delhi!110016!INDIA!OOU!A

        mm.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();

        smtp.Host      = "smtp.mailhostbox.com";
        smtp.EnableSsl = true;

        ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };
        NetworkCredential NetworkCred = new NetworkCredential();

        NetworkCred.UserName       = "******";
        NetworkCred.Password       = "******";
        smtp.UseDefaultCredentials = true;
        smtp.Credentials           = NetworkCred;
        smtp.Port = 25;
        smtp.Send(mm);
        try
        {
        }


        catch (SmtpFailedRecipientsException ex)
        {
            for (int i = 0; i < ex.InnerExceptions.Length; i++)
            {
                SmtpStatusCode status1 = ex.InnerExceptions[i].StatusCode;
                if (status1 == SmtpStatusCode.MailboxBusy ||
                    status1 == SmtpStatusCode.MailboxUnavailable)
                {
                    Console.WriteLine("Delivery failed - retrying in 5 seconds.");
                    System.Threading.Thread.Sleep(5000);
                    smtp.Send(mm);
                }
                else
                {
                    Console.WriteLine("Failed to deliver message to {0}",
                                      ex.InnerExceptions[i].FailedRecipient);
                }
            }
        }

        catch (Exception ex)
        {
            Console.WriteLine("Exception caught in RetryIfBusy(): {0}",
                              ex.ToString());
        }
        // Response.Redirect(Request.Url.AbsoluteUri);
    }
Example #36
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["HotelNamePreference"]       = DDLHotel.SelectedValue;
        Session["AirlineCabinPreference"]    = DDLPlaneCabin.SelectedValue;
        Session["AirlineNamePreference"]     = DDLAirline.SelectedValue;
        Session["CarTransmissionPreference"] = DDLCarTrans.SelectedValue;
        Session["TrainCabinPreference"]      = DDLTrainCabin.SelectedValue;
        if (!IsPostBack)
        {
            if (((string[])Session["UserIdAndAcctType"])[1].Equals("B"))
            {
                lblAstDropDown.Visible = true;
            }

            try
            {
                System.Data.SqlClient.SqlConnection sc  = new System.Data.SqlClient.SqlConnection();
                System.Data.SqlClient.SqlCommand    cmd = new System.Data.SqlClient.SqlCommand();
                sc.ConnectionString = @"Data Source=pkyqlbhc9z.database.windows.net;Initial Catalog=KPMGTravel;Persist Security Info=True;User ID=episcopd;Password=Showker93;";

                sc.Open();
                cmd.Connection  = sc;
                cmd.CommandText = @"select isnull(Passport, ' '), isnull(TSAKTNNumber, ' '), isnull(TSAPrecheck, ' ') from TSATable where UserID = @UserID";
                cmd.Parameters.AddWithValue("@UserID", ((string[])Session["UserIdAndAcctType"])[0]);
                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    txtPassportNumber.Text = reader.GetString(0);
                    txtTSAKN.Text          = reader.GetString(1);
                    txtPre.Text            = reader.GetString(2);
                }
                reader.Close();

                cmd.CommandText = "";
                cmd.CommandText = @"select isnull(CardHolder, ' '), isnull(CardNumber, ' '), isnull(CardType, ' '), isnull(CardExpiration, ' ') from CreditCard where UserID = @UserID1";
                cmd.Parameters.AddWithValue("@UserID1", ((string[])Session["UserIdAndAcctType"])[0]);
                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    txtCCName.Text   = reader.GetString(0);
                    txtCCNumber.Text = reader.GetString(1);
                    txtCCType.Text   = reader.GetString(2);
                    txtCCExp.Text    = reader.GetString(3);
                }
                reader.Close();

                if (((string[])Session["UserIdAndAcctType"])[1].Equals("B"))
                {
                    AssistantDropDown.Visible = true;
                    cmd.CommandText           = @"Select UserID from SystemUser Where AssistantID = @accty";
                    cmd.Parameters.AddWithValue("@accty", ((string[])Session["UserIdAndAcctType"])[0]);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        string tempstr = reader.GetString(0);
                        strlis.Add(tempstr);
                    }
                    Session["strlis"]            = strlis;
                    AssistantDropDown.DataSource = (List <string>)Session["strlis"];
                    AssistantDropDown.DataBind();
                    reader.Close();
                }

                //int user = Convert.ToInt32(Session["UserID"]);
                cmd.CommandText = "";
                cmd.CommandText = @"SELECT UserID, isnull(FirstName, ' ') As FirstName, isnull(MiddleName, ' ') As MiddleName, isnull(LastName, ' ') As LastName, isnull(AddressLineOne, ' '), isnull(AddressLineTwo, ' '), 
                                    isnull(City, ' '), isnull(State, ' '), isnull(Zip_Code, ' '), isnull(Telephone, ' '), isnull(Email_Address, ' ') From [SystemUser] WHERE [SystemUser].[UserID] = @UserID2";
                cmd.Parameters.AddWithValue("@UserID2", ((string[])Session["UserIdAndAcctType"])[0]);

                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    txtUserID.Text     = reader.GetString(0);
                    txtFirstName.Text  = reader.GetString(1);
                    txtMiddleName.Text = reader.GetString(2);
                    txtLastName.Text   = reader.GetString(3);
                    txtAddress.Text    = reader.GetString(4);
                    txtAddress2.Text   = reader.GetString(5);
                    txtCity.Text       = reader.GetString(6);
                    txtState.Text      = Convert.ToString(reader.GetValue(7));
                    txtZipCode.Text    = Convert.ToString(reader.GetValue(8));
                    txtTelephone.Text  = reader.GetString(9);
                    txtEmail.Text      = reader.GetString(10);
                }
                reader.Close();
            }
            catch (Exception)
            {
                //Display Error for not being able to connect to database
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Error Connecting to Database.');", true);
            }
        }
    }
    private void PreencheCampos(string ID)
    {
        string ScriptDados = "";

        str.Clear();

        ScriptDados = "<script type=\"text/javascript\">";
        str.Append(ScriptDados);
        ScriptDados = "var x = document.getElementsByClassName('form-control');";
        str.Append(ScriptDados);

        string stringSelect = "select " +
                              "Nome," +
                              "format(Nascimento,'yyyy-MM-dd') as d1, " +
                              "EstadoCivil," +
                              "Pai," +
                              "Mae," +
                              "Responsavel," +
                              "ResponsavelCPF," +
                              "ResponsavelTel," +
                              "Naturalidade," +
                              "Nacionalidade," +
                              "Etnia," +    //10
                              "TipoSanguinio," +
                              "Deficiente," +
                              "DeficienteTipo," +
                              "ID_Curso," +
                              "ID_Turma," +
                              "matricula," +
                              "Endereco," +
                              "Latitude," +
                              "Longitude," +
                              "Numero," + //20
                              "Bairro," +
                              "CEP," +
                              "Cidade," +
                              "UF," +
                              "Celular1," +
                              "Celular2," +
                              "TelFixo," +
                              "email," +
                              "PIS," +
                              "CPF," +  //30
                              "RG," +
                              "RGEmissor," +
                              "RGEmissao," +
                              "CTPS," +
                              "CTPSserie," +
                              "CTPSEmissao," +
                              "Titulo," +
                              "Zona," +
                              "Secao," +
                              "CNH," +  //40
                              "Passaporte," +
                              "CertNasc ," +
                              "Alergias," +
                              "AlergiasMed," +
                              "AcidenteAvisar," +
                              "CartaoSUS," +
                              "FardaCamisa," +
                              "FardaCamiseta," +
                              "FardaCalca," +
                              "FardaSapato," + //50
                              "FardaBota," +
                              "FardaObs," +
                              "FotoDataURI " + //53
                              "from Tbl_Alunos " +
                              "where ID_aluno  = " + ID;

        string        getValor = " ";
        OperacaoBanco operacao = new OperacaoBanco();

        System.Data.SqlClient.SqlDataReader rcrdset = operacao.Select(stringSelect);
        while (rcrdset.Read())
        {
            for (int i = 0; i < 53; i++)
            {
                ScriptDados = "x[" + i + "].value = \"" + Convert.ToString(rcrdset[i]) + "\";";
                str.Append(ScriptDados);
            }

            ScriptDados = "document.getElementById('results').innerHTML = '<img src=\"" + Convert.ToString(rcrdset[53]) + "\"/>'; ";
            str.Append(ScriptDados);
            ScriptDados = "document.getElementById('Hidden1').value = \"" + Convert.ToString(rcrdset[53]) + "\";";
            str.Append(ScriptDados);
            ScriptDados = "document.getElementById('IDHidden').value = \"" + ID + "\";";
            str.Append(ScriptDados);

            ScriptDados = "document.getElementById('al1').innerHTML = \"" + Convert.ToString(rcrdset[0]) + "\";";
            str.Append(ScriptDados);

            ScriptDados = "document.getElementById('al2').innerHTML = \"" + Convert.ToString(rcrdset[0]) + "\";";
            str.Append(ScriptDados);

            ScriptDados = "document.getElementById('al3').innerHTML = \"" + Convert.ToString(rcrdset[0]) + "\";";
            str.Append(ScriptDados);

            ScriptDados = "document.getElementById('al4').innerHTML = \"" + Convert.ToString(rcrdset[0]) + "\";";
            str.Append(ScriptDados);

            ScriptDados = "document.getElementById('al5').innerHTML = \"" + Convert.ToString(rcrdset[0]) + "\";";
            str.Append(ScriptDados);

            ScriptDados = "document.getElementById('al6').innerHTML = \"" + Convert.ToString(rcrdset[0]) + "\";";
            str.Append(ScriptDados);


            ScriptDados = "var latitude = document.getElementById('input_lat').value;";
            str.Append(ScriptDados);

            ScriptDados = "var longitude = document.getElementById('input_lng').value;";
            str.Append(ScriptDados);

            ScriptDados = "var urlMapa = \"MapaAuxiliar.aspx?lat=\" + latitude + \"&lng=\" + longitude;";
            str.Append(ScriptDados);

            ScriptDados = "window.open(urlMapa, 'MapFrame');";
            str.Append(ScriptDados);

            getValor = "document.getElementById('input_matri').value = \"" + Convert.ToString(rcrdset[16]) + "\";";
            str.Append(getValor);

            if (getValor == "0")
            {
                getValor = " ";
            }
        }
        ConexaoBancoSQL.fecharConexao();

        ScriptDados = "</script>";
        str.Append(ScriptDados);

        Literal1.Text = str.ToString();
    }
Example #38
0
    //open comment modal
    protected void moreInfoJobLinkBtn_Click(object sender, CommandEventArgs e)
    {
        // working here

        String connectionString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;

        System.Data.SqlClient.SqlConnection sql = new System.Data.SqlClient.SqlConnection(connectionString);

        int         rowIndex = Convert.ToInt32(((sender as LinkButton).NamingContainer as GridViewRow).RowIndex);
        GridViewRow row      = GridView1.Rows[rowIndex];


        int jobID = Convert.ToInt32(e.CommandArgument);

        Session["selectedLogID"] = jobID.ToString();

        sql.Open();
        System.Data.SqlClient.SqlCommand moreJobInfo = new System.Data.SqlClient.SqlCommand();
        moreJobInfo.Connection  = sql;
        moreJobInfo.CommandText = "SELECT StudentComment.Comment, OrganizationComment.Comment AS Expr1 FROM OrganizationComment INNER JOIN StudentComment ON OrganizationComment.LogID = StudentComment.LogID INNER JOIN LogHours ON OrganizationComment.LogID = LogHours.LogID where LogHours.LogID = " + Session["selectedLogID"];
        System.Data.SqlClient.SqlDataReader reader = moreJobInfo.ExecuteReader();

        while (reader.Read())
        {
            StudentComment.Text  = reader.GetString(0);
            BusinessComment.Text = reader.GetString(1);
        }

        sql.Close();



        ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openEditJModal();", true);


        if (chkImage.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Image")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Image")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }

        if (chkGradeLevel.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Grade Level")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Grade Level")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }


        if (chkGPA.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "GPA")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "GPA")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }


        if (chkHoursWBL.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Hours of WBL")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Hours of WBL")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }


        if (chkJobType.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Job Type")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Job Type")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }
    }
 public Profile_Account(System.Data.SqlClient.SqlDataReader reader)
 {
     this.AddItemsToListBySqlDataReader(reader);
 }
    private void TabelaCorpo()
    {
        string stringselect = "";

        switch (RelFiltro)
        {
        case "Todas":
            stringselect = "select  nome, vinculo, Situacao , funcao, lotado " +
                           "from Tbl_Funcionarios " +
                           "where ID_Munic = " + idMunicAux +
                           " order by lotado,nome";
            break;

        default:
            stringselect = "select nome, vinculo, Situacao , funcao, lotado " +
                           "from Tbl_Funcionarios " +
                           "where ID_Munic = " + idMunicAux +
                           " and lotado = '" + RelFiltro + "'" +
                           " order by lotado,nome";
            break;
        }

        OperacaoBanco operacao = new OperacaoBanco();

        System.Data.SqlClient.SqlDataReader dados = operacao.Select(stringselect);
        string Coluna1, Coluna2, Coluna3, Coluna4, Coluna5;
        int    total_registros = 0;

        while (dados.Read())
        {
            Coluna1 = Convert.ToString(dados[0]);
            Coluna2 = Convert.ToString(dados[1]);
            Coluna3 = Convert.ToString(dados[2]);
            Coluna4 = Convert.ToString(dados[3]);
            Coluna5 = Convert.ToString(dados[4]);

            cell = new PdfPCell(new Phrase(Coluna1, fontTabela)); table.AddCell(cell);
            cell = new PdfPCell(new Phrase(Coluna2, fontTabela)); table.AddCell(cell);
            cell = new PdfPCell(new Phrase(Coluna3, fontTabela)); table.AddCell(cell);
            cell = new PdfPCell(new Phrase(Coluna4, fontTabela)); table.AddCell(cell);
            if (colunas == 5)
            {
                cell = new PdfPCell(new Phrase(Coluna5, fontTabela)); table.AddCell(cell);
            }
            total_registros++;
        }
        ConexaoBancoSQL.fecharConexao();

        string totalreg = "Total de Registros:" + total_registros;
        string linhabranco = "---";

        cell = new PdfPCell(new Phrase(linhabranco, fontTabelaHeader)); table.AddCell(cell);
        cell = new PdfPCell(new Phrase(linhabranco, fontTabelaHeader)); table.AddCell(cell);
        cell = new PdfPCell(new Phrase(linhabranco, fontTabelaHeader)); table.AddCell(cell);
        if (colunas == 5)
        {
            cell = new PdfPCell(new Phrase(linhabranco, fontTabelaHeader)); table.AddCell(cell);
            cell = new PdfPCell(new Phrase(totalreg, fontTabelaHeader)); table.AddCell(cell);
        }
        else
        {
            cell = new PdfPCell(new Phrase(totalreg, fontTabelaHeader)); table.AddCell(cell);
        }
    }
Example #41
0
    public string cardBuilder(Literal name, string cardQuery, string searchString)
    {
        string cardString = "";

        Boolean searchCheck = false;

        for (int i = 0; i < searchString.Length - 1; i++)
        {
            String checkValue = searchString.Substring(i, 2);
            if (checkValue == ", ")
            {
                searchCheck = true;
            }
        }

        if (searchCheck == true)
        {
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["roommagnetdbConnectionString"].ToString());
            SqlConnection sc      = new SqlConnection(ConfigurationManager.ConnectionStrings["roommagnetdbConnectionString"].ToString());
            sqlConn.Open();

            String tSearch    = HttpUtility.HtmlEncode(searchString);
            int    commaSplit = tSearch.IndexOf(",");
            String cityString = tSearch.Substring(0, commaSplit).ToUpper();
            String state      = tSearch.Substring(commaSplit + 2).ToUpper();

            System.Data.SqlClient.SqlCommand sqlComm = new System.Data.SqlClient.SqlCommand(cardQuery, sqlConn);
            sqlComm.Parameters.Add(new SqlParameter("@City", cityString));
            sqlComm.Parameters.Add(new SqlParameter("@State", state));
            System.Data.SqlClient.SqlDataReader reader = sqlComm.ExecuteReader();

            name.Text = "";
            int resultCount = 0;

            while (reader.Read())
            {
                int    PropID         = Convert.ToInt32(reader["PropertyID"]);
                String city           = reader["City"].ToString();
                String homeState      = reader["HomeState"].ToString();
                String priceRangeLow  = reader["RoomPriceRangeLow"].ToString();
                String priceRangeHigh = reader["RoomPriceRangeHigh"].ToString();
                String filename       = reader["images"].ToString();
                if (filename == "")
                {
                    filename = "imagenotfound.png";
                }

                System.Data.SqlClient.SqlCommand modal = new System.Data.SqlClient.SqlCommand();
                modal.Connection  = sc;
                modal.CommandText = "SELECT PropertyImages.images, PropertyRoom.AboutPropertyRoom " +
                                    "FROM PropertyImages INNER JOIN" +
                                    " Property ON PropertyImages.PropertyID = Property.PropertyID INNER JOIN" +
                                    "PropertyRoom ON Property.PropertyID = PropertyRoom.PropertyID" +
                                    "WHERE Property.PropertyID = " + PropID;

                double priceLowRounded  = Math.Round(Convert.ToDouble(priceRangeLow), 0, MidpointRounding.ToEven);
                double priceHighRounded = Math.Round(Convert.ToDouble(priceRangeHigh), 0, MidpointRounding.ToEven);
                string chars            = addCharacteristics(PropID);

                //Displays property on card
                StringBuilder myCard = new StringBuilder();
                myCard
                .Append("<div class=\"col-xs-4 col-md-3\">")
                .Append("   <div class=\"card  shadow-sm  mb-4\" >")
                .Append("       <img class=\"img-fluid card-img-small\" src=\"https://duvjxbgjpi3nt.cloudfront.net/PropertyImages/" + filename + "\" />")
                .Append("       <a data-toggle=\"modal\" href=\"#propDetailModal\" class=\"cardLinks\">")
                .Append("           <div class=\"card-body\" style=\"background-color: #fff;\">")
                .Append("               <h5 class=\"card-title\">" + city + ", " + homeState + "</h5>")
                .Append("               <p class=\"card-text\">" + "$" + priceLowRounded + " - " + "$" + priceHighRounded + "</p>")
                .Append(chars)
                .Append("           </div>")
                .Append("       </a>")
                .Append("       <div>")
                .Append("           <button type=\"button\" id=\"heartbtn" + resultCount + "\" onClick=\"favoriteBtn(" + PropID + "," + "\'" + city + "\'" + "," +
                        "\'" + homeState + "\'" + "," + priceLowRounded + "," + priceHighRounded + ")\" " +
                        "class=\"btn favoriteHeartButton\"><i id=\"hearti\" class=\"far fa-heart\"></i></button>")
                .Append("       </div>")
                .Append("   </div>")
                .Append("</div>")
                .Append(" ")
                .Append("<div class=\"modal\" id=\"propDetailModal\">")
                .Append("    <div class=\"modal-dialog modal-lg\">")
                .Append("        <div class=\"modal-content\">")
                .Append("            <div class=\"modal-body\">")
                .Append("                <div class=\"container-fluid searchpageDetailBodyContent pl-0 pr-0 mt-0\">")
                .Append("                    <div id=\"carousel-thumb\" class=\"carousel slide carousel-fade carousel-thumbnails\" data-ride=\"carousel\">")
                .Append("                        <div class=\"carousel-inner\" role=\"listbox\">")
                .Append("                            <div class=\"carousel-item active\">")
                .Append("                                <img class=\"d-block w-100\" src=\"images/anthony-rooke--NJO7AF0mUo-unsplash.jpg\"")
                .Append("                                    alt=\"First slide\">")
                .Append("                            </div>")
                .Append("")
                .Append("                            <div class=\"carousel-item\">")
                .Append("                                <img class=\"d-block w-100\" src=\"images/loft-style-bedroom.jpg\"")
                .Append("                                    alt=\"Second slide\">")
                .Append("                            </div>")
                .Append("")
                .Append("                            <div class=\"carousel-item\">")
                .Append("                                <img class=\"d-block w-100\" src=\"images/scott-webb-1ddol8rgUH8-unsplash.jpg\"")
                .Append("                                    alt=\"Third slide\">")
                .Append("                            </div>")
                .Append("                        </div>")
                .Append("")
                .Append("                        <a class=\"carousel-control-prev\" href=\"#carousel-thumb\" role=\"button\" data-slide=\"prev\">")
                .Append("                            <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span>")
                .Append("                            <span class=\"sr-only\">Previous</span>")
                .Append("                        </a>")
                .Append("")
                .Append("                        <a class=\"carousel-control-next\" href=\"#carousel-thumb\" role=\"button\" data-slide=\"next\">")
                .Append("                            <span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span>")
                .Append("                            <span class=\"sr-only\">Next</span>")
                .Append("                        </a>")
                .Append("")
                .Append("                        <ol class=\"carousel-indicators\">")
                .Append("                            <li data-target=\"#carousel-thumb\" data-slide-to=\"0\" class=\"active\">")
                .Append("                                <img src=\"images/anthony-rooke--NJO7AF0mUo-unsplash.jpg\" width=\"100\">")
                .Append("                            </li>")
                .Append("                            <li data-target=\"#carousel-thumb\" data-slide-to=\"1\">")
                .Append("                                <img src=\"images/loft-style-bedroom.jpg\" width=\"100\">")
                .Append("                            </li>")
                .Append("                            <li data-target=\"#carousel-thumb\" data-slide-to=\"2\">")
                .Append("                                <img src=\"images/scott-webb-1ddol8rgUH8-unsplash.jpg\" width=\"100\">")
                .Append("                            </li>")
                .Append("                        </ol>")
                .Append("                    </div>")
                .Append("")
                .Append("                    <section>")
                .Append("                        <div class=\"row propertyPageDetailTitle pt-3 pb-3\">")
                .Append("                            <div class=\"col-md-10 pl-5\">")
                .Append("                                <h2>Kew Gardens</h2>")
                .Append("                            </div>")
                .Append("                            <div class=\"col-md-2\">")
                .Append("                                <button class=\"btn favoriteHeartButton\"><i class=\"far fa-heart\"></i></button>")
                .Append("                            </div>")
                .Append("            ")
                .Append("                            <div class=\"col-md-12\">")
                .Append("                                <div class=\"pl-3\">")
                .Append("                                    <button class=\"btn personality-outline btn-sm\">Extrovert</button>")
                .Append("                                    <button class=\"btn personality-outline btn-sm\">Wifi</button>")
                .Append("                                    <button class=\"btn personality-outline btn-sm\">Street Parking</button>")
                .Append("                                </div>")
                .Append("                            </div>")
                .Append("            ")
                .Append("                        </div>")
                .Append("                    </section>")
                .Append("            ")
                .Append("                    <section>")
                .Append("                        <div class=\"row px-5 py-5\">")
                .Append("                            <div class=\"col-md-8 \">")
                .Append("                                <div class=\"col-md-12 card  shadow-sm  px-5 py-5\">")
                .Append("                                    <div>")
                .Append("                                        <h4>AboutProperty</h4>")
                .Append("                                    </div>")
                .Append("                                </div>")
                .Append("            ")
                .Append("                                <div class=\"col-md-12 card  shadow-sm  px-5 py-5\">")
                .Append("                                    <div>")
                .Append("                                        <h4>Amenities</h4>")
                .Append("                                    </div>")
                .Append("                                </div>")
                .Append("            ")
                .Append("                                <div class=\"col-md-12 card  shadow-sm  px-5 py-5\">")
                .Append("                                    <div>")
                .Append("                                        <h4>Local Information</h4>")
                .Append("                                    </div>")
                .Append("                                </div>")
                .Append("                            </div>")
                .Append("                        </div>")
                .Append("            ")
                .Append("                    </section>")
                .Append("                </div>")
                .Append("            </div>")
                .Append("        </div>")
                .Append("    </div>")
                .Append("</div>");

                name.Text += myCard.ToString();
                resultCount++;
                Session["Search"] = null;
            }

            reader.Close();
            Session["Search"]   = null;
            resultLabel.Visible = true;
        }
        else
        {
            //Label for no search results
            resultLabel.Text = "<strong>The search you entered was not in the right format (Format: City, State)</strong>";
        }

        return(cardString);
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        Boolean success  = false;
        int     id       = 0;
        String  usertype = "";

        System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection();
        sc.ConnectionString = @"Data Source=aay09edjn65sf6.cpcbbo8ggvx6.us-east-1.rds.amazonaws.com;Initial Catalog=RoomMagnet;Persist Security Info=True;User ID=fahrenheit;Password=cis484fall";
        sc.Open();
        System.Data.SqlClient.SqlCommand match = new System.Data.SqlClient.SqlCommand();
        match.Connection = sc;
        //match.CommandText = "select PasswordHash from [db_owner].[AdminPassword] where Email = @Email";
        match.CommandText = "select passwordhash from[db_owner].[AdminPassword] where Email = @Email " +
                            "union select passwordhash from[dbo].[HostPassword] where Email = @Email " +
                            "union select passwordhash from[dbo].[TenantPassword] where Email = @Email";

        match.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Email", tbEmail.Text));
        System.Data.SqlClient.SqlDataReader reader = match.ExecuteReader(); // create a reader

        if (reader.HasRows)
        {
            while (reader.Read())                                               // this will read the single record that matches the entered usename
            {
                string storedHash = reader["PasswordHash"].ToString();          // store the database password into this varable
                if (PasswordHash.ValidatePassword(tbPassword.Text, storedHash)) // if the entered password matches what is stored, it will show success
                {
                    Label1.Text = "Success!";
                    success     = true;
                }
                else
                {
                    Label1.Text = "Password is wrong.";
                }
            }
        }
        else // if the username does not exist, it will show failure.
        {
            Label1.Text = "Login failed";
        }
        sc.Close();
        if (success == true)
        {
            sc.Open();
            System.Data.SqlClient.SqlCommand matchID = new System.Data.SqlClient.SqlCommand();
            matchID.Connection = sc;
            //matchID.CommandText = "Select AdminID from [db_owner].[AdminPassword] where Email = @Email";
            matchID.CommandText = "select adminid from[db_owner].[AdminPassword] where Email = @Email " +
                                  "union select hostid from[dbo].[HostPassword] where Email = @Email " +
                                  "union select tenantid from[dbo].[TenantPassword] where Email = @Email";
            matchID.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Email", tbEmail.Text));
            id = (Int32)matchID.ExecuteScalar();
            Session["globalID"] = id;
            Label1.Text         = "Success! ID is: " + id;

            System.Data.SqlClient.SqlCommand type = new System.Data.SqlClient.SqlCommand();
            type.Connection = sc;

            type.CommandText = "select UserType from [dbo].[RMUser] where userid = " + id;
            usertype         = type.ExecuteScalar().ToString();

            switch (usertype)
            {
            case "t":
                Response.Redirect("MasterTenantDash.aspx");
                break;

            case "h":
                Response.Redirect("MasterHostDashboard.aspx");
                break;

            case "a":
                Response.Redirect("MasterAdminDashboard.aspx");
                break;
            }
        }
    }
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(MICompanyNameTypes micompanynametypes, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null)
            {
                return;
            }


            // Create a local variable for the new instance.
            MICompanyNameType newobj = null;

            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(micompanynametypes.ContainsType[0]) as MICompanyNameType;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                micompanynametypes.Add(newobj);
            }
        }
Example #44
0
        /// <summary>
        /// 高级查询
        /// </summary>
        /// <param name="rate"></param>
        /// <returns></returns>
        public static ArrayList getList(double rate)
        {
            TranslationBase tlb = new TranslationBase();

            ArrayList coll = new ArrayList();

            string columns = "";

            object obj = DBHelper.ExecuteScalar("select ColumnName from QueryColumnsInfo where Number='" + System.Web.HttpContext.Current.Session["Company"].ToString() + "'");

            if (obj != null)
            {
                columns = obj.ToString();
            }

            //添加会员基本信息表的字段
            coll.Add(new QueryKey("mi.Number", tlb.GetTran("000024", "会员编号"), true, "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Placement", tlb.GetTran("000706", "安置人编号"), oldColumn(tlb.GetTran("000706", "安置人编号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mp.Name", tlb.GetTran("000097", "安置人姓名"), oldColumn(tlb.GetTran("000097", "安置人姓名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Direct", tlb.GetTran("000043", "推荐人编号"), oldColumn(tlb.GetTran("000043", "推荐人编号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("d.Name", tlb.GetTran("000192", "推荐人姓名"), oldColumn(tlb.GetTran("000192", "推荐人姓名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Name", tlb.GetTran("000025", "会员姓名"), oldColumn(tlb.GetTran("000025", "会员姓名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.PetName", tlb.GetTran("000063", "会员昵称"), oldColumn(tlb.GetTran("000063", "会员昵称"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("lv.levelstr", tlb.GetTran("000903", "会员级别"), oldColumn(tlb.GetTran("000903", "会员级别"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.RegisterDate", tlb.GetTran("000057", "注册日期"), oldColumn(tlb.GetTran("000057", "注册日期"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("dateadd(hh,8,mi.advtime)", tlb.GetTran("007301", "激活日期"), oldColumn(tlb.GetTran("007301", "激活日期"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Birthday", tlb.GetTran("000105", "出生日期"), oldColumn(tlb.GetTran("000105", "出生日期"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.Sex", tlb.GetTran("000085", "性别"), oldColumn(tlb.GetTran("000085", "性别"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.PostalCode", tlb.GetTran("000073", "邮编"), oldColumn(tlb.GetTran("000073", "邮编"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.HomeTele", tlb.GetTran("000065", "家庭电话"), oldColumn(tlb.GetTran("000065", "家庭电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.OfficeTele", tlb.GetTran("000044", "办公电话"), oldColumn(tlb.GetTran("000044", "办公电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.MobileTele", tlb.GetTran("000069", "移动电话"), oldColumn(tlb.GetTran("000069", "移动电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.FaxTele ", tlb.GetTran("000071", "传真电话"), oldColumn(tlb.GetTran("000071", "传真电话"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.CPCCode", tlb.GetTran("000916", "国家省份城市"), oldColumn(tlb.GetTran("000916", "国家省份城市"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.Address", tlb.GetTran("000920", "详细地址"), oldColumn(tlb.GetTran("000920", "详细地址"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("p.PaperType", tlb.GetTran("000081", "证件类型"), oldColumn(tlb.GetTran("000081", "证件类型"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.PaperNumber", tlb.GetTran("000083", "证件号码"), oldColumn(tlb.GetTran("000083", "证件号码"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.bankcode", tlb.GetTran("000087", "开户银行"), oldColumn(tlb.GetTran("000087", "开户银行"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.bankBook", tlb.GetTran("000086", "开户名"), oldColumn(tlb.GetTran("000086", "开户名"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey("mi.bankbranchname", tlb.GetTran("006046", "支行名称"), oldColumn(tlb.GetTran("006046", "支行名称"), columns), "text", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.BankBook ", tlb.GetTran("000111", "银行账号"), oldColumn(tlb.GetTran("000111", "银行账号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey(@"mi.BankCard ", tlb.GetTran("000923", "卡号"), oldColumn(tlb.GetTran("000923", "卡号"), columns), "string", false, new Unit(100)));
            coll.Add(new QueryKey("mi.ExpectNum", tlb.GetTran("000090", "个人期数"), oldColumn(tlb.GetTran("000090", "个人期数"), columns), "text", false, new Unit(100)));

            //添加会员结算表的字段
            //coll.Add(new QueryKey("mn.LayerBit1", tlb.GetTran("000928", "安置层位"), oldColumn(tlb.GetTran("000928", "安置层位"), columns), "text", false, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.LayerBit2", tlb.GetTran("000929", "推荐层位"), oldColumn(tlb.GetTran("000929", "推荐层位"), columns), "text", false, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.Ordinal1", tlb.GetTran("000930", "安置序号"), oldColumn(tlb.GetTran("000930", "安置序号"), columns), "text", false, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.Ordinal2", tlb.GetTran("000932", "推荐序号"), oldColumn(tlb.GetTran("000932", "推荐序号"), columns), "text", false, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalNetNum", tlb.GetTran("000933", "总网人数"), oldColumn(tlb.GetTran("000933", "总网人数"), columns), "text", true, "int", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentNewNetNum", tlb.GetTran("000934", "新网人数"), oldColumn(tlb.GetTran("000934", "新网人数"), columns), "text", true, "int", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentTotalNetRecord ", tlb.GetTran("000936", "新网分数"), oldColumn(tlb.GetTran("000936", "新网分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalNetRecord", tlb.GetTran("000937", "总网分数"), oldColumn(tlb.GetTran("000937", "总网分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentOneMark ", tlb.GetTran("000939", "新个分数"), oldColumn(tlb.GetTran("000939", "新个分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalOneMark ", tlb.GetTran("000940", "总个分数"), oldColumn(tlb.GetTran("000940", "总个分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.NotTotalMark ", tlb.GetTran("000942", "未付款的总个分数"), oldColumn(tlb.GetTran("000942", "未付款的总个分数"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.TotalNotNetRecord ", tlb.GetTran("000944", "未付款的总网分数"), oldColumn(tlb.GetTran("000944", "未付款的总网分数"), columns), "text", true, "double", new Unit(100)));
            //------------------------------------------------------------------------------------------------------------
            //coll.Add(new QueryKey("mn.Bonus0 * " + rate.ToString() + " ", tlb.GetTran("7577", "无"), oldColumn(tlb.GetTran("7577", "无"), columns), "text", true,"double", new Unit(100)));
            coll.Add(new QueryKey("mn.Bonus0 * " + rate.ToString() + " ", tlb.GetTran
                                      ("010002", "业绩奖"), oldColumn(tlb.GetTran
                                                                       ("010002", "业绩奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus2 * " + rate.ToString() + " ", tlb.GetTran
//("007579", "回本奖"), oldColumn(tlb.GetTran
//("007579", "回本奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus3 * " + rate.ToString() + " ", tlb.GetTran
//("007580", "大区奖"), oldColumn(tlb.GetTran
//("007580", "大区奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus4 * " + rate.ToString() + " ", tlb.GetTran
//("007581", "小区奖"), oldColumn(tlb.GetTran
//("007581", "小区奖"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Bonus5 * " + rate.ToString() + " ", tlb.GetTran
//("007582", "永续奖"), oldColumn(tlb.GetTran
//("007582", "永续奖"), columns), "text", true, "double", new Unit(100)));

//            coll.Add(new QueryKey("mn.Bonus6 * " + rate.ToString() + " ", tlb.GetTran
//("009128", "进步奖"), oldColumn(tlb.GetTran
//("009128", "进步奖"), columns), "text", true, "double", new Unit(100)));
//            //------------------------------------------------------------------------------------------------------------
//            coll.Add(new QueryKey("mn.Kougl * " + rate.ToString() + " ", tlb.GetTran("001352", "网平台综合管理费"), oldColumn(tlb.GetTran("001352", "网平台综合管理费"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Koufl * " + rate.ToString() + " ", tlb.GetTran("001353", "网扣福利奖金"), oldColumn(tlb.GetTran("001353", "网扣福利奖金"), columns), "text", true, "double", new Unit(100)));
//            coll.Add(new QueryKey("mn.Koufx * " + rate.ToString() + " ", tlb.GetTran("001355", "网扣重复消费"), oldColumn(tlb.GetTran("001355", "网扣重复消费"), columns), "text", true, "double", new Unit(100)));

            coll.Add(new QueryKey("mn.CurrentTotalMoney * " + rate.ToString() + " ", tlb.GetTran("000247", "总计"), oldColumn(tlb.GetTran("000247", "总计"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.DeductTax * " + rate.ToString() + " ", tlb.GetTran("000249", "扣税"), oldColumn(tlb.GetTran("000249", "扣税"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.DeductMoney * " + rate.ToString() + " ", tlb.GetTran("000251", "扣款"), oldColumn(tlb.GetTran("000251", "扣款"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("mn.CurrentSolidSend * " + rate.ToString() + " ", tlb.GetTran("000254", "实发"), oldColumn(tlb.GetTran("000254", "实发"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.BonusAccumulation * " + rate.ToString() + " ", tlb.GetTran("000951", "总计累计"), oldColumn(tlb.GetTran("000951", "总计累计"), columns), "text", true, "double", new Unit(100)));
            //coll.Add(new QueryKey("mn.SolidSendAccumulation * " + rate.ToString() + " ", tlb.GetTran("000953", "实发累计"), oldColumn(tlb.GetTran("000953", "实发累计"), columns), "text", true, "double", new Unit(100)));
            coll.Add(new QueryKey("cfg.[Date]", tlb.GetTran("000954", "期数日期"), oldColumn(tlb.GetTran("000954", "期数日期"), columns), "text", true, "text", new Unit(100)));

            #region  除不能显示的
            if (System.Web.HttpContext.Current.Session["dian"] != null)
            {
                Hashtable htb = new Hashtable();
                System.Data.SqlClient.SqlDataReader sdr = DBHelper.ExecuteReader("SELECT FieldExtend,StoreSelect FROM QueryField");
                while (sdr.Read())
                {
                    if (htb[sdr["FieldExtend"].ToString().Trim()] == null)
                    {
                        htb.Add(sdr["FieldExtend"].ToString().Trim(), Convert.ToInt32(sdr["StoreSelect"]));
                    }
                }
                sdr.Close();
                for (int i = coll.Count - 1; i >= 0; i--)
                {
                    string key = ((QueryKey)coll[i]).Name.Trim();
                    if (htb[key] != null && (int)htb[key] == 0)
                    {
                        coll.RemoveAt(i);
                    }
                }
            }
            else
            {
                if (System.Web.HttpContext.Current.Session["bh"] != null)
                {
                    Hashtable htb = new Hashtable();
                    System.Data.SqlClient.SqlDataReader sdr = DBHelper.ExecuteReader("SELECT FieldExtend,MemberSelect FROM QueryField");
                    while (sdr.Read())
                    {
                        if (htb[sdr["FieldExtend"].ToString().Trim()] == null)
                        {
                            htb.Add(sdr["FieldExtend"].ToString().Trim(), Convert.ToInt32(sdr["MemberSelect"]));
                        }
                    }
                    sdr.Close();
                    for (int i = coll.Count - 1; i >= 0; i--)
                    {
                        string key = ((QueryKey)coll[i]).Name.Trim();
                        if (htb[key] != null && (int)htb[key] == 0)
                        {
                            coll.RemoveAt(i);
                        }
                    }
                }
            }
            #endregion

            return(coll);
        }
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(ProposedHousingExpenses proposedhousingexpenses, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null)
            {
                return;
            }


            // Create a local variable for the new instance.
            ProposedHousingExpense newobj = null;

            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(proposedhousingexpenses.ContainsType[0]) as ProposedHousingExpense;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                proposedhousingexpenses.Add(newobj);
            }
        }
Example #46
0
        public void makingReport()
        {
            Qty_Tot_ltr = 0;
            InventoryClass obj = new InventoryClass();

            System.Data.SqlClient.SqlDataReader rdr = null;
            string home_drive = Environment.SystemDirectory;

            home_drive = home_drive.Substring(0, 2);
            string       path = home_drive + @"\Inetpub\wwwroot\Servosms\Sysitem\ServosmsPrintServices\ReportView\Prod_Promo_Dis_Claim_Report.txt";
            StreamWriter sw   = new StreamWriter(path);
            string       sql  = "";
            string       info = "";

            //05.06.09 sql="select sp.supp_name,pm.vndr_invoice_no,pm.vndr_invoice_date,p.prod_name+':'+p.pack_type,pd.qty from supplier sp,purchase_master pm,purchase_details pd,products p where pm.invoice_no=pd.invoice_no and sp.supp_id=pm.vendor_id and p.prod_id=pd.prod_id  and pm.vndr_invoice_date>='"+GenUtil.str2MMDDYYYY(txtDateFrom.Text)+"' and pm.vndr_invoice_date<='"+GenUtil.str2MMDDYYYY(txtDateTo.Text)+"' and pd.prod_id in (select prodid from Prod_Promo_Grade_Entry where datefrom>='"+GenUtil.str2MMDDYYYY(txtDateFrom.Text)+"' and dateto<='"+GenUtil.str2MMDDYYYY(txtDateTo.Text)+"') order by p.prod_name,p.pack_type";
            if (DropSchemName.SelectedIndex == 0)
            {
                sql = "select sp.supp_name,pm.vndr_invoice_no,pm.vndr_invoice_date,p.prod_name+':'+p.pack_type,pd.qty from supplier sp,purchase_master pm,purchase_details pd,products p where pm.invoice_no=pd.invoice_no and sp.supp_id=pm.vendor_id and p.prod_id=pd.prod_id  and pm.vndr_invoice_date>='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateFrom"]) + "' and pm.vndr_invoice_date<='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateTo"]) + "' and pd.prod_id in (select prodid from Prod_Promo_Grade_Entry where datefrom>='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateFrom"]) + "' and dateto<='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateTo"]) + "') order by p.prod_name,p.pack_type";
            }
            else
            {
                sql = "select sp.supp_name,pm.vndr_invoice_no,pm.vndr_invoice_date,p.prod_name+':'+p.pack_type,pd.qty from supplier sp,purchase_master pm,purchase_details pd,products p where pm.invoice_no=pd.invoice_no and sp.supp_id=pm.vendor_id and p.prod_id=pd.prod_id  and pm.vndr_invoice_date>='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateFrom"]) + "' and pm.vndr_invoice_date<='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateTo"]) + "' and pd.prod_id in (select prodid from Prod_Promo_Grade_Entry where schname='" + DropSchemName.SelectedItem.Value.ToString() + "' and datefrom>='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateFrom"]) + "' and dateto<='" + GenUtil.str2MMDDYYYY(Request.Form["txtDateTo"]) + "') order by p.prod_name,p.pack_type";
            }

            rdr = obj.GetRecordSet(sql);
            // Condensed
            sw.Write((char)27);           //added by vishnu
            sw.Write((char)67);           //added by vishnu
            sw.Write((char)0);            //added by vishnu
            sw.Write((char)12);           //added by vishnu

            sw.Write((char)27);           //added by vishnu
            sw.Write((char)78);           //added by vishnu
            sw.Write((char)5);            //added by vishnu

            sw.Write((char)27);           //added by vishnu
            sw.Write((char)15);
            //**********
            string des = "--------------------------------------------------------------------------------------------------------------";

            sw.WriteLine(des);
            //******S***
            sw.WriteLine(GenUtil.GetCenterAddr("=============================================", des.Length));
            sw.WriteLine(GenUtil.GetCenterAddr("Product Promotion Scheme Discount Claim Report From " + txtDateFrom.Text + " To " + txtDateTo.Text, des.Length));
            sw.WriteLine(GenUtil.GetCenterAddr("=============================================", des.Length));
            //sw.WriteLine("From Date : "+txtDateFrom.Text+", To Date : "+txtDateTo.Text);
            sw.WriteLine("+--------------------+------------+--------------+------------------------------+------------+------------+");
            sw.WriteLine("|     Vendor Name    |Invoice No. | Invoice Date |      Product Name            | Qty in Nos.| Qty in ltr.|");
            sw.WriteLine("+--------------------+------------+--------------+------------------------------+------------+------------+");
            //             12345678901234567890 123456789012 12345678901234 123456789012345678901234567890 123456789012 123456789012
            info = " {0,-20:S} {1,12:F} {2,14:S} {3,-30:S} {4,12:S} {5,12:S} ";
            string info1 = " {0,-20:S} {1,12:F} {2,14:S} {3,-30:S} {4,12:S} {5,12:S} ";

            while (rdr.Read())
            {
                sw.WriteLine(info,
                             rdr.GetValue(0).ToString(),
                             rdr.GetValue(1).ToString(),
                             GenUtil.str2DDMMYYYY(GenUtil.trimDate(rdr.GetValue(2).ToString())),
                             rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(),
                             Qtyinltr(rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString()));
                Qty_Tot += Convert.ToDouble(rdr.GetValue(4).ToString());
            }
            rdr.Close();
            sw.WriteLine("+--------------------+------------+--------------+------------------------------+------------+------------+");
            sw.WriteLine(info1, "Total", "", "", "", Qty_Tot.ToString(), Qty_Tot_ltr.ToString());
            sw.WriteLine("+--------------------+------------+--------------+------------------------------+------------+------------+");
            sw.Close();
        }
		/// <summary>
		/// This method is used to make the report for printing.
		/// </summary>
		public void makingReport()
		{
			
			System.Data.SqlClient.SqlDataReader rdr=null;
			string home_drive = Environment.SystemDirectory;
			home_drive = home_drive.Substring(0,2); 
			string path = home_drive+@"\Inetpub\wwwroot\Servosms\Sysitem\ServosmsPrintServices\ReportView\MarketPotentialReport.txt";
			StreamWriter sw = new StreamWriter(path);

			string sql="";
			string info = "";
			//string strDate = "";

			sql="select firmname m1,place m2,contactper m3,teleno m4,type m5,regcustomer m6,potential m7,servo m8,castrol m9,shell m10,bpcl m11,veedol m12,elf m13,hpcl m14,pennzoil m15,spurious m16 from marketcustomerentry1";
			sql=sql+" order by "+""+Cache["strorderby"]+"";
			dbobj.SelectQuery(sql,ref rdr);
			// Condensed
			sw.Write((char)27);//added by vishnu
			sw.Write((char)67);//added by vishnu
			sw.Write((char)0);//added by vishnu
			sw.Write((char)12);//added by vishnu
			
			sw.Write((char)27);//added by vishnu
			sw.Write((char)78);//added by vishnu
			sw.Write((char)5);//added by vishnu
							
			sw.Write((char)27);//added by vishnu
			sw.Write((char)15);
			//**********
			string des="-----------------------------------------------------------------------------------------------------------------------------------------";
			string Address=GenUtil.GetAddress();
			string[] addr=Address.Split(new char[] {':'},Address.Length);
			sw.WriteLine(GenUtil.GetCenterAddr(addr[0],des.Length).ToUpper());
			sw.WriteLine(GenUtil.GetCenterAddr(addr[1]+addr[2],des.Length));
			sw.WriteLine(GenUtil.GetCenterAddr("Tin No : "+addr[3],des.Length));
			sw.WriteLine(des);
			//**********
			sw.WriteLine(GenUtil.GetCenterAddr("=========================",des.Length));
			sw.WriteLine(GenUtil.GetCenterAddr("Market Potential REPORT",des.Length));
			sw.WriteLine(GenUtil.GetCenterAddr("=========================",des.Length));
			sw.WriteLine("Note --> Reg :- Reguler Customer, Potl :- Potential, pnzoil :- Pennzoil, Spurs :- Spurious");
			//sw.WriteLine("+---------------+---------------+---------------+-----------+-------------+-------+---------+-----+-------+-----+-----+------+-----+-----+--------+--------+");
			//			sw.WriteLine("|   Firm Name   |     Place     |Contact Person |  Tele No  |     Type    |Regular|Potential|Servo|Castrol|Shell|BPCL |Veedol| ELF |HPCL |Pennzoil|Spurious");
			//			sw.WriteLine("+---------------+---------------+---------------+-----------+-------------+-------+---------+-----+-------+-----+-----+------+-----+-----+--------+--------+");
			
			sw.WriteLine("+---------------+---------------+---------------+----------+-------------+---+----+-----+-------+-----+----+------+---+----+------+-----+");
			sw.WriteLine("|   Firm Name   |     Place     |Contact Person |  Tele No |     Type    |Reg|Potl|Servo|Castrol|Shell|BPCL|Veedol|ELF|HPCL|Pnzoil|Spurs");
			sw.WriteLine("+---------------+---------------+---------------+----------+-------------+---+----+-----+-------+-----+----+------+---+----+------+-----+");
        
			if(rdr.HasRows)
			{
				// info : to set the format the displaying string.
				info = " {0,-15:S} {1,-15:S} {2,-15:S} {3,10:S} {4,-13:S} {5,-3:S} {6,4:S} {7,5:S} {8,7:S} {9,5:S} {10,4:S} {11,6:S} {12,3:S} {13,4:S} {14,6:S} {15,5:S}"; 
				while(rdr.Read())
				{
										                                         
					/*sw.WriteLine(info,rdr["Prod_ID"].ToString().Trim(),
						rdr["Prod_Name"].ToString().Trim(),
						rdr["Pack_Type"].ToString(),
						GenUtil.strNumericFormat(rdr["Pur_Rate"].ToString().Trim()),
						GenUtil.strNumericFormat(rdr["sal_Rate"].ToString().Trim()),
						GenUtil.str2DDMMYYYY(strDate));*/
					sw.WriteLine(info,GenUtil.TrimLength(rdr["m1"].ToString(),15),
						GenUtil.TrimLength(rdr["m2"].ToString(),15),
						GenUtil.TrimLength(rdr["m3"].ToString(),15),
						rdr["m4"].ToString(),
						GenUtil.TrimLength(rdr["m5"].ToString(),13),
						rdr["m6"].ToString(),
						rdr["m7"].ToString(),
						rdr["m8"].ToString(),
						rdr["m9"].ToString(),
						rdr["m10"].ToString(),
						rdr["m11"].ToString(),
						rdr["m12"].ToString(),
						rdr["m13"].ToString(),
						rdr["m14"].ToString(),
						rdr["m15"].ToString(),
						rdr["m16"].ToString());
				}
			}
			//sw.WriteLine("+---------------+---------------+---------------+-----------+-------------+-------+---------+-----+-------+-----+-----+------+-----+-----+--------+--------+");
			sw.WriteLine("+---------------+---------------+---------------+----------+-------------+---+----+-----+-------+-----+----+------+---+----+------+-----+");
			dbobj.Dispose();
			sw.Close();
		}
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnsave_Click(object sender, EventArgs e)
        {
            string        index;
            string        md_request;
            string        time_request;
            string        place;
            string        lab_ID;
            string        tracknum;
            string        pici;
            string        pjEng    = this.GetPorjEngName(tsa_id.Text);
            List <string> list_sql = new List <string>();

            fields = outsource_no.Value.Split('.');
            string[] cols = fields[1].ToString().Split('/');
            if (cols[0].ToString().Length > 6)     //变更
            {
                tablename    = "TBPM_OUTSCHANGE";
                auditlist    = "TBPM_OUTSCHANGERVW";
                pici         = "WXBG" + cols[2].ToString().PadLeft(2, '0');
                code         = "OST_CHANGECODE";
                viewouttable = "View_TM_OUTSCHANGE";
            }
            else
            {
                tablename    = "TBPM_OUTSOURCELIST";
                auditlist    = "TBPM_OUTSOURCETOTAL";
                pici         = "WX" + cols[2].ToString().PadLeft(2, '0');
                code         = "OST_OUTSOURCENO";
                viewouttable = "View_TM_OUTSOURCELIST";
            }



            string sql_check_num = "select * from " + viewouttable + " where OSL_OUTSOURCENO='" + outsource_no.Value + "' AND  (case when  LOWER(OSL_PURCUNIT)='吨' or  LOWER(OSL_PURCUNIT)='t' or  LOWER(OSL_PURCUNIT)='kg' or  LOWER(OSL_PURCUNIT)='千克' or  LOWER(OSL_PURCUNIT)='公斤' THEN OSL_TOTALWGHTL ELSE OSL_NUMBER END)=0";

            System.Data.SqlClient.SqlDataReader dr_sql_check_num = DBCallCommon.GetDRUsingSqlText(sql_check_num);

            if (dr_sql_check_num.HasRows)
            {
                dr_sql_check_num.Close();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('无法保存!\\r\\r存在数量或重量为零的项,无法采购!!!\\r\\r请选择【不可提交计划项】,取消后修改计划!!!');", true);
                return;
            }
            dr_sql_check_num.Close();

            if (GridView1.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('无法保存!\\r\\r没有数据!!!');", true);
                return;
            }

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridViewRow gr = GridView1.Rows[i];
                index        = ((Label)gr.FindControl("Index")).Text.Trim().PadLeft(4, '0');
                tracknum     = pjEng + '_' + tsa_id.Text + '_' + outsource_no.Value.Split('.')[1].Split('_')[1] + '_' + index; //计划跟踪号
                lab_ID       = ((Label)gr.FindControl("lab_ID")).Text;
                md_request   = ((HtmlInputText)gr.FindControl("txt_request")).Value;
                time_request = ((HtmlInputText)gr.FindControl("txt_time")).Value;
                place        = ((HtmlInputText)gr.FindControl("txt_place")).Value;

                sqlText  = "update " + tablename + " set OSL_REQUEST='" + md_request + "',";
                sqlText += "OSL_REQDATE='" + time_request + "',OSL_DELSITE='" + place + "',";
                sqlText += "OSL_TRACKNUM='" + tracknum + "' where OSL_ID='" + lab_ID + "'";
                list_sql.Add(sqlText);
            }

            if (status.Value == "0" || status.Value == "1" || status.Value == "3" || status.Value == "5" || status.Value == "7")
            {
                sqlText  = "update " + auditlist + " set OST_STATE='1',OST_CHECKLEVEL='3',";
                sqlText += "OST_MDATE='',OST_REVIEWERA='',";
                sqlText += "OST_REVIEWAADVC='',OST_REVIEWADATE='',OST_REVIEWERB='',";
                sqlText += "OST_REVIEWBADVC='',OST_REVIEWBDATE='',";
                sqlText += "OST_REVIEWERC='',OST_REVIEWCADVC='',";
                sqlText += "OST_REVIEWCDATE='',OST_ADATE='' ";
                sqlText += "where " + code + "='" + outsource_no.Value + "' and OST_STATE='" + status.Value + "'";
                list_sql.Add(sqlText);
            }

            DBCallCommon.ExecuteTrans(list_sql);
            if (status.Value == "0" || status.Value == "1" || status.Value == "3" || status.Value == "5" || status.Value == "7")
            {
                btnCheck.Visible = true;
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "<script language=javascript>if(confirm('提示:保存成功!\\r\\r是否进入审核界面?'))document.getElementById('" + btn_gosh.ClientID + "').click();</script>");
        }
Example #49
0
    protected void CreateUserClick(object sender, EventArgs e)
    {
        zipcode.Attributes.CssStyle.Remove("background-color");
        email.Attributes.CssStyle.Remove("background-color");
        password.Attributes.CssStyle.Remove("background-color");
        password2.Attributes.CssStyle.Remove("background-color");

        int zip;

        Label1.Text = "";
        Label2.Text = "";
        String connectionString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;

        System.Data.SqlClient.SqlConnection sql = new System.Data.SqlClient.SqlConnection(connectionString);

        sql.Open();
        System.Data.SqlClient.SqlCommand query = new System.Data.SqlClient.SqlCommand();
        query.Connection = sql;
        if (int.TryParse(zipcode.Value, out zip))
        {
            if (email.Value.Contains("@"))
            {
                if (password.Value.Equals(password2.Value))
                {
                    if (password.Value.Length >= 8)
                    {
                        //get our ID for future use (inserting into tables that use this key but not have it auto increment 1 person, password)
                        query.CommandText = "SELECT max(UserEntityID) FROM dbo.UserEntity";

                        System.Data.SqlClient.SqlDataReader reader = query.ExecuteReader();

                        int userID = 0;

                        while (reader.Read())
                        {
                            userID = reader.GetInt32(0);
                            //increment by one because this is our new BEID after we insert
                            userID++;
                        }
                        sql.Close();

                        sql.Open();
                        System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();

                        insert.Connection = sql;

                        //inserting into the BE table


                        //insert into the person table
                        insert.CommandText = "insert into dbo.userentity (UserName, EmailAddress, EntityType) " +
                                             "values (@username, @emailaddress, @entitytype)";
                        username.Value.Trim();
                        email.Value.Trim();
                        firstName.Value.Trim();
                        middleName.Value.Trim();
                        lastName.Value.Trim();

                        //Create user entity
                        UserEntity     user     = new UserEntity(username.Value.Trim(), email.Value.Trim(), role.SelectedItem.Value);
                        SchoolEmployee employee = new SchoolEmployee(firstName.Value.Trim(), lastName.Value.Trim(), middleName.Value.Trim(),
                                                                     address.Value.Trim(), "USA", city.Value.Trim(), "VA", zipcode.Value, user.getEntityType(),
                                                                     Convert.ToInt32(DropDownList2.SelectedItem.Value));


                        insert.Parameters.AddWithValue("@username", HttpUtility.HtmlEncode(user.getUserName()));
                        insert.Parameters.AddWithValue("@emailaddress", HttpUtility.HtmlEncode(user.getEmailAddress()));
                        insert.Parameters.AddWithValue("@entitytype", HttpUtility.HtmlEncode("SCHL"));



                        insert.ExecuteNonQuery();


                        //inserting into the password
                        insert.CommandText = "insert into dbo.Password (PasswordID, PasswordHash, passwordSalt, UserEntityID, lastupdated)  " +
                                             "values (@passwordID, @passwordHash, @passwordSalt, @userentityID, getDate())";



                        String hashedPass = PasswordHash.HashPassword(password.Value);
                        insert.Parameters.AddWithValue("@passwordID", userID);
                        insert.Parameters.AddWithValue("@passwordHash", hashedPass);

                        string test = PasswordHash.returnSalt(hashedPass);

                        //had to use only the substring and not the full salt value because there is a max length of 10 in the DB.
                        insert.Parameters.AddWithValue("@passwordSalt", test.Substring(0, 24));
                        insert.Parameters.AddWithValue("@userentityID", userID);
                        insert.ExecuteNonQuery();

                        insert.CommandText = "insert into dbo.schoolemployee (SchoolEmployeeEntityID, FirstName, LastName, MiddleName, StreetAddress, Country, City, State, Zipcode, SchoolEmployeeEntityType, SchoolEntityID) " +
                                             "values (@SchoolEmployeeEntityID, @FirstName, @LastName, @MiddleName, @StreetAddress, @Country, @City, @State, @Zipcode, @SchoolEmployeeEntityType, @SchoolEntityID)";


                        insert.Parameters.AddWithValue("@SchoolEmployeeEntityID", HttpUtility.HtmlEncode(userID));
                        insert.Parameters.AddWithValue("@FirstName", HttpUtility.HtmlEncode(employee.getFirstName()));
                        insert.Parameters.AddWithValue("@LastName", HttpUtility.HtmlEncode(employee.getLastName()));
                        insert.Parameters.AddWithValue("@MiddleName", HttpUtility.HtmlEncode(employee.getMiddleName()));
                        insert.Parameters.AddWithValue("@StreetAddress", HttpUtility.HtmlEncode(employee.getStreetAddress()));
                        insert.Parameters.AddWithValue("@Country", HttpUtility.HtmlEncode(employee.getCountry()));
                        insert.Parameters.AddWithValue("@City", HttpUtility.HtmlEncode(employee.getCity()));
                        insert.Parameters.AddWithValue("@State", HttpUtility.HtmlEncode("VA"));

                        if (int.TryParse(zipcode.Value, out zip))
                        {
                            insert.Parameters.AddWithValue("@Zipcode", HttpUtility.HtmlEncode(employee.getZipCode()));
                        }
                        else
                        {
                            insert.Parameters.AddWithValue("@Zipcode", 00000);
                            Label1.Text = "Enter a number for the zipcode";
                        }



                        insert.Parameters.AddWithValue("@SchoolEmployeeEntityType", employee.getSchoolEmployeeEntityType());
                        insert.Parameters.AddWithValue("@SchoolEntityID", employee.getSchoolEntityID());
                        insert.ExecuteNonQuery();


                        //empmty these fields out.
                        firstName.Value  = "";
                        lastName.Value   = "";
                        middleName.Value = "";
                        city.Value       = "";
                        zipcode.Value    = "";


                        address.Value               = "";
                        username.Value              = "";
                        password.Value              = "";
                        email.Value                 = "";
                        role.SelectedIndex          = 0;
                        DropDownList2.SelectedIndex = 0;
                        Label1.Text                 = "Account Created!";
                    }
                    else
                    {
                        Label2.Text = "The Password Must Be More Than 8 Characters";
                        password.Attributes.CssStyle.Add("background-color", "crimson");
                        password2.Attributes.CssStyle.Add("background-color", "crimson");
                    }
                }
                else
                {
                    Label2.Text = "Passwords do not match";
                    password.Attributes.CssStyle.Add("background-color", "crimson");
                    password2.Attributes.CssStyle.Add("background-color", "crimson");
                }
            }

            else
            {
                Label2.Text = "Please Enter a Valid Email";
                email.Value = "";
                email.Attributes.CssStyle.Add("background-color", "crimson");
            }
        }
        else
        {
            Label2.Text   = "Please Enter a Valid Zipcode";
            zipcode.Value = "";
            zipcode.Attributes.CssStyle.Add("background-color", "crimson");
        }
    }
    private void dadosCorpo()
    {
        string datastatus   = DateTime.Now.ToString("yyyy-MM-dd");
        string stringselect = "select ID_Entrega, LocalOrigem,LocalDestino, " +
                              "Tipo_Atendimento, Valor_Total, Forma_Pagam , Status_Pagam, Status_OS " +
                              "from Tbl_Entregas_Master " +
                              "where ID_Cliente = " + param + " " +
                              "and historico=0 ";

        OperacaoBanco operacao = new OperacaoBanco();

        System.Data.SqlClient.SqlDataReader dados = operacao.Select(stringselect);

        while (dados.Read())
        {
            string Coluna0 = Convert.ToString(dados[0]); //id entrega

            string Coluna1 = Convert.ToString(dados[1]).Substring(0, Convert.ToString(dados[1]).IndexOf(","));
            string Coluna2 = Convert.ToString(dados[2]).Substring(0, Convert.ToString(dados[2]).IndexOf(","));
            string Coluna3 = Convert.ToString(dados[3]);
            string Coluna4 = Convert.ToString(dados[4]);
            string Coluna5 = Convert.ToString(dados[5]);
            string Coluna7 = Convert.ToString(dados[6]);    //Status pagamento
            string Coluna8 = Convert.ToString(dados[7]);    //Status OS

            string codePagam = "", classPag = "", iconPag = "";
            string codeDelete = "", classDelete = "", iconDelete = "";

            if (Coluna7 == "Em Aberto")
            {
                if (Coluna5 == "Cartão")
                {
                    codePagam = "iniciapag(" + Coluna0 + " , " + Coluna4.Replace(",", ".") + ");";
                    classPag  = "w3-btn w3-round w3-hover-green w3-padding";
                    iconPag   = "<i class='fa fa-usd' aria-hidden='true'></i>";
                }
                else
                {
                    codePagam = "";
                    classPag  = "";
                }

                codeDelete  = "excluirEntrega(" + Coluna0 + ");";
                classDelete = "w3-btn w3-round w3-hover-red w3-padding";
                iconDelete  = "<i class='fa fa-trash-o' aria-hidden='true'></i>";
            }
            else if (Coluna7 == "Faturado")
            {
                codePagam = "Em Aberto";
                classPag  = "";

                if (Coluna8 == "Em Aberto")
                {
                    codeDelete  = "excluirEntrega(" + Coluna0 + ");";
                    classDelete = "w3-btn w3-round w3-hover-red w3-padding";
                    iconDelete  = "<i class='fa fa-trash-o' aria-hidden='true'></i>";
                }
                else
                {
                    codeDelete  = "";
                    classDelete = "";
                }
            }
            else
            {
                codePagam = "";
                classPag  = "";

                if (Coluna8 == "Em Aberto")
                {
                    codeDelete  = "excluirEntrega(" + Coluna0 + ");";
                    classDelete = "w3-btn w3-round w3-hover-red w3-padding";
                    iconDelete  = "<i class='fa fa-trash-o' aria-hidden='true'></i>";
                }
                else
                {
                    codeDelete  = "";
                    classDelete = "";
                }
            }


            String btarquivar = "";
            string TipoFicha  = "0";
            if (Coluna8 == "Concluída")
            {
                btarquivar = "<a class='w3-btn w3-round w3-hover-green w3-padding' " +
                             "onclick='ArquivarEntrega(" + Coluna0 + ")'>" +
                             "<i class='fa fa-check-circle-o' aria-hidden='true'></i></a>";
                TipoFicha = "1";
            }

            string bt1 = "<a class='" + classPag + "' onclick='" + codePagam + "'>" + iconPag + "</a>";
            string bt2 = "<a class='" + classDelete + "' onclick='" + codeDelete + "'>" + iconDelete + "</a>";
            string bt3 = "<a class='w3-btn w3-round w3-hover-blue' href='EntregaFicha.aspx?v1=" + Coluna0 + "&v2=" + TipoFicha + "'><i class='fa fa-info-circle' aria-hidden='true'></i></a>";

            string stringcomaspas = "******" +
                                    "<td>" + Coluna1 + "</td>" +
                                    "<td>" + Coluna2 + "</td>" +
                                    "<td>" + Coluna3 + "</td>" +
                                    "<td>" + "R$" + Coluna4 + "</td>" +
                                    "<td>" + Coluna5 + "</td>" +
                                    "<td>" + Coluna7 + "</td>" +
                                    "<td>" + Coluna8 + "</td>" +
                                    "<td>" + bt3 + bt1 + bt2 + btarquivar + "</td>" +
                                    "</tr>";

            str.Append(stringcomaspas);
        }
        ConexaoBancoSQL.fecharConexao();
    }
Example #51
0
    //click approve in gridview- trigger modal to open - fill modal
    protected void approveJobLinkBtn_Click(object sender, CommandEventArgs e)
    {
        String connectionString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;

        System.Data.SqlClient.SqlConnection sql = new System.Data.SqlClient.SqlConnection(connectionString);

        int         rowIndex = Convert.ToInt32(((sender as LinkButton).NamingContainer as GridViewRow).RowIndex);
        GridViewRow row      = GridView1.Rows[rowIndex];

        int jobID = Convert.ToInt32(e.CommandArgument);

        Session["selectedLogID"] = jobID.ToString();

        sql.Open();
        System.Data.SqlClient.SqlCommand moreHourInfo = new System.Data.SqlClient.SqlCommand();
        moreHourInfo.Connection  = sql;
        moreHourInfo.CommandText = "SELECT JobListing.JobTitle, LogHours.HoursRequested, CONCAT(Student.FirstName,' ', Student.LastName) FROM LogHours INNER JOIN Student ON LogHours.StudentEntityID = Student.StudentEntityID INNER JOIN JobListing ON LogHours.JobListingID = JobListing.JobListingID WHERE LogHours.LogID = " + Session["selectedLogID"];
        System.Data.SqlClient.SqlDataReader reader = moreHourInfo.ExecuteReader();

        while (reader.Read())
        {
            sublabelapprovemodal1.Text = reader.GetString(2);
            sublabelapprovemodal2.Text = reader.GetString(0);
            sublabelapprovemodal3.Text = "Hours: " + reader.GetInt32(1).ToString();
        }

        sql.Close();



        ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openApproveXModal();", true);



        if (chkImage.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Image")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Image")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }

        if (chkGradeLevel.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Grade Level")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Grade Level")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }


        if (chkGPA.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "GPA")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "GPA")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }


        if (chkHoursWBL.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Hours of WBL")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Hours of WBL")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }


        if (chkJobType.Checked != true)
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Job Type")
                {
                    GridView1.Columns[i].Visible = false;
                }
            }
        }
        else
        {
            for (int i = 0; i < GridView1.Columns.Count; i++)
            {
                if (GridView1.Columns[i].HeaderText == "Job Type")
                {
                    GridView1.Columns[i].Visible = true;
                }
            }
        }
    }
 public Suppliers(System.Data.SqlClient.SqlDataReader reader)
 {
     this.AddItemsToListBySqlDataReader(reader);
 }
Example #53
0
 public CustomerCustomerDemo(System.Data.SqlClient.SqlDataReader reader)
 {
     this.AddItemsToListBySqlDataReader(reader);
 }
Example #54
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(clsRPlus.sCN_SALES))
        {
            try
            {
                if (e.CommandName.Equals("New"))
                {
                    LinkButton  btnNew = e.CommandSource as LinkButton;
                    GridViewRow row    = btnNew.NamingContainer as GridViewRow;
                    //System.Data.SqlClient.SqlDataReader reader = null;
                    System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
                    if (row == null)
                    {
                        return;
                    }
                    TextBox      txtforecastYear     = GridView1.FooterRow.FindControl("forecastYearTextBoxNew") as TextBox;
                    DropDownList txtforecastCategory = GridView1.FooterRow.FindControl("forecastCategoryTextBoxEmpty") as DropDownList;
                    TextBox      txtJan = GridView1.FooterRow.FindControl("JanTextBoxNew") as TextBox;
                    TextBox      txtFeb = GridView1.FooterRow.FindControl("FebTextBoxNew") as TextBox;
                    TextBox      txtMar = GridView1.FooterRow.FindControl("MarTextBoxNew") as TextBox;
                    TextBox      txtApr = GridView1.FooterRow.FindControl("AprTextBoxNew") as TextBox;
                    TextBox      txtMay = GridView1.FooterRow.FindControl("MayTextBoxNew") as TextBox;
                    TextBox      txtJun = GridView1.FooterRow.FindControl("JunTextBoxNew") as TextBox;
                    TextBox      txtJul = GridView1.FooterRow.FindControl("JulTextBoxNew") as TextBox;
                    TextBox      txtAug = GridView1.FooterRow.FindControl("AugTextBoxNew") as TextBox;
                    TextBox      txtSep = GridView1.FooterRow.FindControl("SepTextBoxNew") as TextBox;
                    TextBox      txtOct = GridView1.FooterRow.FindControl("OctTextBoxNew") as TextBox;
                    TextBox      txtNov = GridView1.FooterRow.FindControl("NovTextBoxNew") as TextBox;
                    TextBox      txtDec = GridView1.FooterRow.FindControl("DecTextBoxNew") as TextBox;
                    String       query  = "INSERT INTO [SkupForecasts] ( [forecastYear], [forecastCategory], [Jan], [Feb],[Mar],[Apr],[May],[Jun],[Jul],[Aug],[Sep],[Oct],[Nov],[Dec]) VALUES (@forecastYear, @forecastCategory, @Jan, @Feb, @Mar, @Apr, @May, @Jun, @Jul, @Aug, @Sep, @Oct, @Nov, @Dec)";

                    cmd.CommandText = query;
                    cmd.CommandType = System.Data.CommandType.Text;
                    cmd.Connection  = conn;

                    cmd.Parameters.AddWithValue("forecastYear", txtforecastYear.Text);
                    cmd.Parameters.AddWithValue("forecastCategory", txtforecastCategory.Text);
                    cmd.Parameters.AddWithValue("Jan", txtJan.Text);
                    cmd.Parameters.AddWithValue("Feb", txtFeb.Text);
                    cmd.Parameters.AddWithValue("Mar", txtMar.Text);
                    cmd.Parameters.AddWithValue("Apr", txtApr.Text);
                    cmd.Parameters.AddWithValue("May", txtMay.Text);
                    cmd.Parameters.AddWithValue("Jun", txtJun.Text);
                    cmd.Parameters.AddWithValue("Jul", txtJul.Text);
                    cmd.Parameters.AddWithValue("Aug", txtAug.Text);
                    cmd.Parameters.AddWithValue("Sep", txtSep.Text);
                    cmd.Parameters.AddWithValue("Oct", txtOct.Text);
                    cmd.Parameters.AddWithValue("Nov", txtNov.Text);
                    cmd.Parameters.AddWithValue("Dec", txtDec.Text);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    cmd.Cancel();
                    cmd.Dispose();
                    conn.Close();
                    Response.AppendHeader("Refresh", "0,URL=");
                }
                if (e.CommandName.Equals("EmptyNew"))
                {
                    LinkButton  btnNew = e.CommandSource as LinkButton;
                    GridViewRow row    = btnNew.NamingContainer as GridViewRow;
                    System.Data.SqlClient.SqlDataReader reader = null;
                    System.Data.SqlClient.SqlCommand    cmd    = new System.Data.SqlClient.SqlCommand();
                    if (row == null)
                    {
                        return;
                    }
                    TextBox      txtforecastYear     = GridView1.Controls[0].Controls[0].FindControl("forecastYearTextBoxEmpty") as TextBox;
                    DropDownList txtforecastCategory = GridView1.Controls[0].Controls[0].FindControl("forecastCategoryTextBoxEmpty") as DropDownList;
                    TextBox      txtJan = GridView1.Controls[0].Controls[0].FindControl("JanTextBoxEmpty") as TextBox;
                    TextBox      txtFeb = GridView1.Controls[0].Controls[0].FindControl("FebTextBoxEmpty") as TextBox;
                    TextBox      txtMar = GridView1.Controls[0].Controls[0].FindControl("MarTextBoxEmpty") as TextBox;
                    TextBox      txtApr = GridView1.Controls[0].Controls[0].FindControl("AprTextBoxEmpty") as TextBox;
                    TextBox      txtMay = GridView1.Controls[0].Controls[0].FindControl("MayTextBoxEmpty") as TextBox;
                    TextBox      txtJun = GridView1.Controls[0].Controls[0].FindControl("JunTextBoxEmpty") as TextBox;
                    TextBox      txtJul = GridView1.Controls[0].Controls[0].FindControl("JulTextBoxEmpty") as TextBox;
                    TextBox      txtAug = GridView1.Controls[0].Controls[0].FindControl("AugTextBoxEmpty") as TextBox;
                    TextBox      txtSep = GridView1.Controls[0].Controls[0].FindControl("SepTextBoxEmpty") as TextBox;
                    TextBox      txtOct = GridView1.Controls[0].Controls[0].FindControl("OctTextBoxEmpty") as TextBox;
                    TextBox      txtNov = GridView1.Controls[0].Controls[0].FindControl("NovTextBoxEmpty") as TextBox;
                    TextBox      txtDec = GridView1.Controls[0].Controls[0].FindControl("DecTextBoxEmpty") as TextBox;
                    String       query  = "INSERT INTO [SkupForecasts] ( [forecastYear], [forecastCategory], [Jan], [Feb],[Mar],[Apr],[May],[Jun],[Jul],[Aug],[Sep],[Oct],[Nov],[Dec]) VALUES (@forecastYear, @forecastCategory, @Jan, @Feb, @Mar, @Apr, @May, @Jun, @Jul, @Aug, @Sep, @Oct, @Nov, @Dec)";

                    cmd.CommandText = query;
                    cmd.CommandType = System.Data.CommandType.Text;
                    cmd.Connection  = conn;

                    cmd.Parameters.AddWithValue("forecastYear", txtforecastYear.Text);
                    cmd.Parameters.AddWithValue("forecastCategory", txtforecastCategory.Text);
                    cmd.Parameters.AddWithValue("Jan", txtJan.Text);
                    cmd.Parameters.AddWithValue("Feb", txtFeb.Text);
                    cmd.Parameters.AddWithValue("Mar", txtMar.Text);
                    cmd.Parameters.AddWithValue("Apr", txtApr.Text);
                    cmd.Parameters.AddWithValue("May", txtMay.Text);
                    cmd.Parameters.AddWithValue("Jun", txtJun.Text);
                    cmd.Parameters.AddWithValue("Jul", txtJul.Text);
                    cmd.Parameters.AddWithValue("Aug", txtAug.Text);
                    cmd.Parameters.AddWithValue("Sep", txtSep.Text);
                    cmd.Parameters.AddWithValue("Oct", txtOct.Text);
                    cmd.Parameters.AddWithValue("Nov", txtNov.Text);
                    cmd.Parameters.AddWithValue("Dec", txtDec.Text);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    cmd.Cancel();
                    cmd.Dispose();
                    conn.Close();
                    Response.AppendHeader("Refresh", "0,URL=");
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                conn.Close();
            }
        }
    }
        /// <summary>
        /// Sets the members of the class instance with data from the data layer framework.
        /// </summary>
        internal override void SetMembers(ref System.Data.SqlClient.SqlDataReader data)
        {
            // make sure to always call up to the base
            base.SetMembers(ref data);


            // assigns the LoanApplicationId data to the class member
            _loanapplicationid          = Convert.ToInt64(data["LoanApplicationId"]);
            _loanapplicationid_assigned = true;
            // assigns the FNMCommunityLendingProductName data to the class member
            if (data["FNMCommunityLendingProductName"] == System.DBNull.Value)
            {
                SetFNMCommunityLendingProductNameNull();
            }
            else
            {
                _fnmcommunitylendingproductname = Convert.ToString(data["FNMCommunityLendingProductName"]);
            }
            // assigns the FNMCommunityLendingProductTypeOtherDescription data to the class member
            if (data["FNMCommunityLendingProductTypeOtherDescription"] == System.DBNull.Value)
            {
                SetFNMCommunityLendingProductTypeOtherDescriptionNull();
            }
            else
            {
                _fnmcommunitylendingproducttypeotherdescription = Convert.ToString(data["FNMCommunityLendingProductTypeOtherDescription"]);
            }
            // assigns the FNMCommunitySecondsIndicator data to the class member
            _fnmcommunitysecondsindicator          = Convert.ToBoolean(data["FNMCommunitySecondsIndicator"]);
            _fnmcommunitysecondsindicator_assigned = true;
            // assigns the FNMNeighborsMortgageEligibilityIndicator data to the class member
            _fnmneighborsmortgageeligibilityindicator          = Convert.ToBoolean(data["FNMNeighborsMortgageEligibilityIndicator"]);
            _fnmneighborsmortgageeligibilityindicator_assigned = true;
            // assigns the FREAffordableProgramIdentifier data to the class member
            if (data["FREAffordableProgramIdentifier"] == System.DBNull.Value)
            {
                SetFREAffordableProgramIdentifierNull();
            }
            else
            {
                _freaffordableprogramidentifier = Convert.ToString(data["FREAffordableProgramIdentifier"]);
            }
            // assigns the HUDIncomeLimitAdjustmentFactor data to the class member
            if (data["HUDIncomeLimitAdjustmentFactor"] == System.DBNull.Value)
            {
                SetHUDIncomeLimitAdjustmentFactorNull();
            }
            else
            {
                _hudincomelimitadjustmentfactor        = Convert.ToDecimal(data["HUDIncomeLimitAdjustmentFactor"]);
                _hudincomelimitadjustmentfactor_isnull = false;
            }
            // assigns the HUDLendingIncomeLimitAmount data to the class member
            if (data["HUDLendingIncomeLimitAmount"] == System.DBNull.Value)
            {
                SetHUDLendingIncomeLimitAmountNull();
            }
            else
            {
                _hudlendingincomelimitamount        = Convert.ToDecimal(data["HUDLendingIncomeLimitAmount"]);
                _hudlendingincomelimitamount_isnull = false;
            }
            // assigns the HUDMedianIncomeAmount data to the class member
            if (data["HUDMedianIncomeAmount"] == System.DBNull.Value)
            {
                SetHUDMedianIncomeAmountNull();
            }
            else
            {
                _hudmedianincomeamount        = Convert.ToDecimal(data["HUDMedianIncomeAmount"]);
                _hudmedianincomeamount_isnull = false;
            }
            // assigns the MSAIdentifier data to the class member
            if (data["MSAIdentifier"] == System.DBNull.Value)
            {
                SetMSAIdentifierNull();
            }
            else
            {
                _msaidentifier = Convert.ToString(data["MSAIdentifier"]);
            }
            // assigns the FNMCommunityLendingProductType data to the class member
            if (data["FNMCommunityLendingProductType"] == System.DBNull.Value)
            {
                SetFNMCommunityLendingProductTypeNull();
            }
            else
            {
                _fnmcommunitylendingproducttype        = Convert.ToInt16(data["FNMCommunityLendingProductType"]);
                _fnmcommunitylendingproducttype_isnull = false;
            }


            RecalculateChecksum();
        }
 public Categories(System.Data.SqlClient.SqlDataReader reader)
 {
     this.AddItemsToListBySqlDataReader(reader);
 }
Example #57
0
    protected void btnSubmit(object sender, EventArgs e)
    {
        int personid = -1;

        string firstNameV      = firstname.Text.ToString();
        string lastNameV       = lastname.Text.ToString();
        string userNameV       = email.Text.ToString();
        string passwordHashV   = password.Text.ToString(); // GET PASSWORD HASH WORKING
        string userTypeV       = "Applicant";
        string emailV          = email.Text.ToString();
        string middleInitialV  = "J";
        string primaryPhoneV   = phone.Text.ToString();
        string secondaryPhoneV = " ";
        string cityV           = city.Text.ToString();
        string countyV         = " ";
        string stateV          = state.Text.ToString();
        string countryV        = "United States";
        string zipV            = zip.Text.ToString();
        string dob1V           = " "; // GET DATE OF BIRTH WORKING. CURRENTLY HAVE GETDATE() in SQL STATEMENT
        string dob2V           = " ";

        string streetV = address.Text.ToString();
        string statusV = "Applicant";
        // RABIES VACCINATION NEEDS TO BE PULLED AND DATE ASSIGNED IN SQL STATEMENT

        string allergiesV              = allergies.Text.ToString();;
        string workOutsideV            = " ";
        int    totalHoursV             = 0;   // AUTOMATICALLY 0 SINCE THEY DID NOT START WORKING YET
        string workOutsideLimitationsV = " "; // NOT ON THE FORM?
        string lift40V      = " ";            // THESE FIELDS ARE NOT ON THE FORM
        int    permitRehabV = 0;

        string previousTrainingV = medical.Text.ToString();
        string workEnvironmentV  = workEnvironment.Text.ToString();
        string euthanasiaV       = euthanize.Text.ToString();
        string dirtyV            = dirty.Text.ToString();

        System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection();
        sc.ConnectionString = @"Server=LOCALHOST; Database=Wildlife;Trusted_Connection=Yes;";

        sc.Open();

        System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();
        insert.Connection = sc;


        insert.CommandText = "INSERT INTO Person (Person_UserName, Person_PasswordHash, Person_UserType, Person_FirstName, Person_MiddleName, Person_LastName, Person_Email, Person_PhonePrimary, Person_PhoneAlternate, Person_StreetAddress, Person_City, Person_County, Person_State, Person_Country, Person_ZipCode, Person_DateOfBirth, Person_Status, Person_RabbiesVaccinationDate, Person_RehabilitatePermitCategory, Person_Allergies, " +
                             "Person_WorkOutside, Person_OutsideLimitations, Person_Lift40Lbs, Person_TotalVolunteeredHours, Person_LastVolunteered)" +
                             " VALUES ('" + userNameV + "', '" + passwordHashV + "', '" + userTypeV + "', '" + firstNameV + "', '" + middleInitialV + "', '" + lastNameV + "', '" + emailV + "', '" + primaryPhoneV + "', '" + secondaryPhoneV + "', '" + streetV + "', '" + cityV + "', '" + countyV + "', '" + stateV + "', '" + countryV + "', '" + zipV + "', getdate(), " + " '" + statusV + "', getdate(), '" + permitRehabV + "', '" + allergiesV + "', '" +
                             workOutsideV + "', '" + workOutsideLimitationsV + "', '" + lift40V + "', " + totalHoursV + ", getdate())";

        insert.ExecuteNonQuery();



        insert.CommandText = "SELECT MAX(Person_ID) FROM Person";
        insert.ExecuteNonQuery();

        System.Data.SqlClient.SqlDataReader reader = insert.ExecuteReader();

        if (reader.HasRows)
        {
            while (reader.Read())
            {
                personid = reader.GetInt32(0);
            }

            reader.Close();



            // vet specific



            insert.CommandText = "INSERT INTO vetteamapp (VetTeamApp_PersonID, "
                                 + " VetTeamApp_PreviousTraining, "
                                 + "VetTeamApp_WorkEnvironment, "
                                 + "VetTeamApp_Euthansia, "
                                 + "VetTeamApp_Messy) "
                                 + "VALUES (" + personid + ", "
                                 + "'" + previousTrainingV + "', "
                                 + "'" + workEnvironmentV + "', "
                                 + "'" + euthanasiaV + "', "
                                 + "'" + dirtyV + "')";

            insert.ExecuteNonQuery();

            /*		//Document Query
             *  if($_FILES['permitRehabVA']['size'] > 0){
             *      $fileName  = $_FILES['permitRehabVA']['name'];
             *      $tmpName  = $_FILES['permitRehabVA']['tmp_name'];
             *      $fileType = $_FILES['permitRehabVA']['type'];
             *      $fileSize = $_FILES['permitRehabVA']['size'];
             *      $fp      = fopen($tmpName, 'r');
             *      $permitRehabVA = fread($fp, filesize($tmpName));
             *      $permitRehabVA = addslashes($permitRehabVA);
             *      fclose($fp);
             *
             *
             *
             *      $documentQuery = "INSERT INTO documentation (Documentation_PersonID, Documentation_TypeOfDocument, Documentation_FileName, Documentation_FileType, Documentation_FileSize, Documentation_FileContent, Documentation_DocumentNotes)
             *          VALUES ('$personID', 'Rehabilitation_Permit', '$fileName', '$fileType', '$fileSize', '$permitRehabVA', NULL)";
             *
             *
             *      if(!mysqli_query($conn,$documentQuery))
             *
             *      {
             *          echo("Error description: " . mysqli_error($conn));
             *          $insertsPassed = "false";
             *      }
             *  }
             *  if($_FILES['rabbiesDocumentation']['size'] > 0){
             *      $fileName  = $_FILES['rabbiesDocumentation']['name'];
             *      $tmpName  = $_FILES['rabbiesDocumentation']['tmp_name'];
             *      $fileType = $_FILES['rabbiesDocumentation']['type'];
             *      $fileSize = $_FILES['rabbiesDocumentation']['size'];
             *      $fp      = fopen($tmpName, 'r');
             *      $rabbiesDocumentation = fread($fp, filesize($tmpName));
             *      $rabbiesDocumentation = addslashes($rabbiesDocumentation);
             *      fclose($fp);
             *
             *
             *
             *      $documentQuery = "INSERT INTO documentation (Documentation_PersonID, Documentation_TypeOfDocument, Documentation_FileName, Documentation_FileType, Documentation_FileSize, Documentation_FileContent, Documentation_DocumentNotes)
             *          VALUES ('$personID', 'Rabbies_Documentation', '$fileName', '$fileType', '$fileSize', '$rabbiesDocumentation', NULL)";
             *
             *
             *      if(!mysqli_query($conn,$documentQuery))
             *
             *      {
             *          echo("Error description: " . mysqli_error($conn));
             *          $insertsPassed = "false";
             *      }
             *
             *  }
             *  if($_FILES['userFile']['size'] > 0){
             *      //Document Query
             *      $fileName  = $_FILES['userFile']['name'];
             *      $tmpName  = $_FILES['userFile']['tmp_name'];
             *      $fileType = $_FILES['userFile']['type'];
             *      $fileSize = $_FILES['userFile']['size'];
             *      $fp      = fopen($tmpName, 'r');
             *      $userfile = fread($fp, filesize($tmpName));
             *      $userfile = addslashes($userfile);
             *      fclose($fp);
             *
             *
             *
             *      $documentQuery = "INSERT INTO documentation (Documentation_PersonID, Documentation_TypeOfDocument, Documentation_FileName, Documentation_FileType, Documentation_FileSize, Documentation_FileContent, Documentation_DocumentNotes)
             *          VALUES ('$personID', 'Resume', '$fileName', '$fileType', '$fileSize', '$userfile', NULL)";
             *
             *
             *      if(!mysqli_query($conn,$documentQuery))
             *
             *      {
             *          echo("Error description: " . mysqli_error($conn));
             *          $insertsPassed = "false";
             *      }
             *  }
             * }
             * if($insertsPassed == "true"){
             *      $conn->close();
             *      header("Location: confirmation.php");
             *      exit();
             *      }
             * else{
             *  $message = 'Password values do not match. Please try again.';
             *
             * echo "<SCRIPT>
             * alert('$message');
             * </SCRIPT>";
             * }
             *
             * }
             * ?>
             *
             */
        }
    }
Example #58
0
 public Contact(System.Data.SqlClient.SqlDataReader reader)
 {
     this.AddItemsToListBySqlDataReader(reader);
 }
        /// <summary>
        /// This method is used to make the format for print .
        /// </summary>
        public void makingReport()
        {
            /*
             *                                                      ======================
             *                                                         PRICE LIST REPORT
             *                                                      ======================
             +-------+----------------------+-----------+-----------+-----------+----------+
             |Prod_ID|  Product Name           | Pack_Type | Pur_Rate  | Sal_Rate  |Eff_Date  |
             +-------+-------------------------+-----------+-----------+-----------+----------+
             * 1001    1234567890123456789012345 1X20777     12345678.00 12345678.00 DD/MM/YYYY
             */
            System.Data.SqlClient.SqlDataReader rdr = null;
            string home_drive = Environment.SystemDirectory;

            home_drive = home_drive.Substring(0, 2);
            string       path = home_drive + @"\Inetpub\wwwroot\Servosms\Sysitem\ServosmsPrintServices\ReportView\MechanicReport.txt";
            StreamWriter sw   = new StreamWriter(path);

            string sql  = "";
            string info = "";

            //string strDate = "";

            sql = "select distinct b.state r1,me.mccd r2,me.mcname r3,me.mctype r4,me.place r5,cme.customername r6,c.cust_type r7 from beat_master b,machanic_entry me, customermechanicentry cme,customer c where b.state in(select state from beat_master where city =me.place) and cme.customername in(select customername from customermechanicentry where customermechid=me.custid) and c.cust_type in(select cust_type from customer where cust_name=cme.customername)";
            sql = sql + " order by " + Cache["strorderby"];
            dbobj.SelectQuery(sql, ref rdr);
            // Condensed
            sw.Write((char)27);           //added by vishnu
            sw.Write((char)67);           //added by vishnu
            sw.Write((char)0);            //added by vishnu
            sw.Write((char)12);           //added by vishnu

            sw.Write((char)27);           //added by vishnu
            sw.Write((char)78);           //added by vishnu
            sw.Write((char)5);            //added by vishnu

            sw.Write((char)27);           //added by vishnu
            sw.Write((char)15);
            //**********
            string des     = "---------------------------------------------------------------------------------------------------------------";
            string Address = GenUtil.GetAddress();

            string[] addr = Address.Split(new char[] { ':' }, Address.Length);
            sw.WriteLine(GenUtil.GetCenterAddr(addr[0], des.Length).ToUpper());
            sw.WriteLine(GenUtil.GetCenterAddr(addr[1] + addr[2], des.Length));
            sw.WriteLine(GenUtil.GetCenterAddr("Tin No : " + addr[3], des.Length));
            sw.WriteLine(des);
            //**********
            sw.WriteLine(GenUtil.GetCenterAddr("=================", des.Length));
            sw.WriteLine(GenUtil.GetCenterAddr("MECHANIC REPORT", des.Length));
            sw.WriteLine(GenUtil.GetCenterAddr("=================", des.Length));
            sw.WriteLine("+----------+-------------+---------------+----------+-------------------------+---------------+---------------+");
            sw.WriteLine("| District |Mechanic Code|     Name      |   Type   |      Under Firm         |   Firm Type   |    Place      |");
            sw.WriteLine("+----------+-------------+---------------+----------+-------------------------+---------------+---------------+");
            //             1001567 12345678901234567890123 12345678901 12345678.00 12345678.00 DD/MM/YYYY

            if (rdr.HasRows)
            {
                // info : to set the format the displaying string.
                info = " {0,-10:S}  {1,-13:F} {2,-15:S} {3,-10:S} {4,-25:S} {5,-15:S} {6,-15:S}";
                while (rdr.Read())
                {
                    /*sw.WriteLine(info,rdr["Prod_ID"].ToString().Trim(),
                     *      rdr["Prod_Name"].ToString().Trim(),
                     *      rdr["Pack_Type"].ToString(),
                     *      GenUtil.strNumericFormat(rdr["Pur_Rate"].ToString().Trim()),
                     *      GenUtil.strNumericFormat(rdr["sal_Rate"].ToString().Trim()),
                     *      GenUtil.str2DDMMYYYY(strDate));*/
                    sw.WriteLine(info, GenUtil.TrimLength(rdr["r1"].ToString(), 10),
                                 rdr["r2"].ToString(),
                                 GenUtil.TrimLength(rdr["r3"].ToString(), 15),
                                 GenUtil.TrimLength(rdr["r4"].ToString(), 10),
                                 GenUtil.TrimLength(rdr["r6"].ToString(), 25),
                                 GenUtil.TrimLength(rdr["r7"].ToString(), 15),
                                 GenUtil.TrimLength(rdr["r5"].ToString(), 15));
                }
            }
            sw.WriteLine("+----------+-------------+---------------+----------+-------------------------+---------------+---------------+");
            dbobj.Dispose();
            sw.Close();
        }
Example #60
0
 //Busqueda del documento escaneado
 public void BuscaPedido(bool PedidoReferencia, bool Ruta, string Documento)
 {
     System.Data.SqlClient.SqlCommand    cmd = new System.Data.SqlClient.SqlCommand();
     System.Data.SqlClient.SqlDataReader dr  = null;
     cmd.CommandText = "spCYCArqueoCobranzaConsultaDocumento";
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Connection  = _connection;
     cmd.Parameters.Add("@FInicial", SqlDbType.DateTime).Value = _fInicio;
     cmd.Parameters.Add("@FFinal", SqlDbType.DateTime).Value   = _fFin;
     cmd.Parameters.Add("@Empleado", SqlDbType.Int).Value      = _empleado;
     if (PedidoReferencia != true)
     {
         cmd.Parameters.Add("@PedidoReferencia", SqlDbType.VarChar, 20).Value = Documento;
     }
     else
     {
         int valeCredito = 0;
         try
         {
             valeCredito = Convert.ToInt32(Documento);
         }
         catch (System.OverflowException ex)
         {
             if (ex != null)
             {
                 throw new System.OverflowException("El número de documento (" + Documento + ") " +
                                                    "no corresponde a un vale de crédito" + (char)13 +
                                                    "Intente la búsqueda por número de pedido");
             }
         }
         cmd.Parameters.Add("@ValeCredito", SqlDbType.Int).Value = valeCredito;
     }
     if (Ruta && _ruta != 0)
     {
         cmd.Parameters.Add("@Ruta", SqlDbType.SmallInt).Value = _ruta;
     }
     _documentoEncontrado = false;
     try
     {
         OpenConnection();
         dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             AddDataRow(dr);
             _documentoEncontrado = true;
         }
         dr.Close();
     }
     catch (System.Data.ConstraintException ex)
     {
         throw ex;
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         CloseConnection();
         cmd.Dispose();
     }
 }