// Update is called once per frame
    public void addToPlayerActionLog(string actionRefID, string actionInfo)
    {
        //get roomID & playerName
        GameObject gameManager = GameObject.Find("GameManager");
        GameManagerVik vikky = gameManager.GetComponent<GameManagerVik>();
        string sessionID = vikky.sessionID.ToString ();
        string playerName = vikky.loginName;
        string playerRole = vikky.characterName;

        //add to db
        dbClass db = new dbClass();
        db.addFunction("playerActionLog");
        db.addValues("playerName", playerName);
        db.addValues("playerRole", playerRole);
        db.addValues("sessionID", sessionID);
        db.addValues("actionRefID", actionRefID);
        db.addValues("actionInfo", actionInfo);
        string dbReturn = db.connectToDb();

        if (dbReturn != "SUCCESS NO RETURN") {
            print (dbReturn);
        }

        //end add to db
    }
        public ActionResult Addmember(addMemberClass add)
        {
            dbClass sdb = new dbClass();


            String fn  = Path.GetFileNameWithoutExtension(add.ImageFile.FileName);
            String ext = Path.GetExtension(add.ImageFile.FileName);

            fn       = fn + DateTime.Now.ToString("yymmssfff") + ext;
            add.path = "~/images/" + fn;
            fn       = Path.Combine(Server.MapPath("~/images/"), fn);
            add.ImageFile.SaveAs(fn);

            add.photo = fn.ToString();

            try
            {
                if (ModelState.IsValid)
                {
                    if (sdb.AddMember(add))
                    {
                        // ViewBag.Message = String.Format("Hello{0}.\\ncurrent Date and time:{1}", "name", DateTime.Now.ToString());
                        ViewBag.Message = "Member Added Successfully";
                        ModelState.Clear();
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch
            {
                return(View());
            }
            return(View());
        }
        public ActionResult viewmember()
        {
            dbClass dbhandle = new dbClass();

            ModelState.Clear();
            return(View(dbhandle.viewMember()));
        }
Beispiel #4
0
    public byte[] ShowEmpImage(int imgID)
    {
        dbClass    db  = new dbClass();
        string     sql = "SELECT LOGpdf FROM tableName WHERE LOGuid = @ID";
        SqlCommand cmd = new SqlCommand(sql, db.con);

        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@ID", imgID);
        object img = null;

        try
        {
            db.Connect();
            img = cmd.ExecuteScalar();
        }
        catch
        {
            return(null);
        }
        finally
        {
            db.Disconnect();
        }
        return((byte[])img);
    }
    private void alterarItem()
    {
        dbClass db  = new dbClass();
        string  sql = "update sipXtrimestre set cd_empresa = cd_empresa ";

        if (txtQtEventos.Text.Length > 0)
        {
            sql += ", qt_evento = " + txtQtEventos.Text;
        }
        if (txtQtBenefCarencia.Text.Length > 0)
        {
            sql += ", qt_benef_fora_per_carencia = " + txtQtBenefCarencia.Text;
        }
        if (txtTtDespLiq.Text.Length > 0)
        {
            sql += ", tt_despesa_liq = " + txtTtDespLiq.Text.Replace(".", "").Replace(",", ".");
        }
        sql += " where cd_empresa = " + cboEmpresa.SelectedValue;
        sql += " and ano = " + txtAno.Text;
        sql += " and trimestre = " + cboTrimestre.SelectedValue;
        sql += " and uf = '" + txtUF.Text + "'";
        sql += " and formaContratacao = '" + cboFormacontrat.SelectedValue + "'";
        sql += " and cd_sip = '" + cboItemAssit.SelectedValue + "'";
        db.execmd(sql, false);
    }
Beispiel #6
0
 public static void comboRellenar(System.Web.UI.WebControls.DropDownList combo, string textoSql, string cadenaConexion, string mensajeInicial)
 {
     combo.Items.Clear();
     if (cadenaConexion == "")
     {
         cadenaConexion = ctes.conStringAdoGeneral;
     }
     dbClass pp = new dbClass(cadenaConexion);
     MySql.Data.MySqlClient.MySqlDataReader reg;
     // 'SqlClient.SqlDataReader
     DataTable esquema;
     reg = pp.sql(textoSql);
     esquema = reg.GetSchemaTable();
     combo.DataSource = reg; //myDataReader
     combo.DataTextField = sf.cadena(esquema.Rows[1].ItemArray[0]);
     combo.DataValueField = sf.cadena(esquema.Rows[0].ItemArray[0]);
     //.Columns(1).ColumnName.ToString '.Item(0).ColumnName.ToString;
     //'"idlicencias" 'myDataReader.Fields(0).Name;
     combo.DataBind();
     //   mensajeInicial = "<Elija una opcion>";
     if (mensajeInicial != "")
     {
         ListItem per = new ListItem();
         per.Value = sf.cadena(0);
         per.Text = mensajeInicial;
         combo.Items.Insert(0, per);
     }
     pp.Dispose();
 }
Beispiel #7
0
        private void calcIncome(int days, double gross, double overtime, int absences, double loans, double netpay)
        {
            dbClass   db      = new dbClass();
            DataTable getJob  = db.dbSelect("SELECT job from tb_info WHERE id=" + this.del_id);
            DataTable getJobs = db.dbSelect("SELECT salary from tb_job where id=" + getJob.Rows[0][0]);

            MessageBox.Show(getJobs.Rows[0][0].ToString());
        }
    private void carregaSubItens(XmlElement item, string select, string codigo)
    {
        //int ttEventos = 0;
        //int ttbenef = 0;
        //double ttDespesa = 0;

        dbClass       db1 = new dbClass();
        SqlDataReader dr  = db1.DataReader(select + " and b.subItemDe = " + codigo + " order by b.id");

        while (dr.Read())
        {
            string     localName       = dr["tagXml"].ToString();
            XmlElement xmlProcedimento = doc.CreateElement(localName);
            item.AppendChild(xmlProcedimento);


            if (String.Compare(dr["lg_evento"].ToString(), "S") == 0)
            {
                XmlElement xmlEventos = doc.CreateElement("eventos");
                xmlEventos.InnerText = dr["qt_evento"].ToString();
                xmlProcedimento.AppendChild(xmlEventos);
                //int qtEventos = int.Parse(dr["qt_evento"].ToString());
                //ttEventos += qtEventos;
            }

            if (String.Compare(dr["lg_beneficiario"].ToString(), "S") == 0)
            {
                XmlElement xmlBeneficiarios = doc.CreateElement("beneficiarios");
                xmlBeneficiarios.InnerText = dr["qt_benef_fora_per_carencia"].ToString();
                xmlProcedimento.AppendChild(xmlBeneficiarios);
                //int qtBenef = int.Parse(dr["qt_benef_fora_per_carencia"].ToString());
                //ttbenef += qtBenef;
            }


            if (String.Compare(dr["lg_despesa"].ToString(), "S") == 0)
            {
                XmlElement xmlDespesas = doc.CreateElement("despesas");
                xmlDespesas.InnerText = double.Parse(dr["tt_despesa_liq"].ToString()).ToString("F");
                xmlProcedimento.AppendChild(xmlDespesas);
                //double vrDespesa = double.Parse(dr["tt_despesa_liq"].ToString());
                //ttDespesa += vrDespesa;
            }
        }

        /*
         * if (dr.HasRows)
         * {
         *  item.SelectSingleNode("eventos").InnerText = ttEventos.ToString();
         *  item.SelectSingleNode("beneficiarios").InnerText = ttbenef.ToString();
         *  item.SelectSingleNode("despesas").InnerText = ttDespesa.ToString("F");
         * }
         */
        dr.Close();
        db1.closeConn();
    }
Beispiel #9
0
        private void Income_Load(object sender, EventArgs e)
        {
            this.AcceptButton = btnAdd;
            dbClass   db = new dbClass();
            DataTable dt = db.dbSelect("SELECT * FROM tb_info");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbEmployees.Items.Add(dt.Rows[i]["firstname"].ToString() + " " + dt.Rows[i]["lastname"].ToString());
            }
        }
Beispiel #10
0
        public void getDept()
        {
            DataTable dt = new DataTable();
            dbClass   db = new dbClass();

            dt = db.dbSelect("SELECT * FROM tb_department");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbDept.Items.Add(dt.Rows[i]["code"]);
                cmbParent.Items.Add(dt.Rows[i]["code"]);
            }
        }
Beispiel #11
0
        public void getJob()
        {
            DataTable dt     = new DataTable();
            dbClass   db     = new dbClass();
            DataTable parent = db.dbSelect("SELECT id from tb_department WHERE code='" + cmbDept.Text + "'");

            try {
                dt = db.dbSelect("SELECT * FROM tb_job WHERE parent=" + parent.Rows[0][0]);
            } catch { }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbJob.Items.Add(dt.Rows[i]["description"]);
            }
        }
Beispiel #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int i = 0;
        string sOut;

        db1 = new dbClass();

        db1.dbhost = "localhost";
        db1.dbname = "northwind";
        db1.dbuser = "******";
        db1.dbpass = "******";

        if (IsPostBack)
        {
            if (DropDownList1.Text != "ALL")
            {
                sql = "SELECT EmployeeID,FirstName,LastName,City FROM `northwind`.`employees` WHERE City='" + DropDownList1.Text + "'";
            }
            else
            {
                sql = "SELECT EmployeeID,FirstName,LastName,City FROM `northwind`.`employees`;";
            }
        }
        else
        {
            sql = "SELECT EmployeeID,FirstName,LastName,City FROM `northwind`.`employees`;";
        }

        db1.openConnection();
        db1.QueryDBDataset(sql);
        sOut = "<table>";

        for (i = 0; i < db1.ds.Tables[0].Rows.Count; i++)
        {
            sOut += "<tr><td>" + db1.ds.Tables[0].Rows[i].ItemArray[0].ToString() + "</td>";
            sOut += "<td>" + db1.ds.Tables[0].Rows[i].ItemArray[1].ToString() + "</td>";
            sOut += "<td>" + db1.ds.Tables[0].Rows[i].ItemArray[2].ToString() + "</td>";
            sOut += "<td>" + db1.ds.Tables[0].Rows[i].ItemArray[3].ToString() + "</td></tr>";
        }

        sOut += "</table>";

        lblOut.Text = sOut;

        db1.closeConnection();
    }
    private void gera_sip()
    {
        dbClass db       = new dbClass();
        string  NrRegANS = "";

        if (cboEmpresa.SelectedValue == "1")
        {
            NrRegANS = db.execmd("select vl_parametro from parametro where cd_parametro = 'CDRANS'", true);
        }
        else
        if (cboEmpresa.SelectedValue == "2")
        {
            NrRegANS = db.execmd("select vl_parametro from parametro where cd_parametro = 'CDANS2'", true);
        }
        nmArq = NrRegANS;
        string dtTrimestre = getTrimestre(txtAno.Text, cboTrimestre.SelectedIndex + 1);

        nmArq += "_" + dtTrimestre.Substring(0, 2) + dtTrimestre.Substring(3, 2) + dtTrimestre.Substring(6);
        nmArq += "_" + DateTime.Now.ToString("ddMMyyyyHHmmss");
        nmArq  = nmArq + ".xsip";
        string nmSoarq = nmArq;

        nmArq = @"c:\temp\" + nmArq + ".xsip";

        doc = new XmlDocument();
        XmlElement xmlMensagemSIP = doc.CreateElement("mensagemSIP");

        doc.AppendChild(xmlMensagemSIP);

        string Sequencial = "1";
        string Cnpj       = "01306081000115";

        if (cboEmpresa.SelectedValue == "2") //seato
        {
            Cnpj = "00844669000160";
        }

        geraCabecalhoSIP(xmlMensagemSIP, "ENVIO_SIP", Sequencial, DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"), NrRegANS, "03589068000146", Cnpj, "1.02", "Multiodonto", "2.3.3.6", "Proprio");
        geraMensagemSIP(xmlMensagemSIP, txtAno.Text, (cboTrimestre.SelectedIndex + 1).ToString(), "SP", cboEmpresa.SelectedValue);
        doc.PreserveWhitespace = false;
        doc.Save(nmArq);
        geraEpilogo(xmlMensagemSIP);
        DownloadArq(nmArq, nmSoarq);
    }
Beispiel #14
0
        private void dataGridView2_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            dbClass   db     = new dbClass();
            DataTable parent = db.dbSelect("SELECT code from tb_department WHERE id=" + dataGridView2.CurrentRow.Cells[2].Value.ToString());
            FillForm  form   = new FillForm();

            form.getDept();
            if (this.activeTab == "Job")
            {
                form.comboBox1.Text    = "Job";
                form.btnUpdate.Visible = true;
                form.btnAdd.Visible    = false;
                form.activeID          = dataGridView2.CurrentRow.Cells[0].Value.ToString();
                form.txtJob.Text       = dataGridView2.CurrentRow.Cells[1].Value.ToString();
                form.cmbParent.Text    = parent.Rows[0][0].ToString();
                form.txtSalary.Text    = dataGridView2.CurrentRow.Cells[3].Value.ToString();
                this.Hide();
                form.Show();
            }
        }
Beispiel #15
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtOtherLoansName.Text == "Name")
     {
         txtOtherLoansName.Text = "Other";
     }
     if (this.txtNetPay.Text != "0.00")
     {
         dbClass  db    = new dbClass();
         DateTime date  = DateTime.Now;
         String   query = "insert into tb_employee (fullname, department, job, rate, no_of_days, gross_income, overtime_hrs, no_of_absences, loan_pagibig, loan_sss, loan_other_name, loan_other, prem_pagibig, prem_sss, prem_philhealth, total_loans, total_prem_loans, total_deduction, net_pay, date) values ('" + cmbEmployees.Text + "', '" + lblDept.Text + "', '" + lblJob.Text + "', " + txtSalary.Text + ", " + numWorkDays.Value + ", " + this.gross_pay + ", " + numOT.Value + ", " + numAbsent.Value + ", " + txtPagibigLoans.Text + ", " + txtSSSLoans.Text + ", '" + txtOtherLoansName.Text + "', " + txtOtherLoans.Text + ", " + txtPremPagibig.Text + ", " + txtPremSSS.Text + ", " + txtPremPhil.Text + ", " + labelLoans.Text + ", " + lblPremLoans.Text + ", " + lblTotalDeductions.Text + ", " + txtNetPay.Text + ", '" + date + "')";
         db.dbInsert(query);
         Main main = new Main();
         this.Hide();
         main.Show();
         MessageBox.Show("Record added!");
     }
     else
     {
         MessageBox.Show("Please fill all forms!");
     }
 }
    private void gera_sip()
    {
        dbClass db       = new dbClass();
        string  NrRegANS = db.execmd("select vl_parametro from parametro where cd_parametro = 'CDRANS'", true);

        nmArq  = @"c:\temp\";
        nmArq += NrRegANS;
        string dtTrimestre = getTrimestre(txtAno.Text, cboTrimestre.SelectedIndex + 1);

        nmArq += "_" + dtTrimestre.Substring(0, 2) + dtTrimestre.Substring(3, 2) + dtTrimestre.Substring(6);
        nmArq += "_" + DateTime.Now.ToString("ddMMyyyyHHmmss");
        nmArq += ".xsip";

        doc = new XmlDocument();
        XmlElement xmlMensagemSIP = doc.CreateElement(xmlPrefix, "mensagemSIP", nmUrl);

        doc.AppendChild(xmlMensagemSIP);
        geraCabecalhoSIP(xmlMensagemSIP, "ENVIO_SIP", "100", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"), NrRegANS, "03.589.068/0001-46", "01.306.081/0001-15", "V1.01", "Multiodonto", "2.3.3.6", "Proprio");
        geraMensagemSIP(xmlMensagemSIP, txtAno.Text, (cboTrimestre.SelectedIndex + 1).ToString(), "SP", "1");
        doc.Save(nmArq);
        geraEpilogo(xmlMensagemSIP);
    }
    private void gravarItem()
    {
        dbClass db  = new dbClass();
        string  sql = "insert into sipXtrimestre (cd_empresa, ano, trimestre, uf, formaContratacao, cd_sip, qt_evento,qt_benef_fora_per_carencia, tt_despesa_liq) values (";

        sql += cboEmpresa.SelectedValue + ",";
        sql += txtAno.Text + ",";
        sql += cboTrimestre.SelectedValue + ",'";
        sql += txtUF.Text + "','";
        sql += cboFormacontrat.SelectedValue + "','";
        sql += cboItemAssit.SelectedValue + "',";
        if (txtQtEventos.Text.Length > 0)
        {
            sql += txtQtEventos.Text + ",";
        }
        else
        {
            sql += "0,";
        }
        if (txtQtBenefCarencia.Text.Length > 0)
        {
            sql += txtQtBenefCarencia.Text + ",";
        }
        else
        {
            sql += "0,";
        }
        if (txtTtDespLiq.Text.Length > 0)
        {
            sql += txtTtDespLiq.Text.Replace(".", "").Replace(",", ".") + ")";
        }
        else
        {
            sql += "0)";
        }
        db.execmd(sql, false);
        limpaTela();
    }
Beispiel #18
0
        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult result = MessageBox.Show("Click YES to edit info press NO to print.", "Action", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result.Equals(DialogResult.No))
            {
                Print_Ind ind = new Print_Ind();
                ind.id = this.del_id;
                ind.Show();
            }
            else
            {
                dbClass   db   = new dbClass();
                DataTable jb   = db.dbSelect("SELECT description from tb_job WHERE id=" + dataGridView1.CurrentRow.Cells[9].Value.ToString());
                DataTable dp   = db.dbSelect("SELECT code from tb_department WHERE id=" + dataGridView1.CurrentRow.Cells[8].Value.ToString());
                FillForm  form = new FillForm();
                form.getDept();
                form.getJob();
                if (this.activeTab == "Information")
                {
                    form.comboBox1.Text    = "Information";
                    form.txtLN.Text        = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                    form.txtFN.Text        = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                    form.txtMN.Text        = dataGridView1.CurrentRow.Cells[3].Value.ToString();
                    form.txtAdd.Text       = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                    form.pickBday.Text     = dataGridView1.CurrentRow.Cells[5].Value.ToString();
                    form.txtBPlace.Text    = dataGridView1.CurrentRow.Cells[6].Value.ToString();
                    form.txtContact.Text   = dataGridView1.CurrentRow.Cells[7].Value.ToString();
                    form.cmbDept.Text      = dp.Rows[0][0].ToString();
                    form.cmbJob.Text       = jb.Rows[0][0].ToString();
                    form.btnUpdate.Visible = true;
                    form.btnAdd.Visible    = false;
                    form.activeID          = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                    this.Hide();
                    form.Show();
                }
            }
        }
Beispiel #19
0
        private void cmbEmployees_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable id, job, salary, get_job, get_dept;

            txtNetGross.Text = "";
            dbClass db = new dbClass();

            String[] name = cmbEmployees.Text.Split(' ');
            id             = db.dbSelect("select id from tb_info where firstname='" + name[0] + "' and lastname ='" + name[1] + "'");
            this.id        = Convert.ToInt32(id.Rows[0][0]);
            job            = db.dbSelect("select job from tb_info where id=" + this.id);
            get_job        = db.dbSelect("select description, parent from tb_job where id=" + job.Rows[0][0]);
            get_dept       = db.dbSelect("select description from tb_department where id=" + get_job.Rows[0][1]);
            salary         = db.dbSelect("select salary from tb_job where id=" + job.Rows[0][0]);
            this.salary    = Convert.ToDecimal(salary.Rows[0][0]);
            txtSalary.Text = salary.Rows[0][0].ToString();
            lblDept.Text   = get_dept.Rows[0][0].ToString();
            lblJob.Text    = get_job.Rows[0][0].ToString();
            try {
                calcGross(Convert.ToDecimal(salary.Rows[0][0]), Convert.ToInt32(numWorkDays.Value), Convert.ToInt32(numOT.Value));
                calcNet(Convert.ToInt32(numAbsent.Value), Convert.ToDecimal(txtLoans.Text));
            } catch { }
        }
Beispiel #20
0
    public void ProcessRequest(HttpContext context)
    {
        Int32 imgID;

        if (context.Request.QueryString["id"] != null)
        {
            imgID = Convert.ToInt32(context.Request.QueryString["id"]);
        }
        else
        {
            throw new ArgumentException("No parameter specified");
        }

        byte[]  buffer    = ShowEmpImage(imgID);
        bool    temp      = false;
        string  extension = "";
        var     enc       = new ASCIIEncoding();
        var     header    = enc.GetString(buffer);
        dbClass db        = new dbClass();

        extension = db.GetID("select fileExtension from tableName WHERE LOGuid=" + imgID, "fileExtension");
        if (extension == null || extension == "")
        {
            if (buffer[0] == 0x25 && buffer[1] == 0x50 &&
                buffer[2] == 0x44 && buffer[3] == 0x46)
            {
                temp      = header.StartsWith("%PDF-");
                extension = "application/pdf";
            }
            else if (buffer[0] == 0xFF && buffer[1] == 0xD8 &&
                     buffer[2] == 0xFF && buffer[3] == 0xE0)
            {
                temp      = header.StartsWith("%JPG-");
                extension = "image/jpeg";
                extension = "image/jpg";
            }
            else if (buffer[0] == 0x89 && buffer[1] == 0x50 &&
                     buffer[2] == 0x4E && buffer[3] == 0x47)
            {
                temp      = header.StartsWith("%PNG-");
                extension = "image/jpeg";
                extension = "image/png";
            }
            else if (buffer[0] == 0x49 && buffer[1] == 0x49 &&
                     buffer[2] == 0x2A && buffer[3] == 0x00)
            {
                temp      = header.StartsWith("%TIF-");
                extension = "image/jpeg";
                extension = "image/tiff";
                extension = "image/tif";
            }
            else if (buffer[0] == 0x47 && buffer[1] == 0x49 &&
                     buffer[2] == 0x46 && buffer[3] == 0x38)
            {
                temp      = header.StartsWith("%GIF-");
                extension = "image/jpeg";
                extension = "image/gif";
            }
            else if (buffer[0] == 0x42 && buffer[1] == 0x4D &&
                     buffer[2] == 0x46 && buffer[3] == 0x38)
            {
                temp      = header.StartsWith("%BMP-");
                extension = "image/jpeg";
                extension = "image/bmp";
            }
            else if (buffer[0] == 0x00 && buffer[1] == 0x00 &&
                     buffer[2] == 0x01 && buffer[3] == 0x00)
            {
                temp      = header.StartsWith("%ICO-");
                extension = "image/jpeg";
                extension = "image/ico";
            }
            else
            {
                extension = "image/jpeg";
            }
            //else
            //extension = "application/pdf";
        }
        context.Response.ContentType = extension;
        context.Response.AddHeader("content-length", buffer.Length.ToString());
        context.Response.BinaryWrite(buffer);
    }
Beispiel #21
0
    void OnGUI()
    {
        //set to custom skin
        GUI.skin = customSkin;

        //--------------------------------------------------------------------------------------------------
        //				IF SHOWING CONNECTING SCREEN
        //--------------------------------------------------------------------------------------------------
        if (!PhotonNetwork.connected)
        {
            GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height - 300) / 2, 400, 300));

            GUILayout.Label("Connecting to Photon server.");
            GUILayout.Label("Hint: This demo uses a settings file and logs the server address to the console.");

            GUILayout.EndArea();
            return;   //Wait for a connection
        }

        //--------------------------------------------------------------------------------------------------
        //				IF SHOWING ERROR MESSAGE
        //--------------------------------------------------------------------------------------------------
        if (isMessage) {

            GUILayout.BeginArea (new Rect ((Screen.width - 400) / 2, (Screen.height - 300) / 2, 600, 300));
            GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),background);

            GUILayout.Box (message, GUILayout.Width (300), GUILayout.Height (200));
            //ok button
            if (GUILayout.Button ("OK", GUILayout.Width (80))) {

                //---------------------------------
                //	 TOGGLE isMessage false
                //---------------------------------
                    isMessage = false;

            }

            GUILayout.EndArea ();

        //--------------------------------------------------------------------------------------------------
        //				IF LOGGING INTO THE GAME
        //--------------------------------------------------------------------------------------------------
        } else if (isLogin) {

            GUILayout.BeginArea (new Rect(0,0,Screen.width,Screen.height));
            GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),background);

            GUILayout.BeginArea (new Rect (Screen.width/4, Screen.height*.1f, Screen.width/2, Screen.height*.8f));

            //title
            GUILayout.Label ("ORILE","Title");
            GUILayout.Space (45);
            GUILayout.Label ("Login Menu");

            GUILayout.BeginArea (new Rect (0, Screen.height*.275f, Screen.width/2, Screen.height*.5f));

            //player name entry
            GUILayout.BeginHorizontal();
            GUILayout.Label ("Player Name:", "labelText");
            playerName = GUILayout.TextField (playerName, 25, GUILayout.Width (200));
            GUILayout.EndHorizontal();

            //password entry
            GUILayout.BeginHorizontal();
            GUILayout.Label ("Password:"******"labelText");
            password = GUILayout.PasswordField (password, "*" [0], 25, GUILayout.Width (200));
            GUILayout.EndHorizontal();

            GUILayout.Space(20);

            //login button
            GUILayout.BeginHorizontal();
            GUILayout.Label("",GUILayout.Width (200));
            //if 'login' button is pressed, see if can login into game
            if (GUILayout.Button ("Login", GUILayout.Width (100))) {

                if (playerName != "" && password != "") {

                    //connect to db
                    dbClass db = new dbClass ();
                    db.addFunction ("playerLogin");
                    db.addValues ("playerName", playerName);
                    db.addValues ("password", password);
                    string dbReturn = db.connectToDb ();
                    //print (dbReturn);
                    //end add to db

                    //if successful;, means login success
                    if (dbReturn == "SUCCESS") {

                        //-------------------------------------------
                        //	 TOGGLE isLogin false/ isTutorial true
                        //-------------------------------------------
                        isLogin = false;
                        isTutorial = true;

                        //see if admin
                        string playerType = db.getReturnValue("playerType");
                        PlayerPrefs.SetString("playerLoginName", playerName);
                        if (playerType == "ADMIN")
                        {
                            isTrainer = true;
                        }

                    }
                    //if not successful print error string
                    else {

                        //---------------------------------
                        //	 TOGGLE isMessage true
                        //---------------------------------
                        isMessage = true;
                        message = dbReturn;
                    }

                }
                //send error msg for empty input
                else {

                        //---------------------------------
                        //	 TOGGLE isMessage true
                        //---------------------------------
                        isMessage = true;
                        message = "Please type in your playerName or password.";

                }

            }

            //press create button, means create new players
            if (GUILayout.Button ("Create", GUILayout.Width (100))) {

                    //-----------------------------------------
                    //	 TOGGLE isCreate true/ isLogin false
                    //-----------------------------------------
                    isCreate = true;
                    isLogin = false;
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(20);

            GUILayout.EndArea();
            GUILayout.EndArea();
            GUILayout.EndArea ();

        //--------------------------------------------------------------------------------------------------
        //				IF CHOOSING TUTORIAL
        //--------------------------------------------------------------------------------------------------
        } else if (isTutorial) {

            // if role selection not completed, draw GUI
            GUILayout.BeginArea(new Rect((Screen.width - 600) / 2, (Screen.height - 300) / 2, 960, 600));
            GUILayout.BeginHorizontal();
            GUILayout.Label("Do you want to play the tutorial?", GUILayout.Width(200));
            GUILayout.Space (45);

            if(GUILayout.Button("Yes",GUILayout.Width(150)) )
            {
                //-------------------------------------------
                //	 TOGGLE isLogin false/ isTutorial true
                //-------------------------------------------
                isTutorial = false;
                //isMain = true;

                //load tutorial
                PlayerPrefs.SetString("isTutorial", "true");
                Application.LoadLevel("Fire_event_tutorial");
            }

            if(GUILayout.Button("No",GUILayout.Width(150)) )
            {

                //-------------------------------------------
                //	 TOGGLE isLogin false/ isTutorial true
                //-------------------------------------------
                isTutorial = false;
                isMain = true;
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();

        //--------------------------------------------------------------------------------------------------
        //				IF CREATING PLAYER
        //--------------------------------------------------------------------------------------------------
        } else if (isCreate) {

            GUILayout.BeginArea (new Rect(0,0,Screen.width,Screen.height));
            GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),background);

            GUILayout.BeginArea (new Rect (Screen.width/4, Screen.height*.1f, Screen.width/2, Screen.height*.8f));

            GUILayout.Label ("ORILE","Title");
            GUILayout.Space (45);
            GUILayout.Label ("Create new player");
            GUILayout.Space (15);

            //player login
            GUILayout.Label ("Player Name:", GUILayout.Width (150));
            playerName = GUILayout.TextField (playerName, GUILayout.Width (150));
            //password entry
            GUILayout.Label ("Password:"******"*" [0], GUILayout.Width (150));
            //password re-entry
            GUILayout.Label ("Re-enter Password:"******"*" [0], GUILayout.Width (150));

            //if 'login' button is pressed, see if can login into game
            if (GUILayout.Button ("CREATE", GUILayout.Width (80))) {

                if (playerName != "" && password != "") {

                    if (password.Equals (reEnter)) {

                        //add to db dbClass
                        dbClass db = new dbClass ();
                        db.addFunction ("playerCreate");
                        db.addValues ("playerName", playerName);
                        db.addValues ("password", password);
                        string dbReturn = db.connectToDb ();
                        //print (dbReturn);
                        //end add to db

                        //if successful;, means login success
                        if (dbReturn == "SUCCESS NO RETURN") {

                            //-----------------------------------------------------------
                            //	 TOGGLE isCreate false/ isLogin true/ isMessage true
                            //------------------------------------------------------------
                            isCreate = false;
                            isLogin = true;
                            isMessage = true;
                            message = "player created!";
                        }
                        //if not successful print error string
                        else {

                            //---------------------------------
                            //	 TOGGLE isMessage true
                            //---------------------------------
                            isMessage = true;
                            message = dbReturn;
                        }

                    }
                    //password not equal to re-enter password
                    else
                    {

                        //---------------------------------
                        //	 TOGGLE isMessage true
                        //---------------------------------
                        isMessage = true;
                        message = "Password does not sync up.\n Please type it in again.";
                    }

                }
                //empty input
                else
                {

                    //---------------------------------
                    //	 TOGGLE isMessage true
                    //---------------------------------
                    isMessage = true;
                    message = "Please type in your playerName or password.";

                }
            }

            //back button
            if (GUILayout.Button ("back", GUILayout.Width (80))) {

                //-----------------------------------------
                //	 TOGGLE isCreate false/ isLogin true
                //-----------------------------------------
                isCreate = false;
                isLogin = true;
            }

            GUILayout.EndArea ();
            GUILayout.EndArea();

        //--------------------------------------------------------------------------------------------------
        //				IF ACCESSING PLAYBACK LIST
        //--------------------------------------------------------------------------------------------------
        } else if (isPlaybackList) {

            GUILayout.BeginArea (new Rect(0,0,Screen.width,Screen.height));
            GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),background);

            GUILayout.BeginArea (new Rect ((Screen.width - 400) / 2, (Screen.height - 300) / 2, 600, 300));

            GUILayout.Label ("Playback Menu");
            GUILayout.Space (15);
            GUILayout.Label ("Select the one you want to playback");
            GUILayout.Space (15);

            string[] listArray = this.fileList.Split(',');
            foreach (string capture in listArray)
            {
                string fileName = "";
                //Debug.Log(capture);

                //PARSE THE JSON STRING
                if (capture.IndexOf("[") == 0)
                {
                    fileName = capture.Substring(2,capture.Length-3);
                    //Debug.Log(fileName);
                }
                else if (capture.IndexOf("]") == capture.Length-1)
                {
                    fileName = capture.Substring(1,capture.Length-3);
                    //Debug.Log(fileName);
                }
                else
                {
                    fileName = capture.Substring(1,capture.Length-2);
                    //Debug.Log(fileName);
                }

                //this if statement is still for parsing the info
                if (fileName != "." && fileName != "..")
                {
                    //create a button for each playback
                    if (GUILayout.Button (fileName, GUILayout.Width (80))) {

                        //prepare playbackdialogue for playback
                        /*PlaybackDialogue diaggy = GameObject.Find("Main Camera").GetComponent<PlaybackDialogue>();
                        diaggy.convoTitle = "";
                        diaggy.dialogueNum = -1;
                        diaggy.currNum = -1;
                        diaggy.currTitle = "";*/

                        //download files
                        WWWForm sendForm = new WWWForm();
                        sendForm.AddField("fileName", fileName);
                        sendForm.AddField("load", "DOWN");
                        WWW w = new WWW("http://www.sgi-singapore.com/projects/ORILE/loadFiles.php", sendForm);
                        StartCoroutine(WaitForDownload(w, fileName));

                    }
                }

            }

            GUILayout.Space (15);

            //back button
            if (GUILayout.Button ("back", GUILayout.Width (80))) {

                //----------------------------------------------------
                //	 TOGGLE isPlaybackList false /isMain true
                //----------------------------------------------------
                isPlaybackList = false;
                isMain = true;
            }

            GUILayout.EndArea();
            GUILayout.EndArea();

        //--------------------------------------------------------------------------------------------------
        //				IF MAIN PAGE
        //--------------------------------------------------------------------------------------------------
        } else if (isMain) {

            GUILayout.BeginArea (new Rect(0,0,Screen.width,Screen.height));
            GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),background);

            GUILayout.BeginArea (new Rect (Screen.width/4, Screen.height*.1f, Screen.width/2, Screen.height*.8f));

            GUILayout.Label ("ORILE","Title");
            GUILayout.Space (45);
            GUILayout.Label ("Main Menu");
            GUILayout.Space (15);

            //Join room by title
            GUILayout.BeginHorizontal ();
            GUILayout.Label ("Join Room:", "labelText");
            roomName = GUILayout.TextField (roomName,GUILayout.Width(Screen.width/5));
            if (GUILayout.Button ("Join",GUILayout.Width(100))) {
                PhotonNetwork.JoinRoom (roomName);

                //-----------------------------------------
                //	 TOGGLE isChoose true / isMain false
                //-----------------------------------------
                isChoose = true;
                isMain = false;

                //get from db
                dbClass db = new dbClass();
                db.addFunction("getSessionID");
                db.addValues("roomName", roomName);
                string dbReturn = db.connectToDb();

                if (dbReturn != "SUCCESS") {
                    print (dbReturn);
                }
                PlayerPrefs.SetInt("sessionID", db.getReturnValueInt("sessionID"));
                PlayerPrefs.SetString("roomName", roomName);

            }
            GUILayout.EndHorizontal ();
            GUILayout.Space (15);

            //Create a room (fails if exist!)
            GUILayout.BeginHorizontal ();
            GUILayout.Label ("Create Room:", "labelText");
            roomName = GUILayout.TextField (roomName,GUILayout.Width(Screen.width/5));
            if (GUILayout.Button ("Start",GUILayout.Width(100))) {
                PhotonNetwork.CreateRoom (roomName, true, true, 10);

                //-----------------------------------------
                //	 TOGGLE isChoose true / isMain false
                //-----------------------------------------
                isChoose = true;
                isMain = false;

                //add to db
                dbClass db = new dbClass();
                db.addFunction("sessionCreate");
                db.addValues("roomName", roomName);
                string dbReturn = db.connectToDb();

                if (dbReturn != "SUCCESS") {
                    print (dbReturn);
                }
                PlayerPrefs.SetInt("sessionID", db.getReturnValueInt("sessionID"));
                PlayerPrefs.SetString("roomName", roomName);

                //add roomID
                //GameObject gameManager = GameObject.Find("GameManager");
                //GameManagerVik vikky = gameManager.GetComponent<GameManagerVik>();
                //vikky.sessionID = db.getReturnValueInt("sessionID");
                //end add to db
            }
            GUILayout.EndHorizontal ();

            GUILayout.Space (15);

            //Join random room
        //			GUILayout.BeginHorizontal ();
        //			GUILayout.Label ("Join Random Room:", "labelText");
        //			if (PhotonNetwork.GetRoomList ().Length == 0) {
        //				GUILayout.Label ("No rooms available...");
        //			} else {
        //				if (GUILayout.Button ("Join")) {
        //					PhotonNetwork.JoinRandomRoom ();
        //				}
        //			}
        //			GUILayout.EndHorizontal ();
            GUILayout.Space (15);

            GUILayout.Space (30);
            GUILayout.Label ("Room Listing");
            GUILayout.Space (15);

            //room listing
            if (PhotonNetwork.GetRoomList ().Length == 0) {
                GUILayout.Label ("..no games available..");
            } else {
                //Room listing: simply call GetRoomList: no need to fetch/poll whatever!
                scrollPos = GUILayout.BeginScrollView (scrollPos);
                foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
                    GUILayout.BeginHorizontal ();
                    GUILayout.Label (game.name + " " + game.playerCount + "/" + game.maxPlayers,GUILayout.Width(Screen.width/5+200));
                    //join button
                    if (GUILayout.Button ("Join",GUILayout.Width(100))) {
                        PhotonNetwork.JoinRoom (game.name);

                        //-----------------------------------------
                        //	 TOGGLE isChoose true / isMain false
                        //-----------------------------------------
                        isChoose = true;
                        isMain = false;

                        //get from db
                        dbClass db = new dbClass();
                        db.addFunction("getSessionID");
                        db.addValues("roomName", game.name);
                        string dbReturn = db.connectToDb();

                        if (dbReturn != "SUCCESS") {
                            print (dbReturn);
                        }
                        PlayerPrefs.SetInt("sessionID", db.getReturnValueInt("sessionID"));
                        PlayerPrefs.SetString("roomName", game.name);
                    }
                    GUILayout.EndHorizontal ();
                }
                GUILayout.EndScrollView ();
            }

            //video playback
            GUILayout.Space (45);
            GUILayout.Label ("Watch Replay");
            GUILayout.BeginHorizontal ();
            //watch button
            if (GUILayout.Button ("Watch")) {

                //----------------------------------------------
                //	 TOGGLE isPlaybackList true / isMain false
                //----------------------------------------------
                isPlaybackList = true;
                isMain = false;

            }
            GUILayout.EndHorizontal ();

            //log out
            GUILayout.Space (45);
            GUILayout.BeginHorizontal ();
            //watch button
            if (GUILayout.Button ("Log out")) {

                //----------------------------------------------
                //	 TOGGLE isLogin true / isMain false
                //----------------------------------------------
                isMain = false;
                isLogin = true;
                PlayerPrefs.DeleteKey("playerLoginName");

            }
            GUILayout.EndHorizontal ();

            GUILayout.EndArea ();
            GUILayout.EndArea();

        }

        //--------------------------------------------------------------------------------------------------
        //				IF CHOOSING CHARACTER
        //--------------------------------------------------------------------------------------------------
        else if (isChoose)
        {
            //choose character if player not trainer
            if (!isTrainer)
            {
                // if role selection not completed, draw GUI
                GUILayout.BeginArea(new Rect((Screen.width - 600) / 2, (Screen.height - 300) / 2, 960, 600));
                GUILayout.BeginHorizontal();
                GUILayout.Label("Choose a role:", GUILayout.Width(200));

                PhotonView photonView = this.gameObject.GetPhotonView();

                for(int i =0;i<playerList.Length;i++)
                {
                    if (!selectedPlayerList.Contains(playerList[i]))
                    {
                        if(GUILayout.Button(playerList[i],GUILayout.Width(150)) )
                        {
                            PhotonNetwork.playerName = playerList[i];
                            PlayerPrefs.SetString("playerName", playerList[i]);

                            // broadcast role selected
                            photonView.RPC ("setRoleUnavailable",PhotonTargets.AllBuffered,playerList[i]);

                            //------------------------------------------
                            //	 TOGGLE isLobby true / isChoose false
                            //------------------------------------------
                            isLobby = true;
                            isChoose = false;
                        }
                    }
                }

                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }
            else
            {
                //if player trainer, do not need to go lobby or choose player; go directly to game
                PlayerPrefs.SetString("isTrainer", "true");
                Application.LoadLevel(sceneLinkage);
            }

        }

        //--------------------------------------------------------------------------------------------------
        //				IF WAITING LOBBY
        //--------------------------------------------------------------------------------------------------
        else if (isLobby)
        {
            GUILayout.BeginArea(new Rect((Screen.width - 400) / 2, (Screen.height - 300) / 2, 600, 300));

            GUILayout.Label("YOU HAVE CHOSEN: " + PhotonNetwork.playerName);
            GUILayout.Space(20);

            //wait till there are four people in the room
            if (selectedPlayerList.Count < totalPlayers && !isSkipLobby) {

                GUILayout.Label ("PLEASE WAIT TILL THERE ARE ENOUGH PLAYERS IN THE ROOM");
                GUILayout.Space (20);

                GUILayout.Label ("Number of players in the room now: " + selectedPlayerList.Count);
                GUILayout.Space (20);

                int dotNum = dotInt / 100;
                GUILayout.Label ("WAITING" + dots [dotNum]);
                dotInt++;
                if (dotInt >= 300)
                {
                    dotInt = 0;
                }

            }
            else
            {
                if(GUILayout.Button("StartGame",GUILayout.Width(100)) )
                {
                    photonView.RPC ("allStartGame", PhotonTargets.AllBuffered);
                }
            }

            GUILayout.EndArea();

            if (isStartGame)
            {
                //player not trainer
                PlayerPrefs.SetString("isTrainer", "false");
                Application.LoadLevel(sceneLinkage);
                //StartGame();
                //startGame = false;
            }

        }
    }
Beispiel #22
0
        // GET api/<controller>
        public IEnumerable <string> ManageCFind(Cfind _cfind)
        {
            dbClass dbcc = new dbClass();

            return(dbcc.getCFind(_cfind));
        }
    private void  geraMensagemSIP(XmlElement xmlMensagemSIP, string ano, string trimestre, string uf, string empresa)
    {
        XmlElement xmlMensagem = doc.CreateElement("mensagem");

        xmlMensagemSIP.AppendChild(xmlMensagem);

        string     dtTrimestre         = getTrimestre(ano, int.Parse(trimestre));
        XmlElement xmlOperadoraParaANS = doc.CreateElement("operadoraParaANS");

        xmlMensagem.AppendChild(xmlOperadoraParaANS);

        XmlElement xmlSipOperadoreParaAns = doc.CreateElement("sipOperadoraParaAns");

        xmlOperadoraParaANS.AppendChild(xmlSipOperadoreParaAns);

        XmlElement xmlEnvioSip = doc.CreateElement("envioSip");

        xmlSipOperadoreParaAns.AppendChild(xmlEnvioSip);

        XmlElement xmlDataTrimestreReconchecimento = doc.CreateElement("dataTrimestreReconhecimento");

        xmlEnvioSip.AppendChild(xmlDataTrimestreReconchecimento);


        XmlElement xmlDia = doc.CreateElement("dia");

        xmlDia.InnerText = dtTrimestre.Substring(0, 2);
        xmlDataTrimestreReconchecimento.AppendChild(xmlDia);

        XmlElement xmlMes = doc.CreateElement("mes");

        xmlMes.InnerText = dtTrimestre.Substring(3, 2);
        xmlDataTrimestreReconchecimento.AppendChild(xmlMes);

        XmlElement xmlAno = doc.CreateElement("ano");

        xmlAno.InnerText = dtTrimestre.Substring(6);
        xmlDataTrimestreReconchecimento.AppendChild(xmlAno);

        XmlElement xmlTagFormaContratacao = doc.CreateElement("formaContratacao");

        xmlEnvioSip.AppendChild(xmlTagFormaContratacao);

        dbClass db = new dbClass();

        SqlDataReader drFormContrat = db.DataReader("select distinct formaContratacao from sipXtrimestre where cd_empresa = " + empresa + " and ano = " + ano + " and trimestre = " + trimestre + " order by formaContratacao desc");

        while (drFormContrat.Read())
        {
            XmlElement xmlFormaContratacao = doc.CreateElement(drFormContrat["formaContratacao"].ToString());
            xmlTagFormaContratacao.AppendChild(xmlFormaContratacao);


            XmlElement xmlSegmentacao = doc.CreateElement("segmentacao");
            xmlFormaContratacao.AppendChild(xmlSegmentacao);

            XmlElement xmlOdontologico = doc.CreateElement("odontologico");
            xmlSegmentacao.AppendChild(xmlOdontologico);

            XmlElement xmlQuadro = doc.CreateElement("quadro");
            xmlOdontologico.AppendChild(xmlQuadro);

            // em entendimento com Gabi, ficou acordado que mandariamos a data trimestre de ocorrencia, igual data trimentes do reconhecimento
            XmlElement xmlDataTrimestreOcorrencia = doc.CreateElement("dataTrimestreOcorrencia");
            xmlQuadro.AppendChild(xmlDataTrimestreOcorrencia);

            XmlElement xmlDiaRec = doc.CreateElement("dia");
            xmlDiaRec.InnerText = dtTrimestre.Substring(0, 2);


            XmlElement xmlMesRec = doc.CreateElement("mes");
            xmlMesRec.InnerText = dtTrimestre.Substring(3, 2);

            XmlElement xmlAnoRec = doc.CreateElement("ano");
            xmlAnoRec.InnerText = dtTrimestre.Substring(6);


            xmlDataTrimestreOcorrencia.AppendChild(xmlDiaRec);
            xmlDataTrimestreOcorrencia.AppendChild(xmlMesRec);
            xmlDataTrimestreOcorrencia.AppendChild(xmlAnoRec);

            XmlElement xmlUf = doc.CreateElement("uf");
            xmlUf.InnerText = uf; // manda somente para um uf
            xmlQuadro.AppendChild(xmlUf);

            XmlElement xmlProcOdonto = doc.CreateElement("procOdonto");
            xmlQuadro.AppendChild(xmlProcOdonto);

            XmlElement xmlprocedimentosOdonto = doc.CreateElement("procedimentosOdonto");
            xmlProcOdonto.AppendChild(xmlprocedimentosOdonto);

            XmlElement xmlEventosTT       = doc.CreateElement("eventos");
            XmlElement xmlBeneficiariosTT = doc.CreateElement("beneficiarios");
            XmlElement xmlDespesasTT      = doc.CreateElement("despesas");
            xmlprocedimentosOdonto.AppendChild(xmlEventosTT);
            xmlprocedimentosOdonto.AppendChild(xmlBeneficiariosTT);
            xmlprocedimentosOdonto.AppendChild(xmlDespesasTT);


            dbClass db1 = new dbClass();


            //int ttEventos = 0;
            //int ttbenef = 0;
            //double ttDespesa = 0;



            // ta passando esse select como parametro para os subitens
            string        select = " select * from sipXtrimestre a, sip b where b.codigo = a.cd_sip and cd_empresa = " + empresa + " and ano = " + ano + " and trimestre = " + trimestre + " and uf = 'SP' and formaContratacao = '" + drFormContrat["formaContratacao"].ToString() + "'";
            SqlDataReader dr     = db1.DataReader(select + " and b.subItemDe is null  order by b.id");

            if (dr.Read())
            {
                if (dr["codigo"].ToString() == "I") // por segurança verifica se o primeiro item eh a letra I
                {
                    xmlEventosTT.InnerText       = dr["qt_evento"].ToString();
                    xmlBeneficiariosTT.InnerText = dr["qt_benef_fora_per_carencia"].ToString();
                    xmlDespesasTT.InnerText      = double.Parse(dr["tt_despesa_liq"].ToString()).ToString("F");
                }
                else
                {
                    Label1.Text = "Não há a opção I PROCEDIMENTOS ODONTOLÓGICOS";
                    return;
                }
            }


            while (dr.Read())
            {
                string     localName       = dr["tagXml"].ToString();
                XmlElement xmlProcedimento = doc.CreateElement(localName);
                xmlprocedimentosOdonto.AppendChild(xmlProcedimento);
                if (String.Compare(dr["lg_evento"].ToString(), "S") == 0)
                {
                    XmlElement xmlEventos = doc.CreateElement("eventos");
                    xmlEventos.InnerText = dr["qt_evento"].ToString();
                    xmlProcedimento.AppendChild(xmlEventos);
                }

                if (String.Compare(dr["lg_beneficiario"].ToString(), "S") == 0)
                {
                    XmlElement xmlBeneficiarios = doc.CreateElement("beneficiarios");
                    xmlBeneficiarios.InnerText = dr["qt_benef_fora_per_carencia"].ToString();
                    xmlProcedimento.AppendChild(xmlBeneficiarios);
                }


                if (String.Compare(dr["lg_despesa"].ToString(), "S") == 0)
                {
                    XmlElement xmlDespesas = doc.CreateElement("despesas");
                    xmlDespesas.InnerText = double.Parse(dr["tt_despesa_liq"].ToString()).ToString("F");
                    xmlProcedimento.AppendChild(xmlDespesas);
                }

                carregaSubItens(xmlProcedimento, select, dr["codigo"].ToString());

                // tem que ser aqui por no carregeSubItens pode estar alimentando esses dados

                /*if (xmlProcedimento.SelectSingleNode("eventos") != null)
                 * {
                 *  int qtEventos = int.Parse(xmlProcedimento.SelectSingleNode("eventos").InnerText);
                 *  ttEventos += qtEventos;
                 * }
                 *
                 * if (xmlProcedimento.SelectSingleNode("beneficiarios") != null)
                 * {
                 *  int qtBenef = int.Parse(xmlProcedimento.SelectSingleNode("beneficiarios").InnerText);
                 *  ttbenef += qtBenef;
                 * }
                 *
                 * if (xmlProcedimento.SelectSingleNode("despesas") != null)
                 * {
                 *  double vrDesp = double.Parse(xmlProcedimento.SelectSingleNode("despesas").InnerText);
                 *  ttDespesa += vrDesp;
                 * }*/
            }
            // xmlprocedimentosOdonto.SelectSingleNode("eventos").InnerText = ttEventos.ToString();
            // xmlprocedimentosOdonto.SelectSingleNode("beneficiarios").InnerText = ttbenef.ToString();
            // xmlprocedimentosOdonto.SelectSingleNode("despesas").InnerText = ttDespesa.ToString("F");


            dr.Close();
            db1.closeConn();
        }
        drFormContrat.Close();
        db.closeConn();
    }
        public ActionResult Details(int id)
        {
            dbClass sdb = new dbClass();

            return(View(sdb.viewMember().Find(smodel => smodel.Id == id)));
        }
Beispiel #25
0
    void SendChatMessage(string text, PhotonMessageInfo info)
    {
        switch(info.sender.ToString())
        {
        case "Sales Manager":

            textColor = Color.yellow;
            break;
        case "LPU Manager":

            textColor = Color.blue;
            break;
        case "LPU Officer":

            textColor = Color.cyan;
            break;
        case "Credit Risk":

            textColor = Color.red;
            break;
        default:
            break;

        }

        AddMessage("[" + info.sender + "] " + text,textColor);

        //get roomID & playerName
        GameObject gameManager = GameObject.Find("GameManager");
        GameManagerVik vikky = gameManager.GetComponent<GameManagerVik>();
        string sessionID = vikky.sessionID.ToString ();
        string playerName = vikky.loginName;
        string playerRole = PlayerPrefs.GetString("playerName");

        //add to db
        dbClass db = new dbClass();
        db.addFunction("addChatLog");
        db.addValues("playerName", playerName);
        db.addValues("playerRole", playerRole);
        db.addValues("sessionID", sessionID);
        db.addValues("chatString", text);
        string dbReturn = db.connectToDb();

        if (dbReturn != "SUCCESS NO RETURN") {
            print (dbReturn);
        }
    }
    private void  geraMensagemSIP(XmlElement xmlMensagemSIP, string ano, string trimestre, string uf, string empresa)
    {
        XmlElement xmlMensagem = doc.CreateElement(xmlPrefix, "mensagem", nmUrl);

        xmlMensagemSIP.AppendChild(xmlMensagem);

        string     dtTrimestre         = getTrimestre(ano, int.Parse(trimestre));
        XmlElement xmlOperadoraParaANS = doc.CreateElement(xmlPrefix, "operadoraParaANS", nmUrl);

        xmlMensagem.AppendChild(xmlOperadoraParaANS);

        XmlElement xmlSipOperadoreParaAns = doc.CreateElement(xmlPrefix, "sipOperadoraParaAns", nmUrl);

        xmlOperadoraParaANS.AppendChild(xmlSipOperadoreParaAns);

        XmlElement xmlEnvioSip = doc.CreateElement(xmlPrefix, "envioSip", nmUrl);

        xmlSipOperadoreParaAns.AppendChild(xmlEnvioSip);

        XmlElement xmlDataTrimestreReconchecimento = doc.CreateElement(xmlPrefix, "dataTrimestreReconhecimento", nmUrl);

        xmlEnvioSip.AppendChild(xmlDataTrimestreReconchecimento);


        XmlElement xmlDia = doc.CreateElement(xmlPrefix, "dia", nmUrl);

        xmlDia.InnerText = dtTrimestre.Substring(0, 2);
        xmlDataTrimestreReconchecimento.AppendChild(xmlDia);

        XmlElement xmlMes = doc.CreateElement(xmlPrefix, "mes", nmUrl);

        xmlMes.InnerText = dtTrimestre.Substring(3, 2);
        xmlDataTrimestreReconchecimento.AppendChild(xmlMes);

        XmlElement xmlAno = doc.CreateElement(xmlPrefix, "ano", nmUrl);

        xmlAno.InnerText = dtTrimestre.Substring(6);
        xmlDataTrimestreReconchecimento.AppendChild(xmlAno);

        dbClass db = new dbClass();

        SqlDataReader drFormContrat = db.DataReader("select distinct formaContratacao from sipXtrimestre where cd_empresa = " + empresa + " and ano = " + ano + " and trimestre = " + trimestre);

        while (drFormContrat.Read())
        {
            XmlElement xmlFormaContratacao = doc.CreateElement(xmlPrefix, drFormContrat["formaContratacao"].ToString(), nmUrl);
            xmlEnvioSip.AppendChild(xmlFormaContratacao);

            XmlElement xmlIndividualFamiliar = doc.CreateElement(xmlPrefix, "individualFamiliar", nmUrl);
            xmlFormaContratacao.AppendChild(xmlIndividualFamiliar);

            XmlElement xmlSegmentacao = doc.CreateElement(xmlPrefix, "segmentacao", nmUrl);
            xmlIndividualFamiliar.AppendChild(xmlSegmentacao);

            XmlElement xmlOdontologico = doc.CreateElement(xmlPrefix, "odontologico", nmUrl);
            xmlSegmentacao.AppendChild(xmlOdontologico);

            XmlElement xmlQuadro = doc.CreateElement(xmlPrefix, "quadro", nmUrl);
            xmlOdontologico.AppendChild(xmlQuadro);

            // em entendimento com Gabi, ficou acordado que mandariamos a data trimestre de ocorrencia, igual data trimentes do reconhecimento
            XmlElement xmlDataTrimestreOcorrencia = doc.CreateElement(xmlPrefix, "dataTrimestreOcorrencia", nmUrl);
            xmlQuadro.AppendChild(xmlDataTrimestreOcorrencia);

            xmlDataTrimestreOcorrencia.AppendChild(xmlDia);
            xmlDataTrimestreOcorrencia.AppendChild(xmlMes);
            xmlDataTrimestreOcorrencia.AppendChild(xmlAno);

            XmlElement xmlUf = doc.CreateElement(xmlPrefix, "uf", nmUrl);
            xmlUf.InnerText = uf; // manda somente para um uf
            xmlQuadro.AppendChild(xmlUf);

            XmlElement xmlProcOdonto = doc.CreateElement(xmlPrefix, "procOdonto", nmUrl);
            xmlQuadro.AppendChild(xmlProcOdonto);
            dbClass       db1 = new dbClass();
            SqlDataReader dr  = db1.DataReader("select * from sipXtrimestre a, sip b where b.codigo = a.cd_sip and cd_empresa = " + empresa + " and ano = " + ano + " and trimestre = " + trimestre + " and uf = 'SP' and formaContratacao = '" + drFormContrat["formaContratacao"].ToString() + "' order by b.id");


            while (dr.Read())
            {
                //preencher a tabela sip o nome das tabas
                //  criar campo na tabela sip para ordernar conforme schema
                XmlElement xmlEventos       = doc.CreateElement(xmlPrefix, "eventos", nmUrl);
                XmlElement xmlBeneficiarios = doc.CreateElement(xmlPrefix, "benenficiarios", nmUrl);
                XmlElement xmlDespesas      = doc.CreateElement(xmlPrefix, "despesas", nmUrl);

                string     localName       = dr["tagXml"].ToString();
                XmlElement xmlProcedimento = doc.CreateElement(xmlPrefix, localName, nmUrl);
                xmlProcOdonto.AppendChild(xmlProcedimento);
                xmlEventos.InnerText       = dr["qt_evento"].ToString();
                xmlBeneficiarios.InnerText = dr["qt_benef_fora_per_carencia"].ToString();
                xmlDespesas.InnerText      = double.Parse(dr["tt_despesa_liq"].ToString()).ToString("F");

                xmlProcedimento.AppendChild(xmlEventos);
                xmlProcedimento.AppendChild(xmlBeneficiarios);
                xmlProcedimento.AppendChild(xmlDespesas);
            }
            dr.Close();
            db1.closeConn();
        }
        drFormContrat.Close();
        db.closeConn();
    }
Beispiel #27
0
    /*}

    'esta sirve para cuando solo tenemos un campo, no dos,
    'el campo id se va rellenando con incrementos
    void comboRellenarConIdAuto(ByRef combo As System.Web.UI.WebControls.DropDownList, ByVal textoSql As String, ByVal cadenaConexion As String, ByVal campoClave As String, Optional ByVal mensajeInicial As String = "")

        ' Rellena la lista que me pasan con la select pasada
        ' pillo el primer campo que me pasan en la select para el campo texto
        ' pillo el segundo campo que me pasan en la select para el el campo value me pasan el campo a almacenar
        Dim contador As New Integer
        If cadenaConexion = "" Then cadenaConexion = ctes.conStringAdoGeneral
        Dim pp As New dbClass(cadenaConexion)
        Dim reg As System.Data.Odbc.OdbcDataReader
        'Object 'SqlClient.SqlDataReader

        Try
            If mensajeInicial <> "" Then
                Dim per As New ListItem
                per.Value = 0
                per.Text = mensajeInicial
                combo.Items.Insert(0, per)
                per = Nothing
            End If

            contador += 1
            reg = pp.sql(textoSql)
            Do While reg.Read()
                Dim per As New ListItem
                per.Value = contador
                per.Text = reg(campoClave).ToString
                combo.Items.Add(per)
                per = Nothing
                contador += 1
            Loop

        Catch ex As Exception
        Finally
            pp.dispose()
        End Try

    }
    #End Region

    */
    public static void rellenarComboDB(ref System.Web.UI.WebControls.DropDownList tmpList, string textoSql, string connectionString)
    {
        // Rellena el combobox que me pasan con la select pasada

        // pillo el segundo campo que me pasan en la select para el campo texto

        // pillo el primer campo que me pasan en la select para el el campo value me pasan el campo a almacenar

        // version cambiada para que tire de dataset en vez de datareader

        tmpList.Items.Clear();

        dbClass pp = new dbClass(connectionString);

        try
        {

            DataSet ds = new DataSet();

            ds = pp.sqlDataset(textoSql);

            tmpList.DataSource = ds.Tables[0].DefaultView;

            tmpList.DataTextField = ds.Tables[0].Columns[1].ToString();

            tmpList.DataValueField = ds.Tables[0].Columns[0].ToString();

            tmpList.DataBind();

            ListItem per = new ListItem();

            per.Value = "0";

            per.Text = "Todos --";

            tmpList.Items.Insert(0, per);
            //(0, "Todos")

            ds = null;
        }

        catch (Exception ex)
        {
        }

        finally
        {

            pp.Dispose();

        }
    }
    protected void cboItemAssit_SelectedIndexChanged(object sender, EventArgs e)
    {
        dbClass       db = new dbClass();
        SqlDataReader dr = db.DataReader("select * from sipXtrimestre where cd_empresa = " + cboEmpresa.SelectedValue + " and ano = " + txtAno.Text + " and trimestre = " + cboTrimestre.SelectedValue + " and uf = '" + txtUF.Text + "' and formaContratacao = '" + cboFormacontrat.SelectedValue + "' and cd_sip = '" + cboItemAssit.SelectedValue + "'");

        if (dr.Read())
        {
            txtQtBenefCarencia.Text = dr["qt_benef_fora_per_carencia"].ToString();
            txtQtEventos.Text       = dr["qt_evento"].ToString();
            txtTtDespLiq.Text       = dr["tt_despesa_liq"].ToString();
            Session["op"]           = "A";
        }
        else
        {
            txtQtBenefCarencia.Text = "";
            txtQtEventos.Text       = "";
            txtTtDespLiq.Text       = "";
            Session["op"]           = "I";
        }
        txtQtEventos.Focus();
        dr.Close();
        db.closeConn();
        dr = db.DataReader("select * from sip where codigo = '" + cboItemAssit.SelectedValue + "'");
        if (dr.Read())
        {
            if (String.Compare(dr["lg_evento"].ToString(), "N") == 0)
            {
                txtQtEventos.Enabled   = false;
                txtQtEventos.Text      = "";
                txtQtEventos.BackColor = System.Drawing.Color.Gray;
            }
            else
            {
                txtQtEventos.Enabled   = true;
                txtQtEventos.BackColor = System.Drawing.Color.White;
            }

            if (String.Compare(dr["lg_beneficiario"].ToString(), "N") == 0)
            {
                txtQtBenefCarencia.Enabled   = false;
                txtQtBenefCarencia.Text      = "";
                txtQtBenefCarencia.BackColor = System.Drawing.Color.Gray;
            }
            else
            {
                txtQtBenefCarencia.Enabled   = true;
                txtQtBenefCarencia.BackColor = System.Drawing.Color.White;
            }
            if (String.Compare(dr["lg_despesa"].ToString(), "N") == 0)
            {
                txtTtDespLiq.Enabled   = false;
                txtTtDespLiq.Text      = "";
                txtTtDespLiq.BackColor = System.Drawing.Color.Gray;
            }
            else
            {
                txtTtDespLiq.Enabled   = true;
                txtTtDespLiq.BackColor = System.Drawing.Color.White;
            }
        }
        dr.Close();
        db.closeConn();
    }
Beispiel #29
0
    //yield the saving of binary files
    IEnumerator WaitForConnect()
    {
        yield return new WaitForSeconds(1);

        //-----------------------------------------------------------------------------------------------------
        //					create room
        //-----------------------------------------------------------------------------------------------------
        PhotonNetwork.CreateRoom (roomName, true, true, 10);
        //PhotonNetwork.JoinRoom (roomName);

        //Debug.Log (PhotonNetwork.countOfPlayersOnMaster);
        //Debug.Log (PhotonNetwork.countOfRooms);
        //	Debug.Log (PhotonNetwork.countOfPlayersInRooms);
        //Debug.Log (PhotonNetwork.playerName);

        PhotonNetwork.playerName = characterName;
        //PlayerPrefs.SetString("playerName", playerList[i]);

        // broadcast role selected
        photonView.RPC ("setRoleUnavailable",PhotonTargets.AllBuffered,characterName);

        //add to db
        dbClass db = new dbClass();
        db.addFunction("sessionCreate");
        db.addValues("roomName", roomName);
        string dbReturn = db.connectToDb();

        if (dbReturn != "SUCCESS") {
            print (dbReturn);
        }
        sessionID =  db.getReturnValueInt("sessionID");

        yield return new WaitForSeconds(1);
        startGame();
    }