Inheritance: MonoBehaviour
    private void StartGameLoop()
    {

        cs = GameObject.Find("ClientScript").GetComponentInChildren<ClientScript>();
        //WWW results = cs.GET("http://answers.unity3d.com/questions/208309/get-request-wrapper.html");
        // Debug.Log(results.text);
        //depending on the data we are polling, we will be making different get requests

        //  var N = JSON.Parse(results.text);

        //two get requests -> one to request for new names to sacrifice and one for a status check and confirmation to the server
        Debug.Log("Starting TCP socket connection");
        cs.socketInit();
        // cs.writeSocket("test!");

            String str = cs.readSocket();
            while (str == null)
            {
                Debug.Log("str is null");
                str = cs.readSocket();
            }
            Debug.Log(str);
        
        cs.closeSocket();
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        CreateAlert(AlertType.DEBUT);
        audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>();
        audioManager.ChangeMusic(1);
        //GameObject.FindGameObjectWithTag("Canvas").GetComponent<CanvasScript>().SetInGameMode();
        gameInfos = GameObject.FindGameObjectWithTag("GameInfos").GetComponent<GameInfosScript>();
        client = GameObject.FindGameObjectWithTag("Client").GetComponent<ClientScript>();
        client.gameManager = this;
        complex.InitializeComplex(gameInfos.gridCode, gameInfos.players, gameInfos.nbJoueursTotal);
        actualPlayer = complex.players[gameInfos.idJoueur];
        LoadEvents();
        log = GameObject.FindGameObjectWithTag("Log").GetComponent<LogScript>();

       
        log.transform.SetParent(logPanel.transform);
        

        if (gameInfos.players[gameInfos.idJoueur].Role == Role.GUARDIAN)
            revealGuardianButton.gameObject.SetActive(true);
        else
            revealGuardianButton.gameObject.SetActive(false);
        WaitForFirstRoomToLookDirection(1, 1, 1, 1);
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Document doc  = new Document();
        string   path = Server.MapPath("PDFs");

        PdfWriter.GetInstance(doc, new FileStream(path + "/jobsheet.pdf", FileMode.Create));
        doc.Open();

        Table table = new Table(4);

        table.TableFitsPage     = true;
        table.CellsFitPage      = true;
        table.BorderWidthBottom = 1;
        table.BorderWidthLeft   = 1;
        table.BorderWidthRight  = 1;
        table.BorderWidthTop    = 1;

        table.BorderColor = Color.BLACK;
        table.Cellpadding = 2;
        table.Cellspacing = 2;

        Cell cell = new Cell("NEW PROJECT DETAILS"); cell.Header = true;

        cell.SetHorizontalAlignment("Center");
        cell.Colspan = 4;
        table.AddCell(cell);

        cell = new Cell("JOB DETAILS"); cell.Header = true;
        cell.BackgroundColor = Color.GRAY;
        cell.SetHorizontalAlignment("Center");
        cell.Colspan = 4;
        table.AddCell(cell);
        // row 2
        //cell = new Cell("Job Status");
        //cell.BackgroundColor = Color.LIGHT_GRAY;
        //table.AddCell(cell);
        // row 3
        cell = new Cell("Job Code");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtJobCode.Text);
        table.AddCell(cell);

        cell = new Cell("Job No");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtJobNo.Text);
        table.AddCell(cell);

        // row 4
        cell         = new Cell("Job Details");
        cell.Colspan = 2;
        cell.SetHorizontalAlignment("Center");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);



        cell = new Cell("for");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(Txtfor.Text);
        table.AddCell(cell);

        // row 6
        cell         = new Cell(TxtDetails.Text);
        cell.Colspan = 4;
        table.AddCell(cell);

        // row 7
        cell = new Cell("Client Details");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        cell.Header          = true;
        cell.SetHorizontalAlignment("Center");
        cell.Colspan = 2;
        table.AddCell(cell);



        cell = new Cell("Ref");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtRef.Text);
        table.AddCell(cell);

        // row 6

        cell = new Cell("Client");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtClient.Text);

        table.AddCell(cell);

        cell = new Cell("Order No");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtOrderNo.Text);
        table.AddCell(cell);

        // row 7

        cell = new Cell("Contact");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtContact.Text);
        table.AddCell(cell);

        cell = new Cell("Invoice Contact");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtInvoiceContact.Text);
        table.AddCell(cell);

        //row8
        cell = new Cell("Address");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(true);
        table.AddCell(cell);

        cell = new Cell("Invoice Address");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(true);
        table.AddCell(cell);

        // row 9
        cell         = new Cell(TxtAddress.Text);
        cell.Colspan = 2;
        table.AddCell(cell);

        cell         = new Cell(TxtInvoiceAddress.Text);
        cell.Colspan = 2;
        table.AddCell(cell);

        // row 10

        cell = new Cell("Tel");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtTel.Text);
        table.AddCell(cell);

        cell = new Cell("Tel");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtInvoiceTel.Text);
        table.AddCell(cell);

        // row 11
        cell = new Cell("Fax");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtFax.Text);
        table.AddCell(cell);

        cell = new Cell("Fax");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtInvoiceFax.Text);
        table.AddCell(cell);

        // row 12

        cell = new Cell("CONTRACT/ORDER DETAILS");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        cell.Colspan         = 4;
        cell.SetHorizontalAlignment("Center");
        cell.Header = true;
        table.AddCell(cell);

        //row 13
        cell = new Cell("Estimated Hours");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtHours.Text);
        table.AddCell(cell);

        cell = new Cell("Estimated Completion Date or Final Invoice Date");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtCompletionDate.Text);
        table.AddCell(cell);

        //row 14
        cell = new Cell("Estimated Fee/OrderValue");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtOrderValue.Text);
        table.AddCell(cell);

        cell = new Cell(true);
        table.AddCell(cell);
        cell = new Cell(true);
        table.AddCell(cell);

        //row 15
        cell = new Cell("Variation Orders");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        cell.Colspan         = 4;
        cell.SetHorizontalAlignment("Center");
        table.AddCell(cell);

        //row 16
        cell         = new Cell(TxtVariationOrders.Text);
        cell.Colspan = 4;
        table.AddCell(cell);

        // row 17

        cell = new Cell("Project Manager");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtManager.Text);
        table.AddCell(cell);

        cell = new Cell("Director");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);

        cell = new Cell(TxtDirector.Text);
        table.AddCell(cell);

        // row 18

        cell         = new Cell(true);
        cell.Colspan = 2;
        table.AddCell(cell);


        cell = new Cell("Date");
        cell.BackgroundColor = Color.LIGHT_GRAY;
        table.AddCell(cell);
        cell = new Cell(TxtDate.Text);
        table.AddCell(cell);

        try
        {
            doc.Add(table);
        }
        catch (Exception ex)
        {
            //Display parser errors in PDF.
            //Parser errors will also be wisible in Debug.Output window in VS
            Paragraph paragraph = new Paragraph("Error! " + ex.Message);
            paragraph.SetAlignment("center");
            Chunk text = paragraph.Chunks[0] as Chunk;

            if (text != null)
            {
                text.Font.Color = Color.RED;
            }
            doc.Add(paragraph);
        }
        finally
        {
            doc.Close();
            //Response.ContentType = "application/pdf";
            //Response.Redirect("PDFs/jobsheet.pdf");
            //Response.End();
            //ClientScriptManager cs = this.ClientScriptManager();
            ClientScript.RegisterClientScriptBlock(this.GetType(), "OpenPDF", "window.open('PDFs/Jobsheet.pdf','_blank');", true);
        }
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        startTimer = false;

        menuObject = GameObject.FindGameObjectWithTag("Menus");
        menu = menuObject.GetComponent<GameOverScript>();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        score1Panel = GameObject.Find("Score 1 Panel");
        score2Panel = GameObject.Find("Score 2 Panel");
        score3Panel = GameObject.Find("Score 3 Panel");
        score4Panel = GameObject.Find("Score 4 Panel");

        temp1.Set(0, 6, 0);

        timeText.transform.position = temp1;

        if (clientManager.getNumberOfPlayers() == "2")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);

            score1Pos.Set(-3, 7, 0);
            score2Pos.Set(3, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
        }
        else if (clientManager.getNumberOfPlayers() == "3")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);
            score3Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 3 PANEL: X = " + score3Panel.transform.position.x + " Y = " + score3Panel.transform.position.y);

            score1Pos.Set(-5, 7, 0);
            score2Pos.Set(0, 7, 0);
            score3Pos.Set(5, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
            score3Panel.transform.position = score3Pos;
        }
        else if (clientManager.getNumberOfPlayers() == "4")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);
            score3Panel.SetActive(true);
            score4Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 3 PANEL: X = " + score3Panel.transform.position.x + " Y = " + score3Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 4 PANEL: X = " + score4Panel.transform.position.x + " Y = " + score4Panel.transform.position.y);

            score1Pos.Set(-7, 7, 0);
            score2Pos.Set(-2, 7, 0);
            score3Pos.Set(2, 7, 0);
            score4Pos.Set(7, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
            score3Panel.transform.position = score3Pos;
            score4Panel.transform.position = score4Pos;
        }
    }
Esempio n. 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //if (lblDate.Text == "" || lblLister.Text == "" || txtSKU.Text == "" || txtsourcelink.Text == "" || txtsource.Text == "" ||
            //    txtprice.Text == "" || txtshippingcost.Text == "" || DropDownList1.Text == "" ||
            //    txtqty.Text == "" || txthandling.Text == "" || txtamzprodname.Text == "" || txtbrand.Text == "" || txtASIN.Text == "" ||
            //    DropDownList3.Text == "" || DropDownList2.Text == "" || txtamzprice.Text == "" || txtsalesrank.Text == "")
            //{
            //    if (txtsourcelink.Text == "")
            //    {
            //        lblSave.Text = "Please input source link!";
            //    }
            //    if (txtprice.Text == "")
            //    {
            //        lblSave.Text = "Please input source price!";
            //    }
            //    //if (txtshippingcost.Text == "")
            //    //{
            //    //    lblSave.Text = "Please input shipping cost!";
            //    //}
            //    if (DropDownList1.Text == "")
            //    {
            //        lblSave.Text = "Please select shipping type!";
            //    }
            //    //if (txtvariant.Text == "")
            //    //{
            //    //    lblSave.Text = "Please input source link!";
            //    //}
            //    if (txtqty.Text == "")
            //    {
            //        lblSave.Text = "Please input quantity!";
            //    }
            //    if (txthandling.Text == "")
            //    {
            //        lblSave.Text = "Please select date of delivery!";
            //    }
            //    if (txtamzprodname.Text == "")
            //    {
            //        lblSave.Text = "Please input amazon product name!";
            //    }
            //    if (txtbrand.Text == "")
            //    {
            //        lblSave.Text = "Please input brand name!";
            //    }
            //    if (txtASIN.Text == "")
            //    {
            //        lblSave.Text = "Please input ASIN!";
            //    }
            //    if (DropDownList3.Text == "")
            //    {
            //        lblSave.Text = "Please select type of seller!";
            //    }
            //    if (DropDownList2.Text == "")
            //    {
            //        lblSave.Text = "Please select position!";
            //    }
            //    if (txtamzprice.Text == "")
            //    {
            //        lblSave.Text = "Please input amazon price!";
            //    }
            //    if (txtsalesrank.Text == "")
            //    {
            //        lblSave.Text = "Please input sales rank!";
            //    }

            //    //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Record Saved" + "');", true);
            //}
            //else
            //{


            using (SqlConnection sqlCon = new SqlConnection(@"Data Source=localhost; Initial Catalog=PLTrading; Integrated Security = True;"))
            {
                sqlCon.Open();

                string     queryCheck = "SELECT count(*) FROM dbo.[Amazon_Listings] WHERE ASIN = @asin";
                SqlCommand sqlCmd1    = new SqlCommand(queryCheck, sqlCon);
                sqlCmd1.Parameters.AddWithValue("@asin", txtASIN.Text.Trim());
                int count = Convert.ToInt32(sqlCmd1.ExecuteScalar());
                if (count == 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "ASIN ALREADY EXIST" + "');", true);
                    //Session["username"] = txtUserName.Text.Trim();
                    //Session["password"] = txtPassword.Text.Trim();
                    //Response.Redirect("Dashboard.aspx");
                }
                else
                //else { lblErrMsg1.Visible = true; }
                {
                    string query = "INSERT INTO dbo.[Amazon_Listings] (list_date, lister, sku, source_link, source, source_price, shipping_cost, " +
                                   "shipping, vendor_variant, qty, handling_time, amz_prod_name, amz_brand, ASIN, amz_type, amz_position, amz_price, " +
                                   "amz_sales_rank, profit, profit_margin, roi, profit_wotax, profit_margin_wotax, roi_wotax, source_price_tax, total_cost," +
                                   "min_list_price, bsr, bsr_category, date_created) VALUES (@list_date,@lister,@sku,@sourcelink,@source,@source_price," +
                                   "@shipping_cost,@shipping,@vendor_variant,@qty,@handling_time,@amz_prod_name,@amz_brand,@ASIN,@amz_type,@amz_position,@amz_price,@amz_sales_rank,@profit," +
                                   "@profit_margin,@roi,@profit_wotax,@profit_margin_wotax,@roi_wotax,@source_price_tax,@total_cost,@min_list_price,@bsr,@bsr_category,@date_created)";

                    SqlCommand sqlCmd = new SqlCommand(query, sqlCon);
                    sqlCmd.Parameters.AddWithValue("@list_date", lblDate.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@lister", lblLister.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@sku", txtSKU.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@sourcelink", txtsourcelink.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@source", txtsource.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@source_price", Convert.ToDouble(txtprice.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@shipping_cost", Convert.ToDouble(txtshippingcost.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@shipping", DropDownList1.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@vendor_variant", txtvariant.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@qty", txtqty.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@handling_time", txthandling.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@amz_prod_name", txtamzprodname.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@amz_brand", txtbrand.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@ASIN", txtASIN.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@amz_type", DropDownList3.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@amz_position", DropDownList2.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@amz_price", Convert.ToDouble(txtamzprice.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@amz_sales_rank", txtsalesrank.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@profit", Convert.ToDouble(txtprofit.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@profit_margin", txtprofitmargin.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@roi", txtroi.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@profit_wotax", Convert.ToDouble(txtprofitwotax.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@profit_margin_wotax", txtprofitmarginwotax.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@roi_wotax", txtroiwotax.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@source_price_tax", Convert.ToDouble(txtsourceprice.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@total_cost", Convert.ToDouble(txttotalcost.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@min_list_price", Convert.ToDouble(txtminlist.Text.Trim()));
                    sqlCmd.Parameters.AddWithValue("@bsr", txtsalesrank.Text.Trim());
                    sqlCmd.Parameters.AddWithValue("@bsr_category", txtsalesrank.Text.Trim());
                    DateTime     timeUtc = DateTime.UtcNow;
                    TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
                    DateTime     cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
                    sqlCmd.Parameters.AddWithValue("@date_created", cstTime.ToString());

                    sqlCmd.ExecuteNonQuery();
                    lblSave.Text = "Record Saved!";
                }
            }
            //}
        }
Esempio n. 6
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string max = "";

        using (SqlConnection sqlcnn = new SqlConnection(sqlstr))
        {
            using (SqlCommand sqlcmm = sqlcnn.CreateCommand())
            {
                sqlcmm.CommandText = "select max(ID) as ID1 from MSAS_Department";
                sqlcmm.Parameters.AddWithValue("@MSAS_Title", this.txtName.Text);
                sqlcnn.Open();
                SqlDataAdapter adapter = new SqlDataAdapter(sqlcmm);
                DataTable      dt      = new DataTable();
                adapter.Fill(dt);
                if (dt.Rows[0][0].ToString() != "")
                {
                    max = dt.Rows[0][0].ToString();
                }
                else
                {
                    max = DateTime.Now.Year + "0000";
                }
            }
        }

        int    startNum    = Convert.ToInt32(max.Substring(4, 4)) + 1;
        string startString = null;

        if (startNum < 10)
        {
            startString = "000" + startNum;
        }
        else if (startNum >= 10 && startNum < 100)
        {
            startString = "00" + startNum;
        }
        else
        {
            startString = startNum.ToString();
        }
        string endString = DateTime.Now.Year + startString;
        int    num       = Convert.ToInt32(endString);

        using (SqlConnection sqlcnn = new SqlConnection(sqlstr))
        {
            using (SqlCommand sqlcmm = sqlcnn.CreateCommand())
            {
                sqlcmm.CommandText = "insert into MSAS_Department(Department,ID)values(@title,@ID)";
                sqlcmm.Parameters.AddWithValue("@title", this.txtName.Text);
                sqlcmm.Parameters.AddWithValue("@ID", num);
                sqlcnn.Open();
                int i = sqlcmm.ExecuteNonQuery();
                if (i > 0)
                {
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('success');</script>");
                    txtName.Text = "";
                    GetData();
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('faild');</script>");
                }
            }
        }
    }//向数据库添加数据
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Session"] != null)
     {
         if (!IsPostBack)
         {
             string   hmedico     = (string)this.Session["hmedico"];
             string   tipousuario = (string)this.Session["tipousuario"];
             DateTime dt          = DateTime.Now;
             int      d           = dt.Day;
             int      m           = dt.Month;
             int      y           = dt.Year;
             string   dia;
             string   mes;
             if (d < 10)
             {
                 dia = "0" + Convert.ToString(d);
             }
             else
             {
                 dia = Convert.ToString(d);
             }
             if (m < 10)
             {
                 mes = "0" + Convert.ToString(m);
             }
             else
             {
                 mes = Convert.ToString(m);
             }
             string fecha = y + "-" + mes + "-" + dia;
             vfecha.Value = fecha;
             DBConnect conexion = new DBConnect();
             vhdocumento.Value = Server.HtmlEncode(Request.QueryString["iddoc"]);
             vhpaciente.Value  = Server.HtmlEncode(Request.QueryString["idpac"]);
             ta.Text           = Server.HtmlEncode(Request.QueryString["ta"]);;
             fc.Text           = Server.HtmlEncode(Request.QueryString["fc"]);;
             fr.Text           = Server.HtmlEncode(Request.QueryString["fr"]);;
             peso.Text         = Server.HtmlEncode(Request.QueryString["peso"]);;
             talla.Text        = Server.HtmlEncode(Request.QueryString["talla"]);;
             temperatura.Text  = Server.HtmlEncode(Request.QueryString["temperatura"]);;
             aspecto.Text      = Server.HtmlEncode(Request.QueryString["aspecto"]);;
             string modal9 = "showPopWin('DatosPaciente.aspx?hpaciente=" + vhpaciente.Value + "', 800, 400);";
             Button2.Attributes.Add("onclick", modal9);
             DataTable paciente = new DataTable();
             paciente = conexion.Spaciente(vhpaciente.Value);
             string strhistoria = "";
             string strnombre   = "";
             string stredad     = "";
             string strsexo     = "";
             string strcedula   = "";
             for (int i = 0; i < paciente.Rows.Count; i++)
             {
                 strhistoria = paciente.Rows[i]["historia"].ToString();
                 strnombre   = paciente.Rows[i]["nombre"].ToString();
                 stredad     = paciente.Rows[i]["edad"].ToString();
                 strsexo     = paciente.Rows[i]["sexo"].ToString();
                 strcedula   = paciente.Rows[i]["cedula"].ToString();
             }
             historia.Text = strhistoria;
             nombre.Text   = strnombre;
             edad.Text     = stredad;
             sexo.Text     = strsexo;
             cedula.Text   = strcedula;
         }
     }
     else
     {
         string devuelveFecha = "<script language='JavaScript'>" +
                                "window.document.forms[0].target = '_parent'; window.document.forms[0].action = '../salida.aspx';" +
                                "window.document.forms[0].submit(); </script>";
         ClientScript.RegisterStartupScript(this.GetType(), "CambiaTarget", devuelveFecha);
     }
 }
Esempio n. 8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Feedback feedback = new Feedback();
                Events events = new Events();
                Users userS = (Users)Session["user"];

                string errorMsg = string.Empty;
                int eventId = Convert.ToInt32(Request.QueryString["eventId"]);
                //int userId = events.getEventDetails(eventId).User_id;          //  andy why u store the user id of the event organiser instead of the
                int userId = userS.id;                                           //  user id of the user who completed the feedback into the feedback
                string Q1Ratings = Q1Rating.CurrentRating.ToString();
                string Q2Ratings = Q2Rating.CurrentRating.ToString();
                string Q3Ratings = Q3Rating.CurrentRating.ToString();
                string Q4Ratings = Q4Rating.CurrentRating.ToString();
                int avgRating = 96;
                string FeedbackContent = tbFeedbackContent.Text;

                if (Q1Rating.CurrentRating.ToString() == "0")
                {
                    errorMsg += "Not all questions are rated ,";

                }
                else if (Q2Rating.CurrentRating.ToString() == "0")
                {
                    errorMsg += "Not all questions are rated ,";
                }
                else if (Q3Rating.CurrentRating.ToString() == "0")
                {
                    errorMsg += "Not all questions are rated ,";
                }
                else if (Q4Rating.CurrentRating.ToString() == "0")
                {
                    errorMsg += "Not all questions are rated ,";
                }


                //avgRating = (Int32.Parse("Q1Ratings") + Int32.Parse("Q2Ratings") + Int32.Parse("Q3Ratings") + Int32.Parse("Q4Ratings")) / 4;

                avgRating = (Convert.ToInt32(Q1Ratings) + Convert.ToInt32(Q2Ratings) + Convert.ToInt32(Q3Ratings) + Convert.ToInt32(Q4Ratings)) / 4;


                if (string.IsNullOrEmpty(tbFeedbackContent.Text))
                {
                    errorMsg += "Review field is empty";
                    tbFeedbackContent.Focus();
                }





                if (!string.IsNullOrEmpty(errorMsg))
                {
                    throw new Exception(errorMsg.TrimEnd(','));
                }
                else
                {
                    feedback = new Feedback(eventId, userId, avgRating, FeedbackContent, 1);
                    Attendance attendance = new Attendance();
                    Users user = (Users)Session["user"];
                    Users usr = new Users();
                    Events ev = new Events();

                    // I am using User session as the user id; diff from upstairs where i use from event detail;


                    int result = feedback.createFeedback();

                    if (result == 1)
                    {

                        // update user who gave feedback the points
                        usr.UpdatePointsByID(user.id, 1);
                        
                        //update 1 to Feedback in Attendance table by Event Id
                        attendance.UpdateFeedbackByUserIdEventId(user.id, eventId, 1);


                        //calculate avg points for the event
                        allFeedbackListByEventId = feedback.getAllFeedbacksByEventId(eventId);

                        int totalAvgRatings = 0;
                        int totalAvgRatingByEvent = 0;

                        for (int i = 0; i < allFeedbackListByEventId.Count; i++)
                        {
                            totalAvgRatings += allFeedbackListByEventId[i].AvgRating;
                        }

                        totalAvgRatingByEvent = totalAvgRatings / allFeedbackListByEventId.Count();

                        ev.updateAvgRatingByEventId(eventId, totalAvgRatingByEvent);


                        // update organiser points
                        int organiserUserId = ev.getEventDetails(eventId).User_id;

                        if (ev.getEventDetails(eventId).AverageRating > 2)
                        {
                            usr.UpdatePointsByID(organiserUserId, 2);
                        }
                        else
                        {
                            usr.UpdatePointsByID(organiserUserId, 1);
                        }


                        string script = "setTimeout(function() { swal ({ title: 'Feedback Submitted!', text: 'Your Feedback Goes a Long Way in Organising Meaningful Events!', type: 'success', confirmButtonText: 'OK'}, function(isConfirm) { if (isConfirm) { window.location.href = 'forumCatOverview.aspx'; } }); }, 1000);";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", script, true);
                    }


                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "<script>swal('Error!', '" + ex.Message + "!', 'error')</script>");

            }

        }
Esempio n. 9
0
 /// <summary>
 /// 打开弹窗(添加)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LinkButton3_Click(object sender, EventArgs e)
 {
     ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>");
 }
Esempio n. 10
0
        private bool UpdateCustomerInfo()
        {
            long                customerId           = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
            dynamic             displayCustomerModel = new ExpandoObject();
            ICustomerRepository customerRepository   = new CustomerRepository();

            displayCustomerModel.CustomerId = customerId;

            if (!customerRepository.UniqueEmail(customerId, _txtEmail.Text))
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "jscode_UniqueEmail", "alert('This email address is already registered! Please use different email address.');", true);
                return(false);
            }


            var address = new Address(_txtAddress.Text, _txtSuit.Text, _txtCity.Text, hfstate.Value,
                                      _txtZip.Text, ddlCountry.SelectedItem.Text);
            var customer = customerRepository.GetCustomer(customerId);

            customer.Name = new Name
            {
                FirstName  = _txtFirstName.Text,
                MiddleName = _txtMiddleName.Text,
                LastName   = _txtLastName.Text
            };
            displayCustomerModel.Name = customer.Name;
            address.Id = customer.Address.Id;
            displayCustomerModel.Address = customer.Address = address;

            var commonCode = new CommonCode();

            customer.HomePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Home,
                Number          = commonCode.FormatPhoneNumber(_txtPhoneHome.Text)
            };
            displayCustomerModel.HomePhone = _txtPhoneHome.Text;
            customer.OfficePhoneNumber     = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Office,
                Number          = commonCode.FormatPhoneNumber(_txtPhoneOffice.Text)
            };
            displayCustomerModel.PhoneOffice          = _txtPhoneOffice.Text;
            customer.PhoneOfficeExtension             = PhoneOfficeExtension.Text;
            displayCustomerModel.PhoneOfficeExtension = PhoneOfficeExtension.Text;

            customer.MobilePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Mobile,
                Number          = commonCode.FormatPhoneNumber(_txtPhoneCell.Text)
            };
            displayCustomerModel.MobilePhoneNumber = _txtPhoneCell.Text;
            displayCustomerModel.Email             = _txtEmail.Text;
            string[] emailSplitUp = _txtEmail.Text.Split(new[] { '@' });
            customer.Email = new Email {
                Address = emailSplitUp[0], DomainName = emailSplitUp[1]
            };

            displayCustomerModel.Feet = _ddlFeet.SelectedValue;
            displayCustomerModel.Inch = _ddlInch.SelectedValue;

            customer.Height           = new Height(Convert.ToInt64(_ddlFeet.SelectedValue), Convert.ToInt64(_ddlInch.SelectedValue));
            customer.Race             = (Race)Enum.Parse(typeof(Race), _ddlRace.SelectedValue);
            displayCustomerModel.Race = _ddlRace.SelectedValue;

            if (_txtDateOfBrith.Text.Trim().Length > 0)
            {
                displayCustomerModel.DateOfBirth = customer.DateOfBirth = Convert.ToDateTime(_txtDateOfBrith.Text);
            }

            double weight;

            if (_txtWeight.Text.Trim().Length > 0 && Double.TryParse(_txtWeight.Text.Trim(), out weight))
            {
                customer.Weight             = new Weight(weight);
                displayCustomerModel.Weight = weight;
            }
            else
            {
                customer.Weight = null;
            }

            customer.EnableTexting               = rbtnEnableTexting.Checked;
            customer.EnableVoiceMail             = rbtnEnableVoiceMail.Checked;
            displayCustomerModel.EnableVoiceMail = customer.EnableVoiceMail;
            displayCustomerModel.EnableTexting   = customer.EnableTexting;
            decimal waist;

            if (_txtWaist.Text.Trim().Length > 0 && decimal.TryParse(_txtWaist.Text.Trim(), out waist))
            {
                customer.Waist             = waist;
                displayCustomerModel.Waist = waist;
            }
            else
            {
                customer.Waist = null;
            }

            if (_ddlGender.SelectedItem.Text == Gender.Male.ToString())
            {
                customer.Gender = Gender.Male;
            }
            else if (_ddlGender.SelectedItem.Text == Gender.Female.ToString())
            {
                customer.Gender = Gender.Female;
            }
            else
            {
                customer.Gender = Gender.Unspecified;
            }
            displayCustomerModel.Gender = customer.Gender.GetDescription();

            displayCustomerModel.Ssn = customer.Ssn = _txtSsnNumber.Text.Replace("-", "").Trim();

            var customerService = IoC.Resolve <ICustomerService>();

            try
            {
                customerService.SaveCustomer(customer, customerId);
                if (IsUpdateProfile)
                {
                    var loginSettingRepository = IoC.Resolve <ILoginSettingRepository>();

                    var loginSettings = loginSettingRepository.Get(customer.UserLogin.Id);
                    if (loginSettings != null && (IsPinRequiredForRole || ((IsOtpByAppEnabled || IsOtpByEmailEnabled || IsOtpBySmsEnabled) && IsAuthenticationForUserEnabled)))
                    {
                        if (IsPinRequiredForRole)
                        {
                            loginSettings.DownloadFilePin = IsPinRequiredForRole ? (string.IsNullOrEmpty(txtDownloadFilePin.Value) ? loginSettings.DownloadFilePin : txtDownloadFilePin.Value) : null;
                        }

                        if ((IsOtpByAppEnabled || IsOtpByEmailEnabled || IsOtpBySmsEnabled) && IsAuthenticationForUserEnabled)
                        {
                            if (useApp.Checked)
                            {
                                loginSettings.AuthenticationModeId         = (long)AuthenticationMode.AuthenticatorApp;
                                loginSettings.GoogleAuthenticatorSecretKey = (string)Session["EncodedSecret"];
                            }
                            else
                            {
                                loginSettings.GoogleAuthenticatorSecretKey = null;
                                loginSettings.AuthenticationModeId         = UseEmail.Checked && UseSms.Checked ? (long)AuthenticationMode.BothSmsEmail : (UseSms.Checked ? (long)AuthenticationMode.Sms : (long)AuthenticationMode.Email);
                            }
                            Session["EncodedSecret"] = null;
                        }

                        loginSettingRepository.Save(loginSettings);
                    }
                }

                LogAudit(ModelType.Edit, displayCustomerModel, customerId);
            }
            catch (InvalidAddressException ex)
            {
                ClientScript.RegisterStartupScript(typeof(string), "jscodecityvalidate", "alert('" + ex.Message + "');", true);
                return(false);
            }
            if (!IsUpdateProfile)
            {
                CustomerId = customer.CustomerId;

                RegistrationFlow.MarketingSource = Request.Form[MarketingSourceDropDown.UniqueID + "_hidden"] ?? string.Empty;
            }
            return(true);
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Session[ApplicationSession.HASACCESSACCOUNTUSERID]) > 0)
            {
                if (!IsPostBack)
                {
                    try
                    {
                        btnGoBack.Visible = false;
                        ViewState["Mode"] = "Save";
                        PanelVisibility(1);
                        BindGrid();

                        if (Request.QueryString["mode"] == "TU")
                        {
                            lblDuration.Text = Session[ApplicationSession.TRUSTNAME].ToString() + ". Account Duration : " + Session[ApplicationSession.ACCOUNTFROMDATE].ToString() + " To " + Session[ApplicationSession.ACCOUNTTODATE].ToString();
                        }
                        else
                        {
                            if (Convert.ToInt32(Session[ApplicationSession.SCHOOLID]) == 0)
                            {
                                lblDuration.Text = Session[ApplicationSession.TRUSTNAME].ToString() + ". Account Duration : " + Session[ApplicationSession.ACCOUNTFROMDATE].ToString() + " To " + Session[ApplicationSession.ACCOUNTTODATE].ToString();
                            }
                            else
                            {
                                lblDuration.Text = Session[ApplicationSession.SCHOOLNAME].ToString() + ". Account Duration : " + Session[ApplicationSession.ACCOUNTFROMDATE].ToString() + " To " + Session[ApplicationSession.ACCOUNTTODATE].ToString();
                            }
                        }
                        if (Request.QueryString["modetype"] == "new" && Request.QueryString["page"] == "receipt")
                        {
                            btnGoBack.Visible = true;
                            btnGoBack.Text    = "Go Back to Receipt";
                            PanelVisibility(2);
                            BindAccountGroup();
                        }
                        if (Request.QueryString["modetype"] == "new" && Request.QueryString["page"] == "payment")
                        {
                            btnGoBack.Visible = true;
                            btnGoBack.Text    = "Go Back to Payment";
                            PanelVisibility(2);
                            BindAccountGroup();
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error("Error", ex);
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
                    }
                }
            }
            else
            {
                if (Convert.ToInt32(Session[ApplicationSession.SCHOOLID]) == 0)
                {
                    Response.Redirect("../Accounting/AccountLogin.aspx?mode=TU", false);
                }
                else
                {
                    Response.Redirect("../Accounting/AccountLogin.aspx", false);
                }
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 带回传函数的添加编辑删除提示
        /// </summary>
        /// <param name="msgtitle">提示文字</param>
        /// <param name="url">返回地址</param>
        /// <param name="msgcss">CSS样式</param>
        /// <param name="callback">JS回调函数</param>
        protected void JscriptMsg(string msgtitle, string url, string msgcss, string callback)
        {
            string msbox = "parent.jsprint(\"" + msgtitle + "\", \"" + url + "\", \"" + msgcss + "\", " + callback + ")";

            ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox, true);
        }
Esempio n. 13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                GeneralLedgerBL   objGeneralLedgerBL = new GeneralLedgerBL();
                GeneralLedgerBO   objGeneralLedgerBO = new GeneralLedgerBO();
                ApplicationResult objResultValidate  = new ApplicationResult();
                int intLedgerID = 0;

                objGeneralLedgerBO.TrustMID       = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                objGeneralLedgerBO.SchoolMID      = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]);
                objGeneralLedgerBO.AccountName    = txtAccountName.Text;
                objGeneralLedgerBO.AccountGroupID = Convert.ToInt32(ddlAccountGroup.SelectedValue);
                if (txtOpeningBalance.Text.Length > 0)
                {
                    objGeneralLedgerBO.OpeningBalance = Convert.ToDouble(txtOpeningBalance.Text);
                }
                if (ddlBalanceType.SelectedValue != "")
                {
                    objGeneralLedgerBO.BalanceType = ddlBalanceType.SelectedValue;
                }
                objGeneralLedgerBO.Description        = txtDescription.Text;
                objGeneralLedgerBO.CreatedDate        = System.DateTime.UtcNow.AddHours(5.5).ToString();
                objGeneralLedgerBO.CreatedUserID      = Convert.ToInt32(Session[ApplicationSession.USERID]);
                objGeneralLedgerBO.IsDeleted          = 0;
                objGeneralLedgerBO.LastModifideDate   = System.DateTime.UtcNow.AddHours(5.5).ToString();
                objGeneralLedgerBO.LastModifideUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);

                //Code For Validate Department Name
                if (ViewState["Mode"].ToString() == "Save")
                {
                    intLedgerID = -1;
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    intLedgerID = Convert.ToInt32(ViewState["LedgerID"].ToString());
                    objGeneralLedgerBO.LedgerID = Convert.ToInt32(ViewState["LedgerID"].ToString());
                }
                objResultValidate = objGeneralLedgerBL.GeneralLedger_ValidateName(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), txtAccountName.Text, intLedgerID);

                if (objResultValidate != null)
                {
                    DataTable dtValidate = new DataTable();
                    dtValidate = objResultValidate.resultDT;
                    if (dtValidate.Rows.Count > 0)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Ledger name already exist.');</script>");
                    }
                    else
                    {
                        if (ViewState["Mode"].ToString() == "Save")
                        {
                            ApplicationResult objResultSave = new ApplicationResult();
                            objResultSave = objGeneralLedgerBL.GeneralLedger_Insert(objGeneralLedgerBO, Convert.ToInt32(Session[ApplicationSession.FINANCIALYEAR]));
                            if (objResultSave.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved successfully.');</script>");
                            }
                        }
                        else if (ViewState["Mode"].ToString() == "Edit")
                        {
                            ApplicationResult objResultUpdate = new ApplicationResult();
                            objResultUpdate = objGeneralLedgerBL.GeneralLedger_Update(objGeneralLedgerBO, Session[ApplicationSession.ACCOUNTFROMDATE].ToString());
                            if (objResultUpdate.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record updated successfully.');</script>");
                            }
                        }
                        ClearAll();
                        BindGrid();
                        PanelVisibility(1);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Esempio n. 14
0
 protected void btnClose_Click(object sender, EventArgs e)
 {
     ClientScript.RegisterStartupScript(GetType(), "CloseScript", " window.close();", false);
 }
Esempio n. 15
0
    protected void btnsubmitAss_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            Label       l1 = row.FindControl("QuestionId") as Label;
            RadioButton r1 = row.FindControl("Rbans1") as RadioButton;
            RadioButton r2 = row.FindControl("Rbans2") as RadioButton;
            RadioButton r3 = row.FindControl("Rbans3") as RadioButton;
            RadioButton r4 = row.FindControl("Rbans4") as RadioButton;

            if (r1.Checked)
            {
                select_no = 1;
            }
            else if (r2.Checked)
            {
                select_no = 2;
            }
            else if (r3.Checked)
            {
                select_no = 3;
            }
            else if (r4.Checked)
            {
                select_no = 4;
            }

            con.Close();
            //my duplicate code

            //check_number(l1.Text);
            cmd.CommandText = "select * from Question where [coursename]='" + Session["CourseName"].ToString() + "' AND [Question_ID]=@qid" + count;
            cmd.Parameters.AddWithValue("@qid" + count, l1.Text);
            cmd.Connection = con;
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                if (select_no == Convert.ToInt32(dr["correct_ans"]))
                {
                    correct_asn = correct_asn + 1;
                }
                else
                {
                    wrong_ans = wrong_ans + 1;
                }
            }
            count++;
            con.Close();
        }

        //=====================***********************************==================//
        Page.Validate("Group1");
        if (Page.IsValid)
        {
            if (Page.IsPostBack == true)
            {
                SqlConnection con1    = new SqlConnection(con.ConnectionString);
                SqlCommand    command = new SqlCommand("select * from CreateCourseTable where CourseName='" + Session["CourseName"].ToString() + "'", con1);
                con1.Open();
                SqlDataReader drCourse = command.ExecuteReader();

                while (drCourse.Read())
                {
                    LmsCourseId = (Convert.ToInt32(drCourse["CourseID"]));
                }
                con1.Close();

                //Code to get employee Id

                SqlCommand emplyeeIdget = new SqlCommand("Select * from registration where employeeMailId='" + lblmail.Text.ToString() + "'", con);

                con.Open();


                SqlDataReader dremp = emplyeeIdget.ExecuteReader();

                while (dremp.Read())

                {
                    EmployeeID = (Convert.ToInt32(dremp["EmployeeID"]));
                }
                con.Close();
            }


            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_insertResult";

            cmd.Parameters.Add("@UserMailID", SqlDbType.NVarChar).Value = lblmail.Text.Trim();
            cmd.Parameters.Add("@EmployeeId", SqlDbType.NVarChar).Value = EmployeeID.ToString();
            cmd.Parameters.Add("@CourseId", SqlDbType.NVarChar).Value   = LmsCourseId.ToString();
            cmd.Parameters.Add("@Result", SqlDbType.NVarChar).Value     = correct_asn.ToString();
            cmd.Connection = con;
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();

            //lblmessage.Text = "You Total Score Is  : " + correct_asn.ToString();
            //Session["result"] = lblmessage.Text;
            //Response.Redirect("resultpage.aspx");

            ClientScript.RegisterStartupScript(typeof(Page), "alertMessage",
                                               "<script type='text/javascript'>alert('Result: " + correct_asn + "');window.location.replace('..//NewVideosPage.aspx');</script>");
        }
    }
Esempio n. 16
0
    void Start()
    {
        menuObject = GameObject.FindGameObjectWithTag ("Menus");
        menu = menuObject.GetComponent<GameOverScript> ();
        gameUI = menuObject.GetComponent<GameUI>();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        spawner = GameObject.FindGameObjectWithTag("Spawner");
        playerSpawner = spawner.GetComponent<PlayerSpawner>();

        currentPosition = transform.position;
    }
Esempio n. 17
0
        /// <summary>
        /// page load (postback data is now available)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(
            object sender,
            EventArgs e)
        {
            // client ip protection
            if (_clientIPTracking)
            {
                var clientIP = ClientIPHelper.ClientIPFromRequest(new HttpContextWrapper(HttpContext.Current).Request, true, new string[] { });
                if (Session[HttpSessionStateVariables.ClientIP.ToString()] == null)
                {
                    Session[HttpSessionStateVariables.ClientIP.ToString()] = clientIP;
                }
                else if (!((string)Session[HttpSessionStateVariables.ClientIP.ToString()]).Equals(clientIP))
                {
                    System.Diagnostics.Trace.TraceWarning("Failed to validate the client ip");
                    _authorizedRequest = false;
                    UpdateControls();
                    return;
                }
            }

            // session spoofing protection
            if (_cookielessSession)
            {
                if (Request.Cookies["clientKey"] == null)
                {
                    if (Session[HttpSessionStateVariables.ClientKey.ToString()] == null)
                    {
                        var cookie = new HttpCookie("clientKey");
                        cookie.Value = Guid.NewGuid().ToString();
                        cookie.Path  = "/";
                        Response.Cookies.Add(cookie);
                    }
                    else
                    {
                        System.Diagnostics.Trace.TraceWarning("Failed to validate the client key: missing key");
                        _authorizedRequest = false;
                        UpdateControls();
                        return;
                    }
                }
                else
                {
                    var clientKey = Request.Cookies["clientKey"].Value;
                    if (Session[HttpSessionStateVariables.ClientKey.ToString()] == null)
                    {
                        Session[HttpSessionStateVariables.ClientKey.ToString()] = clientKey;
                    }
                    else if (!((string)Session[HttpSessionStateVariables.ClientKey.ToString()]).Equals(clientKey))
                    {
                        System.Diagnostics.Trace.TraceWarning("Failed to validate the client key: key mismatch");
                        _authorizedRequest = false;
                        UpdateControls();
                        return;
                    }
                }
            }

            // retrieve the active enterprise session, if any
            if (Session[HttpSessionStateVariables.EnterpriseSession.ToString()] != null)
            {
                try
                {
                    _enterpriseSession = (EnterpriseSession)Session[HttpSessionStateVariables.EnterpriseSession.ToString()];
                }
                catch (Exception exc)
                {
                    System.Diagnostics.Trace.TraceError("Failed to retrieve the active enterprise session ({0})", exc);
                }
            }

            // retrieve the active remote session, if any
            if (Session[HttpSessionStateVariables.RemoteSession.ToString()] != null)
            {
                try
                {
                    RemoteSession = (RemoteSession)Session[HttpSessionStateVariables.RemoteSession.ToString()];

                    if (RemoteSession.State == RemoteSessionState.Disconnected)
                    {
                        // handle connection failure
                        ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), string.Format("handleRemoteSessionExit({0});", RemoteSession.ExitCode), true);

                        // cleanup
                        Session[HttpSessionStateVariables.RemoteSession.ToString()] = null;
                        RemoteSession = null;
                    }
                }
                catch (Exception exc)
                {
                    System.Diagnostics.Trace.TraceError("Failed to retrieve the active remote session ({0})", exc);
                }
            }
            // retrieve a shared remote session from url, if any
            else if (Request["SSE"] != null)
            {
                Session[HttpSessionStateVariables.RemoteSession.ToString()] = GetSharedRemoteSession(Request["SSE"]);

                try
                {
                    // remove the shared session guid from url
                    Response.Redirect("~/", true);
                }
                catch (ThreadAbortException)
                {
                    // occurs because the response is ended after redirect
                }
            }

            // postback events may redirect after execution; UI is updated from there
            if (!IsPostBack)
            {
                UpdateControls();
            }

            // disable the browser cache; in addition to a "noCache" dummy param, with current time, on long-polling and xhr requests
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
        }
Esempio n. 18
0
    // Use this for initialization
    void Start()
    {
        //DontDestroyOnLoad(this);
        //DontDestroyOnLoad(lobbyMenu);

        lobbyMenu = lobbyMenu.GetComponent<Canvas>();

        lobbyMenu.enabled = false;

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        loginMenu = GameObject.FindGameObjectWithTag("Login Menu");
        loginInfo = loginMenu.GetComponent<LoginScript>();

        menuGUI = GameObject.FindGameObjectWithTag("Menus");
        menu = menuGUI.GetComponent<MenuScript>();

        username1 = username1.GetComponent<Text>();
        username2 = username2.GetComponent<Text>();
        username3 = username3.GetComponent<Text>();
        username4 = username4.GetComponent<Text>();

        username1.text = "EMPTY";
        username2.text = "EMPTY";
        username3.text = "EMPTY";
        username4.text = "EMPTY";

        ready1 = ready1.GetComponent<Text>();
        ready2 = ready2.GetComponent<Text>();
        ready3 = ready3.GetComponent<Text>();
        ready4 = ready4.GetComponent<Text>();

        ready1.text = "NOT READY";
        ready2.text = "NOT READY";
        ready3.text = "NOT READY";
        ready4.text = "NOT READY";

        //ready1.color = Color.red;
        //ready2.color = Color.red;
        //ready3.color = Color.red;
        //ready4.color = Color.red;

        isReady = false;

        // For the chatbox
        chatlog = chatlog.GetComponent<Text>();
        chatlog.text = "";

        chatbox = chatbox.GetComponent<Canvas>();
        chatmessage.GetComponent<InputField>();
    }
Esempio n. 19
0
 protected void btn_Sumbit_Click(object sender, EventArgs e)
 {
     try
     {
         using (IFMPDBContext db = new IFMPDBContext())
         {
             ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.ID == ScoreTaskID && t.IsDel != true);
             if (ScoreTask != null)
             {
                 if (ScoreTask.EndDate > DateTime.Now)
                 {
                     string message = "";
                     if (Flag == 1)
                     {
                         //抢单
                         ScoreTaskUser ScoreTaskUser = db.ScoreTaskUser.FirstOrDefault(t => t.ScoreTaskID == ScoreTask.ID && t.UserID == UserID);
                         if (ScoreTaskUser == null)
                         {
                             ScoreTaskUser             = new ScoreTaskUser();
                             ScoreTaskUser.UserID      = UserID;
                             ScoreTaskUser.ScoreTaskID = ScoreTask.ID;
                             db.ScoreTaskUser.Add(ScoreTaskUser);
                             message = "抢单成功";
                         }
                         else
                         {
                             ShowMessage("您已报名");
                             return;
                         }
                     }
                     else if (Flag == 2)
                     {
                         //完成
                         ScoreTaskUser ScoreTaskUser = db.ScoreTaskUser.FirstOrDefault(t => t.ScoreTaskID == ScoreTask.ID && t.UserID == UserID);
                         if (ScoreTaskUser != null)
                         {
                             ScoreTaskUser.CompleteDate = DateTime.Now;
                             //db.ScoreTaskUser.Add(ScoreTaskUser);
                             message = "任务完成成功";
                         }
                         else
                         {
                             ShowMessage("未查询到您的报名信息,请先抢单");
                             return;
                         }
                     }
                     db.SaveChanges();
                     new SysLogDAO().AddLog(LogType.操作日志_添加, message, UserID);
                     ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + message + "');window.parent.location.href='RewardTaskList.aspx'</script>");
                 }
                 else
                 {
                     ShowMessage("任务已过期");
                     return;
                 }
             }
             else
             {
                 ShowMessage("找不到任务");
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
         ShowMessage(ex.Message);
     }
 }
        protected void getVerificationCode_Click(object sender, EventArgs e)
        {
            String        email;
            String        con       = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; //get connection string
            SqlConnection selectCon = new SqlConnection(con);

            selectCon.Open();
            SqlCommand cmdEmail = new SqlCommand("SELECT Email FROM [dbo].[User] WHERE Username = @Username;", selectCon);

            cmdEmail.Parameters.AddWithValue("@Username", TxtRUsername.Text);
            SqlDataReader dtrUser = cmdEmail.ExecuteReader();

            if (dtrUser.HasRows && TxtRPass.Text == TxtRConfirmPass.Text)
            {
                selectCon.Close();
                selectCon.Open();
                SqlCommand cmd = new SqlCommand("SELECT Email FROM [dbo].[User] WHERE Username = @Username;", selectCon);


                cmd.Parameters.AddWithValue("@Username", TxtRUsername.Text);
                email = Convert.ToString(cmdEmail.ExecuteScalar());
                selectCon.Close();



                if (TxtRUsername.Text != "")
                {
                    string      to      = email;                            //To address
                    string      from    = "*****@*****.**"; //From address
                    MailMessage message = new MailMessage(from, to);

                    Random rnd = new Random();
                    int    v   = rnd.Next(1000, 9999);
                    validationCode = v.ToString();

                    string mailbody = "Your validation code to reset password is " + validationCode;
                    message.Subject      = "Validation Code";
                    message.Body         = mailbody;
                    message.BodyEncoding = Encoding.UTF8;
                    message.IsBodyHtml   = true;
                    SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //Gmail smtp
                    System.Net.NetworkCredential basicCredential1 = new
                                                                    System.Net.NetworkCredential("*****@*****.**", "Mizuki12345");
                    client.EnableSsl             = true;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = basicCredential1;

                    try
                    {
                        client.Send(message);
                        getCodeMsg.Text = "A validation code is successfully sent to your email, pleacele check.";
                    }

                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            else if (dtrUser.HasRows == false)
            {
                selectCon.Close();
                System.Text.StringBuilder javaScript = new System.Text.StringBuilder();
                string scriptKey = "ErrorMessage";

                javaScript.Append("var userConfirmation = window.confirm('" + "Username does not exist." + "');\n");

                ClientScript.RegisterStartupScript(this.GetType(), scriptKey, javaScript.ToString(), true);
            }

            //else
            //  {
            //      System.Text.StringBuilder javaScript = new System.Text.StringBuilder();
            //      string scriptKey = "ErrorMessage";
            //
            //    javaScript.Append("var userConfirmation = window.confirm('" + "Confirm password does not match." + "');\n");
            //
            //  ClientScript.RegisterStartupScript(this.GetType(), scriptKey, javaScript.ToString(), true);
            //}
        }
Esempio n. 21
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (ViewState["Step"] == null || (int)ViewState["Step"] == 0)
        {
            labMessage.InnerText = "Analyzing configuration, please wait ...";
            cmdRecheck.Visible   = false;
            tblReport.Visible    = false;

            string script = "$('body').find('*').css('cursor', 'wait'); document.forms[0].submit();";
            ClientScript.RegisterStartupScript(typeof(Admin_CheckConfiguration), "start", script, true);

            ViewState["Step"] = 1;
        }
        else
        {
            cmdRecheck.Visible = true;
            tblReport.Visible  = true;

            tblReport.Rows.Clear();

            LayoutColumns();

            int errorCount = WriteWebConfigBlock();

            Configuration config = Configuration.GetCurrent();
            config.CascadeDeactivated();
            config.RemoveDeactivated();
            config.ValidateConfiguration();

            errorCount += WriteReportBlock(config.Application, "ApplicationID", null);
            errorCount += WriteReportBlock(config.ApplicationMapTab, "ApplicationID", "MapTabID");
            errorCount += WriteReportBlock(config.ApplicationMarkupCategory, "ApplicationID", "CategoryID");
            errorCount += WriteReportBlock(config.ApplicationPrintTemplate, "ApplicationID", "TemplateID");
            errorCount += WriteReportBlock(config.Connection, "ConnectionID", null);
            errorCount += WriteReportBlock(config.DataTab, "DataTabID", "LayerID");
            errorCount += WriteReportBlock(config.Layer, "LayerID", null);
            errorCount += WriteReportBlock(config.LayerFunction, "LayerID", "FunctionName");
            errorCount += WriteReportBlock(config.LayerProximity, "LayerID", "ProximityID");
            errorCount += WriteReportBlock(config.Level, "LevelID", "ZoneLevelID");
            errorCount += WriteReportBlock(config.MapTab, "MapTabID", null);
            errorCount += WriteReportBlock(config.MapTabLayer, "MapTabID", "LayerID");
            errorCount += WriteReportBlock(config.MarkupCategory, "CategoryID", null);
            errorCount += WriteReportBlock(config.PrintTemplate, "TemplateID", null);
            errorCount += WriteReportBlock(config.PrintTemplateContent, "TemplateID", "SequenceNo");
            errorCount += WriteReportBlock(config.Proximity, "ProximityID", null);
            errorCount += WriteReportBlock(config.Query, "QueryID", "LayerID");
            errorCount += WriteReportBlock(config.Search, "SearchID", "LayerID");
            errorCount += WriteReportBlock(config.SearchInputField, "FieldID", "SearchID");
            errorCount += WriteReportBlock(config.Zone, "ZoneID", "ZoneLevelID");
            errorCount += WriteReportBlock(config.ZoneLevel, "ZoneLevelID", null);
            errorCount += WriteReportBlock(config.ZoneLevelCombo, "ZoneID,LevelID", "ZoneLevelID");

            labMessage.InnerText = errorCount == 0 ? "No errors found" : errorCount == 1 ? "1 error found" : String.Format("{0} errors found", errorCount);

            IAdminMasterPage master = (IAdminMasterPage)Master;

            if (master.ReloadRequested)
            {
                config.RemoveValidationErrors();
                master.ReloadConfiguration(config);
            }
        }
    }
Esempio n. 22
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtusername.Text == "" || txtusername.Text == null)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Enter The UserName');", true);
                txtusername.Focus();
                return;
            }

            if (txtPassword.Text == "" || txtPassword.Text == null)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Enter The Password with atleast one special charcter and a Capital latter');", true);
                txtPassword.Focus();
                return;
            }

            if (txtAnswer.Text == "" || txtAnswer.Text == null)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Enter Answer For Selected Question');", true);
                txtAnswer.Focus();
                return;
            }
            bool          ticked   = false;
            List <string> userrole = new List <string>();
            if (chkAdmin.Checked)
            {
                userrole.Add(chkAdmin.Text); ticked = true;
            }
            if (chkUser.Checked)
            {
                userrole.Add(chkUser.Text); ticked = true;
            }
            if (chkLocation.Checked)
            {
                userrole.Add(chkLocation.Text); ticked = true;
            }
            if (!ticked)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Please Select Atleast One Role');", true);
                return;
            }
            UserDetails objUserReq = new UserDetails();
            if (btnsubmit.Text == "Submit")
            {
                objUserReq.Username = txtusername.Text;
                objUserReq.Password = txtPassword.Text;
                string Role = string.Join("| ", userrole);
                if (txtLocation.Text != "" && chkLocation.Checked == true)
                {
                    objUserReq.Location = txtLocation.Text;
                }
                objUserReq.Role     = Role;
                objUserReq.Question = filterlist.SelectedValue.ToString();
                objUserReq.Answer   = txtAnswer.Text.ToString();

                if (objds == null)
                {
                    objds = new DataSet();
                }

                Reply objRes = new Reply();
                using (WebClient client = new WebClient())
                {
                    client.Headers[HttpRequestHeader.ContentType] = "text/json";

                    string     JsonString    = JsonConvert.SerializeObject(objUserReq);
                    EncRequest objEncRequest = new EncRequest();
                    objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                    string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                    string result = client.UploadString(URL + "/Adduser", "POST", dataEncrypted);

                    EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                    objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                    JsonSerializer json = new JsonSerializer();
                    json.NullValueHandling = NullValueHandling.Ignore;
                    StringReader sr = new StringReader(objResponse.ResponseData);
                    Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                    objRes = json.Deserialize <Reply>(reader);

                    if (objRes.res == true)
                    {
                        var page1 = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page1, page1.GetType(), "alert", "alert('User Created Successfully' );window.location ='CreateUser.aspx';", true);
                        clearAll();
                    }
                    else
                    {
                        Response.Write("<script type='text/javascript'>alert( 'User Already Exist. / " + objRes.strError + "')</script>");
                        lblPassword.Text = "";
                    }
                    chkAdmin.Checked    = false;
                    chkUser.Checked     = false;
                    chkLocation.Checked = false;
                    chkUser.Enabled     = true;
                    chkAdmin.Enabled    = true;
                }
            }
            else
            {
                objUserReq.Username = txtusername.Text;
                objUserReq.Password = txtPassword.Text;
                string Role = string.Join("| ", userrole);
                if (txtLocation.Text != "" && chkLocation.Checked == true)
                {
                    objUserReq.Location = txtLocation.Text;
                }
                objUserReq.Role     = Role;
                objUserReq.Question = filterlist.SelectedValue.ToString();
                objUserReq.Answer   = txtAnswer.Text.ToString();

                if (objds == null)
                {
                    objds = new DataSet();
                }

                Reply objRes = new Reply();
                using (WebClient client = new WebClient())
                {
                    client.Headers[HttpRequestHeader.ContentType] = "text/json";

                    string     JsonString    = JsonConvert.SerializeObject(objUserReq);
                    EncRequest objEncRequest = new EncRequest();
                    objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                    string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                    string result = client.UploadString(URL + "/UpdateUser", "POST", dataEncrypted);

                    EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                    objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                    JsonSerializer json = new JsonSerializer();
                    json.NullValueHandling = NullValueHandling.Ignore;
                    StringReader sr = new StringReader(objResponse.ResponseData);
                    Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                    objRes = json.Deserialize <Reply>(reader);

                    if (objRes.res == true)
                    {
                        var page1 = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page1, page1.GetType(), "alert", "alert('User Update Successfully' );window.location ='ViewUser.aspx';", true);
                    }
                    else
                    {
                        Response.Write("<script type='text/javascript'>alert( 'User Already Exist. / " + objRes.strError + "')</script>");
                        lblPassword.Text = "";
                    }
                }
            }
        }
        catch (Exception excp)
        {
            Response.Write("<script type='text/javascript'>alert( 'Error catch " + excp.Message + "')</script>");
        }
    }
Esempio n. 23
0
    protected void imgBtnSubmit_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlFileNo.Text.Trim() == "")
        {
            ClientScript.RegisterStartupScript(GetType(), "Information", "<script>alert('File Number can not be Empty')</script>");
            return;
        }
        try
        {
            SqlCommand cmd = new SqlCommand();
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
            con.ConnectionString = ConfigurationManager.ConnectionStrings["PATENTCN"].ConnectionString;
            string sql = "insert into patentpayment (EntryDt,FileNO,PType,SlNo,Country,Activity,PaymentOrChequeDt,PaymentRefOrChequeNo,PaymentAmtINR,ExRate,Party,Year,costGroup,Remark,paymentAmtForeign,currency,InvoiceNo,InvoiceDt) " +
                         "values (convert(smalldatetime,@EntryDt,103),@FileNo,case when @PType='' then null else @PType end,@SlNo,case when @Country='' then null else @Country end," +
                         "case when @Activity='' then null else @Activity end,case when @PaymentOrChequeDt='' then null else convert(smalldatetime,@PaymentOrChequeDt,103) end,case when @PaymentRefOrChequeNo='' then null else @PaymentRefOrChequeNo end," +
                         "@PaymentAmtINR,case when @ExRate='' then null else @ExRate end,case when @Party='' then null else @Party end, case when @Year='' then null else @Year end,case when @costGroup='' then null else @costGroup end,case when @Remark='' then null else @Remark end, " +
                         "@paymentAmtForeign,case when @currency='' then null else @currency end, case when @InvoiceNo='' then null else @InvoiceNo end, case when @InvoiceDt='' then null else convert(smalldatetime,@InvoiceDt,103) end)";

            cmd.CommandText = sql;
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = con;
            con.Open();
            SqlParameter pm1 = new SqlParameter();
            pm1.ParameterName = "@EntryDt";
            pm1.SourceColumn  = "EntryDt";
            pm1.Value         = DateTime.Now.ToShortDateString();
            pm1.DbType        = DbType.String;
            pm1.Direction     = ParameterDirection.Input;

            SqlParameter pm2 = new SqlParameter();
            pm2.ParameterName = "@fileno";
            pm2.SourceColumn  = "fileno";
            pm2.Value         = ddlFileNo.Text.Trim();
            pm2.DbType        = DbType.String;
            pm2.Direction     = ParameterDirection.Input;

            SqlParameter pm3 = new SqlParameter();
            pm3.ParameterName = "@PType";
            pm3.SourceColumn  = "PType";
            pm3.Value         = ddlPMode.Text.Trim();
            pm3.DbType        = DbType.String;
            pm3.Direction     = ParameterDirection.Input;

            SqlConnection con1 = new SqlConnection();
            con1.ConnectionString = ConfigurationManager.ConnectionStrings["PATENTCN"].ConnectionString;
            string     sql1 = "select case when max(slno)is Null then 1 else max(slno)+1 end from patentpayment where fileno='" + ddlFileNo.Text.Trim() + "'";
            SqlCommand cmd1 = new SqlCommand();
            cmd1.CommandText = sql1;
            cmd1.CommandType = CommandType.Text;
            cmd1.Connection  = con1;
            con1.Open();
            int slNumber = Convert.ToInt32(cmd1.ExecuteScalar());
            con1.Close();

            SqlParameter pm4 = new SqlParameter();
            pm4.ParameterName = "@SlNo";
            pm4.SourceColumn  = "SlNo";
            pm4.Value         = slNumber;
            pm4.DbType        = DbType.Int32;
            pm4.Direction     = ParameterDirection.Input;

            SqlParameter pm5 = new SqlParameter();
            pm5.ParameterName = "@country";
            pm5.SourceColumn  = "country";
            pm5.Value         = ddlCountry.Text.Trim();
            pm5.DbType        = DbType.String;
            pm5.Direction     = ParameterDirection.Input;

            SqlParameter pm6 = new SqlParameter();
            pm6.ParameterName = "@Activity";
            pm6.SourceColumn  = "Activity";
            pm6.Value         = txtDescription.Text.Trim();
            pm6.DbType        = DbType.String;
            pm6.Direction     = ParameterDirection.Input;

            SqlParameter pm7 = new SqlParameter();
            pm7.ParameterName = "@PaymentOrChequeDt";
            pm7.SourceColumn  = "PaymentOrChequeDt";
            pm7.Value         = txtChequeDate.Text.Trim();
            pm7.DbType        = DbType.String;
            pm7.Direction     = ParameterDirection.Input;

            SqlParameter pm8 = new SqlParameter();
            pm8.ParameterName = "@PaymentRefOrChequeNo";
            pm8.SourceColumn  = "PaymentRefOrChequeNo";
            pm8.Value         = txtChequeNo.Text.Trim();
            pm8.DbType        = DbType.String;
            pm8.Direction     = ParameterDirection.Input;

            SqlParameter pm9 = new SqlParameter();
            pm9.ParameterName = "@PaymentAmtINR";
            pm9.SourceColumn  = "PaymentAmtINR";
            pm9.Value         = txtChequeAmt.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtChequeAmt.Text.Trim());
            pm9.DbType        = DbType.Decimal;
            pm9.Direction     = ParameterDirection.Input;

            SqlParameter pm10 = new SqlParameter();
            pm10.ParameterName = "@ExRate";
            pm10.SourceColumn  = "ExRate";
            pm10.Value         = txtExRate.Text.Trim();
            pm10.DbType        = DbType.String;
            pm10.Direction     = ParameterDirection.Input;

            SqlParameter pm11 = new SqlParameter();
            pm11.ParameterName = "@Party";
            pm11.SourceColumn  = "Party";
            pm11.Value         = ddlParty.Text.Trim();
            pm11.DbType        = DbType.String;
            pm11.Direction     = ParameterDirection.Input;

            SqlParameter pm12 = new SqlParameter();
            pm12.ParameterName = "@Year";
            pm12.SourceColumn  = "Year";
            pm12.Value         = ddlYear.Text.Trim();
            pm12.DbType        = DbType.String;
            pm12.Direction     = ParameterDirection.Input;

            SqlParameter pm13 = new SqlParameter();
            pm13.ParameterName = "@costGroup";
            pm13.SourceColumn  = "costGroup";
            pm13.Value         = ddlCostGrp.Text.Trim();
            pm13.DbType        = DbType.String;
            pm13.Direction     = ParameterDirection.Input;

            SqlParameter pm14 = new SqlParameter();
            pm14.ParameterName = "@Remark";
            pm14.SourceColumn  = "Remark";
            pm14.Value         = txtRemark.Text.Trim();
            pm14.DbType        = DbType.String;
            pm14.Direction     = ParameterDirection.Input;

            SqlParameter pm15 = new SqlParameter();
            pm15.ParameterName = "@paymentAmtForeign";
            pm15.SourceColumn  = "paymentAmtForeign";
            pm15.Value         = txtPayment.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtPayment.Text.Trim());
            pm15.DbType        = DbType.Decimal;
            pm15.Direction     = ParameterDirection.Input;

            SqlParameter pm16 = new SqlParameter();
            pm16.ParameterName = "@currency";
            pm16.SourceColumn  = "currency";
            pm16.Value         = ddlCurrency.SelectedItem.Value.Trim();
            pm16.DbType        = DbType.String;
            pm16.Direction     = ParameterDirection.Input;

            SqlParameter pm17 = new SqlParameter();
            pm17.ParameterName = "@InvoiceNo";
            pm17.SourceColumn  = "InvoiceNo";
            pm17.Value         = txtInvoice.Text.Trim();
            pm17.DbType        = DbType.String;
            pm17.Direction     = ParameterDirection.Input;

            SqlParameter pm18 = new SqlParameter();
            pm18.ParameterName = "@InvoiceDt";
            pm18.SourceColumn  = "InvoiceDt";
            pm18.Value         = txtInvoiceDt.Text.Trim();
            pm18.DbType        = DbType.String;
            pm18.Direction     = ParameterDirection.Input;

            cmd.Parameters.Add(pm1);
            cmd.Parameters.Add(pm2);
            cmd.Parameters.Add(pm3);
            cmd.Parameters.Add(pm4);
            cmd.Parameters.Add(pm5);
            cmd.Parameters.Add(pm6);
            cmd.Parameters.Add(pm7);
            cmd.Parameters.Add(pm8);
            cmd.Parameters.Add(pm9);
            cmd.Parameters.Add(pm10);
            cmd.Parameters.Add(pm11);
            cmd.Parameters.Add(pm12);
            cmd.Parameters.Add(pm13);
            cmd.Parameters.Add(pm14);
            cmd.Parameters.Add(pm15);
            cmd.Parameters.Add(pm16);
            cmd.Parameters.Add(pm17);
            cmd.Parameters.Add(pm18);

            cmd.ExecuteNonQuery();

            ClientScript.RegisterStartupScript(GetType(), "Success", "<script>alert('This Record successfully Added')</script>");
            con.Close();
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(GetType(), "Error", "<script>alert('" + ex.Message.ToString() + "')</script>");
            con.Close();
            return;
        }
        imgBtnClear_Click(sender, e);
    }
        protected void btnConfigurar_Click(object sender, EventArgs e)
        {
            try
            {
                string hmtl;
                hmtl = "";
                pnlGeneral.Visible = true;

                if (hdfActivarRol.Value == "1")
                {
                    hdf_id_campus.Value = ddlCampus.SelectedValue;
                }


                //Mustra el compus que esta seleccionando

                /*Tomamos los procesos que esta en cero*/
                query = "sp_configuracion_proceso_asignacion_inicio_Cero " + hdf_id_campus.Value + ",'" + Session["Usuario"].ToString() + "' ";
                dt    = db.getQuery(conexionBecarios, query);
                hmtl += @"<div class='contDrag'>
                            <table>
                                <tbody>
                                    <tr>
                                        <td>
                                            <label>Prioridades No Asignadas</label>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                            <label> Prioridades Asignadas </label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul id='sortable1'>";
                foreach (DataRow registros in dt.Rows)
                {
                    hmtl += @"<li class='elementli' id='" + registros["id_proceso_asignacion_campus"] + "'>" + registros["Nombre"] + "<hr width='80%'></li>";
                }
                hmtl += @"</ul>
                                        </td>
                                        <td>
                                            <img src='../images/flecha_asignacion.png' width='50px' height='50px' title='Arrastre los elementos de manera \n ascendente para asignarles prioridad'>
                                        </td>
                                        <td>
                                            <ul id='sortable2'>";

                query = "sp_configuracion_proceso_asignacion_inicio_ordenado " + hdf_id_campus.Value + "";
                dt    = db.getQuery(conexionBecarios, query);

                foreach (DataRow registros in dt.Rows)
                {
                    hmtl += @"<li class='elementli' id='" + registros["id_proceso_asignacion_campus"] + "'>" + registros["Nombre"] + "<hr width='80%' ></li>";
                    ClientScript.RegisterStartupScript(GetType(), "ocultarbotoones" + registros["Prioridad"], "iniciarElementos(" + registros["Prioridad"] + ");", true);
                }
                hmtl       += @"</ul>
                                        </td>
                                        <td style='vertical-align:top;'>
                                            <img id='img-ord1' style='display:none;width:30px;height:72px' src='../images/1.png'  >
                                            <img id='img-ord2' style='display:none;width:30px;height:72px' src='../images/2.png' >
                                            <img id='img-ord3' style='display:none;width:30px;height:72px' src='../images/3.png' >
                                            <img id='img-ord4' style='display:none;width:30px;height:72px' src='../images/4.png' >
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                    </div>";
                Label1.Text = hmtl;


                llenarGridProcesoConfiguracion();
            }
            catch (Exception es)
            {
                verModal("Error", es.Message.ToString());
            }
        }
        private void CloseForm()
        {
            string nUrl = "<script>CloseOnReload()</script>";

            ClientScript.RegisterStartupScript(this.GetType(), "closeWindow", nUrl);
        }
Esempio n. 26
0
 protected void btnCancel_Click(object sender, EventArgs e)
 {
     string script = "<script>RefreshParentPage()</" + "script>";
     //RadScriptManager.RegisterStartupScript(this, this.GetType(), "RefreshParentPage", script, false);
     ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", script);
 }
Esempio n. 27
0
        protected void btnRecuperar_Click(object sender, EventArgs e)
        {
            try
            {
                String stMensaje = String.Empty;
                if (String.IsNullOrEmpty(txtIngresarEmail.Text))
                {
                    stMensaje = "Ingrese el Email";
                }
                if (!String.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje);
                }

                Controllers.RecuperarPasswordControllers obRecuperarPasswordControllers = new Controllers.RecuperarPasswordControllers();
                logica.Models.clsUsuarios obclsUsuarios = new logica.Models.clsUsuarios
                {
                    stCorreo = txtIngresarEmail.Text
                };

                DataSet dsConsulta = obRecuperarPasswordControllers.getConsultarPasswordController(obclsUsuarios);

                if (dsConsulta.Tables[0].Rows.Count > 0)
                {
                    string[] stLogin      = dsConsulta.Tables[0].Rows[0]["usuaCorreo"].ToString().Split('@');
                    string   stCuerpoHTML = "<!DOCTYPE html>";
                    stCuerpoHTML += "<html lang='es'>";
                    stCuerpoHTML += "<head>";
                    stCuerpoHTML += "<meta charset='utf - 8'>";
                    stCuerpoHTML += "<title>Recuperacion de correo</title>";
                    stCuerpoHTML += "</head>";
                    stCuerpoHTML += "<body style='background - color: black '>";
                    stCuerpoHTML += "<table style='max - width: 600px; padding: 10px; margin: 0 auto; border - collapse: collapse; '>	";
                    stCuerpoHTML += "<tr>";
                    stCuerpoHTML += "<td style='padding: 0'>";
                    stCuerpoHTML += "<img style='padding: 0; display: block' src='cid:Fondo' width='100%' height='10%'>";
                    stCuerpoHTML += "</td>";
                    stCuerpoHTML += "</tr>";
                    stCuerpoHTML += "<tr>";
                    stCuerpoHTML += "<td style='background - color: #ecf0f1'>";
                    stCuerpoHTML += "<div style='color: #34495e; margin: 4% 10% 2%; text-align: justify;font-family: sans-serif'>";
                    stCuerpoHTML += "<h2 style='color: #e67e22; margin: 0 0 7px'>Hola " + stLogin[0] + "</h2>";
                    stCuerpoHTML += "<p style='margin: 2px; font - size: 15px'>";
                    stCuerpoHTML += "Hemos recibido una solicitud para restablecer el password de su cuenta asociada con ";
                    stCuerpoHTML += "esta dirección de correo electrónico. Si no ha realizado esta solicitud, puede ignorar este ";
                    stCuerpoHTML += "correo electrónico y le garantizamos que su cuenta es completamente segura.";
                    stCuerpoHTML += "<br/>";
                    stCuerpoHTML += "<br/>";
                    stCuerpoHTML += "Su password es: " + dsConsulta.Tables[0].Rows[0]["usuaPassword"].ToString();
                    stCuerpoHTML += "</p>";
                    stCuerpoHTML += "<p style='color: #b3b3b3; font-size: 12px; text-align: center;margin: 30px 0 0'>Copyright © Conoce a:Colombia 2018</p>";
                    stCuerpoHTML += "</div>";
                    stCuerpoHTML += "</td>";
                    stCuerpoHTML += "</tr>";
                    stCuerpoHTML += "</table>";
                    stCuerpoHTML += "</body>";
                    stCuerpoHTML += "</html>";
                    logica.Models.clsCorreo obclsCorreo = new logica.Models.clsCorreo()
                    {
                        stServidor       = ConfigurationManager.AppSettings["stServidor"].ToString(),
                        stUsuario        = ConfigurationManager.AppSettings["stUsuario"].ToString(),
                        stPassword       = ConfigurationManager.AppSettings["stPassword"].ToString(),
                        stPuerto         = ConfigurationManager.AppSettings["stPuerto"].ToString(),
                        blAutenticacion  = true,
                        blConexionSegura = true,
                        inPrioridad      = 0,
                        inTipo           = 1,
                        stAsunto         = "Recuperacion de Password",
                        stFrom           = ConfigurationManager.AppSettings["stUsuario"].ToString(),
                        stTo             = txtIngresarEmail.Text,
                        stImage          = Server.MapPath("~") + @"\Resources\Images\hqdefault.jpg",
                        stIdImage        = "Fondo",
                        stMensaje        = stCuerpoHTML
                    };

                    obRecuperarPasswordControllers.setEmailController(obclsCorreo);
                    ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('Mensaje!', 'Se realizo proceso con exito!', 'success')</Script>");
                }
                else
                {
                    throw new Exception("No se encotro información asociada con esa dirección de correo");
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('ERROR!', '" + ex.Message + "!', 'error')</Script>");
            }
        }
Esempio n. 28
0
    protected void LoadDescstats(string filename)
    {
        DataSet dset_descstats = new DataSet();

        if (File.Exists(HttpContext.Current.Server.MapPath("~/App_Data/DataDownloads/" + filename)))
        {
            //convert to .xls here
            try
            {
                dset_descstats = SpreadsheetGearUtils.GetDataSet(filename);

                int g = 0;
            }
            catch (Exception)
            {
                string result = "Sorry, the file [" + filename + "] was unable to load.  Create a new Excel file to generate the latest descriptive stats.";
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + result + "');", true);
            }
        }
        else
        {
            string data_filename = filename.Replace("DescStats", "Data");

            DataSet dset        = SpreadsheetGearUtils.GetDataSet(data_filename);
            int     dataproj_pk = Convert.ToInt32(Request.QueryString["pk"]);
            if (dataproj_pk > 0 & dset != null & dset.Tables.Count > 0)
            {
                dset_descstats = utilDataProject.DataProject_Descstats(dataproj_pk, dset);

                SpreadsheetGearUtils.SaveDataSetToExcel(dset_descstats, filename, false, "xlsx");

                int g = 0;
            }
            else
            {
                string result = "Sorry, the file [" + filename + "] was not found.";
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + result + "');", true);
            }
        }

        if (dset_descstats != null & dset_descstats.Tables.Count > 0)
        {
            foreach (DataTable dt in dset_descstats.Tables)
            {
                if (dt.TableName == "fileinfo")
                {
                    GridView gv = new GridView();
                    gv.DataSource = dt;
                    gv.DataBind();
                    panel0.Controls.Add(gv);
                }
                else
                {
                    var dtSorted = dt.AsEnumerable()
                                   .OrderBy(r => r.Field <string>("Measure"))
                                   .ThenBy(r => r.Field <string>("Varname"))
                                   .ThenBy(r => r.Field <string>("TimePoint"))
                                   .CopyToDataTable();


                    GridView gv = new GridView();
                    gv.RowDataBound += gv_RowDataBound;
                    gv.AllowSorting  = true;
                    gv.DataSource    = dtSorted;
                    gv.DataBind();

                    gv.CssClass = "GridViewClass";


                    Label lbl = new Label();
                    lbl.Text      = " By " + dt.TableName;
                    lbl.Font.Bold = true;
                    lbl.Font.Size = 12;
                    Literal lit = new Literal();
                    lit.Text = "<br/><br/>";

                    panel1.Controls.Add(lbl);
                    panel1.Controls.Add(gv);
                    panel1.Controls.Add(lit);
                }
            }
        }
    }
Esempio n. 29
0
 public void ShowModal()
 {
     ClientScript.RegisterStartupScript(this.GetType(), "key", "openModal(`#btnFileLeave`);", true);
 }
Esempio n. 30
0
 protected void ShowMessage(string message)
 {
     ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + message + "');", true);
 }
Esempio n. 31
0
        protected void RegisterReviewer1(object sender, EventArgs e)
        {
            try
            {
                string user_type = "Authorized Reviewer";
                string email     = txt_email.Text;
                string password  = txt_password.Text;

                if (email == "" || password == "")
                {
                    throw new Exception();
                }


                string  first_name  = txt_first_name.Text;
                string  middle_name = txt_middle_name.Text;
                string  last_name   = txt_last_name.Text;
                string  birthdate   = txt_birthdate.Text;
                string  hiredate    = txt_hiredate.Text;
                int     workinghours;
                decimal payment_ratio;
                if (txt_working_hours.Text == "")
                {
                    workinghours = 0;
                }
                else
                {
                    workinghours = Convert.ToInt32(txt_working_hours.Text);
                }

                if (txt_ratio.Text == "")
                {
                    payment_ratio = 0;
                }
                else
                {
                    payment_ratio = Convert.ToDecimal(txt_ratio.Text);
                }


                string        connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString;;
                SqlConnection cnn             = new SqlConnection(connetionString);

                cnn.Open();

                SqlCommand cmd = new SqlCommand("Register_User", cnn);


                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@usertype", user_type));
                cmd.Parameters.Add(new SqlParameter("@email", email));
                cmd.Parameters.Add(new SqlParameter("@password", password));
                cmd.Parameters.Add(new SqlParameter("@firstname", first_name));
                cmd.Parameters.Add(new SqlParameter("@middlename", middle_name));
                cmd.Parameters.Add(new SqlParameter("@lastname", last_name));
                cmd.Parameters.Add(new SqlParameter("@birth_date", birthdate));
                cmd.Parameters.Add(new SqlParameter("@working_place_name", ""));
                cmd.Parameters.Add(new SqlParameter("@working_place_type", ""));
                cmd.Parameters.Add(new SqlParameter("@wokring_place_description", ""));
                cmd.Parameters.Add(new SqlParameter("@specilization", ""));
                cmd.Parameters.Add(new SqlParameter("@portofolio_link", ""));
                cmd.Parameters.Add(new SqlParameter("@years_experience", ""));
                cmd.Parameters.Add(new SqlParameter("@hire_date", hiredate));
                cmd.Parameters.Add(new SqlParameter("@working_hours", workinghours));
                cmd.Parameters.Add(new SqlParameter("@payment_rate", payment_ratio));


                cmd.Parameters.Add("@user_id", System.Data.SqlDbType.Int).Direction = System.Data.ParameterDirection.Output;

                int user_id = 0;

                // execute the command

                using (SqlDataReader rdr = cmd.ExecuteReader())
                {
                    user_id = Convert.ToInt32(cmd.Parameters["@user_id"].Value);
                    rdr.Close();
                }
                Session["ID"] = user_id;
                Response.Redirect("Staff.aspx?user_id=" + user_id);
                cnn.Close();
            }
            catch (Exception e1)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Please enter a valid email and password" + "');", true);
            }
        }
Esempio n. 32
0
    void Start()
    {
        cameraSize = bgHeight / 200.0f;
        Camera.main.orthographicSize = cameraSize;

        forceFactor = forceMax / arrowMaxLen;

        // 连接服务器,加入游戏
        client = gameObject.GetComponent<ClientScript> ();
        if (client == null) {
            // TODO: 处理错误
        }
        client.Connect (serverAddr, serverPort);
        if (-1 == client.sendJoin ()) {
            // TODO: 处理发送JOIN错误
        }

        // Slave加入游戏后发送OK给master
        if (!client.isMaster ()) {
            Debug.Log ("this client is slave");
            client.sendOK();
        }
        //debugStr = "waiting for player ...";
        gameStatus = ST_WAIT;

        // 保存常用的GameObject
        // 保存actors
        playerActors = new GameObject[3];
        enemyActors = new GameObject[3];

        for (int i = 0; i < 3; i++) {
            GameObject obj;
            obj = GameObject.Find("ball" + (i+1));
            Debug.Assert(obj != null);
            playerActors[i] = obj;
            obj.SetActive(false);
            obj = GameObject.Find("enemy" + (i+1));
            Debug.Assert(obj != null);
            enemyActors[i] = obj;
            obj.SetActive(false);
        }

        // 指向箭头
        arrowPlayer = GameObject.Find ("arrowPlayer");
        arrowPlayer.SetActive (false);
        arrowEnemy = GameObject.Find ("arrowEnemy");
        arrowEnemy.SetActive (false);

        //isSyncing = true;
        isOperating = false;
        isWaiting = true;
        fixedUpdateLoopCounter = 0;

        return;
    }
Esempio n. 33
0
    // Use this for initialization
    void Start()
    {
        winMenu = winMenu.GetComponent<Canvas> ();
        loseMenu = loseMenu.GetComponent<Canvas> ();
        scoreMenu = scoreMenu.GetComponent<Canvas>();
        finalScoreText = finalScoreText.GetComponent<Text>();
        resultText = resultText.GetComponent<Text>();

        yesWinButton = yesWinButton.GetComponent<Button> ();
        noWinButton = noWinButton.GetComponent<Button> ();
        yesLoseButton = yesLoseButton.GetComponent<Button> ();
        noLoseButton = noLoseButton.GetComponent<Button> ();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        gameUI = GameObject.FindGameObjectWithTag("Menus");
        menu = gameUI.GetComponent<GameUI>();

        winMenu.enabled = false;
        loseMenu.enabled = false;
        scoreMenu.enabled = false;
    }
Esempio n. 34
0
    // Use this for initialization
    void Start()
    {
        onePlayerP1Position.Set(0, -8, 0);      // One Player - Player 1 Starting Position

        twoPlayerP1Position.Set(-3, -8, 0);      // Two Player - Player 1 Starting Position
        twoPlayerP2Position.Set(3, -8, 0);      // Two Player - Player 2 Starting Position

        threePlayerP1Position.Set(-4, -8, 0);      // Two Player - Player 1 Starting Position
        threePlayerP2Position.Set(0, -8, 0);      // Two Player - Player 2 Starting Position
        threePlayerP3Position.Set(4, -8, 0);      // Two Player - Player 2 Starting Position

        fourPlayerP1Position.Set(-6, -8, 0);      // Two Player - Player 1 Starting Position
        fourPlayerP2Position.Set(-2, -8, 0);      // Two Player - Player 2 Starting Position
        fourPlayerP3Position.Set(2, -8, 0);      // Two Player - Player 2 Starting Position
        fourPlayerP4Position.Set(6, -8, 0);      // Two Player - Player 2 Starting Position

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        clientManager.setIsPlayerInLobby(false);

        clientManager.SendMSG("player-ready<EOF>", 1000);
        spawnPlayers();
    }
Esempio n. 35
0
 protected void BtnCancel_Click(object sender, EventArgs e)
 {
     ClientScript.RegisterStartupScript(typeof(Page), "close", "<script type='text/javascript'>window.close();</script>");
 }
Esempio n. 36
0
        protected void btnSaveClass_OnClick(object sender, EventArgs e)
        {
            try
            {
                HolidayBo         objHolidayBO = new HolidayBo();
                HolidayBl         objHolidayBL = new HolidayBl();
                ApplicationResult objResult    = new ApplicationResult();
                DataTable         dtResult     = new DataTable();
                int intHolidayID = 0;

                objHolidayBO.Name         = txtHolidayName.Text.Trim();
                objHolidayBO.AcademicYear = ddlAcademicYear.Text;
                objHolidayBO.StartDate    = txtFromDate.Text.Trim();
                objHolidayBO.EndDate      = txtToDate.Text.Trim();
                objHolidayBO.Description  = txtDescription.Text.Trim();

                //Code For Validate Holiday Name
                if (ViewState["Mode"].ToString() == "Save")
                {
                    intHolidayID = -1;
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    intHolidayID = Convert.ToInt32(ViewState["HolidayID"].ToString());
                }
                objResult = objHolidayBL.Holiday_ValidateName(intHolidayID, objHolidayBO.StartDate, objHolidayBO.AcademicYear);
                if (objResult != null)
                {
                    dtResult = objResult.resultDT;
                    if (dtResult.Rows.Count > 0)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Holiday already exist.');</script>");
                    }
                    else
                    {
                        if (ViewState["Mode"].ToString() == "Save")
                        {
                            objHolidayBO.CreatedBy   = Convert.ToInt32(Session[ApplicationSession.USERID]);
                            objHolidayBO.CreatedDate = DateTime.UtcNow.AddHours(5.5).ToString();
                            objResult = objHolidayBL.Holiday_Insert(objHolidayBO);
                            if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record saved successfully.');</script>");
                            }
                        }
                        else if (ViewState["Mode"].ToString() == "Edit")
                        {
                            objHolidayBO.HolidayId        = Convert.ToInt32(ViewState["HolidayID"].ToString());
                            objHolidayBO.LastModifiedBy   = Convert.ToInt32(Session[ApplicationSession.USERID]);
                            objHolidayBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString();
                            objResult = objHolidayBL.Holiday_Update(objHolidayBO);
                            if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record updated successfully.');</script>");
                            }
                        }
                        ClearAll();
                        BindHoliday();
                        PanelVisibility(1);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Esempio n. 37
0
    protected void BtnAddMore_Click(object sender, EventArgs e)
    {
        string msg1 = null;

        try
        {
            DataSet ds = new DataSet();
            ds = proc.SQLExecuteDataset("SP_LeaveTxns",
                                        new SqlParameter()
            {
                ParameterName = "@IMode", SqlDbType = SqlDbType.Int, Value = 8
            },
                                        new SqlParameter()
            {
                ParameterName = "@LeaveId", SqlDbType = SqlDbType.Int, Value = Convert.ToInt32(Request.QueryString["RSN"])
            }
                                        );
            if (ds.Tables[0].Rows.Count > 0)
            {
                double lvdays = (Convert.ToDouble(ds.Tables[0].Rows[0]["ApplyLeave"])) - (Convert.ToDouble(ds.Tables[0].Rows[0]["ApplyLeave"]));
                double lvtemp = Convert.ToDouble(TxtLeaveDays.Text);
                if ((lvdays - lvtemp) == 0)
                {
                    msg1 = CheckLeave();
                    if (msg1 == "OK")
                    {
                        SaveData();
                        LoadLeave(Session["SID"].ToString());
                        ClientScript.RegisterStartupScript(typeof(Page), "close", "<script type='text/javascript'>alert('Leave transaction has been saved successfully!'); window.opener.location.reload(); window.close();</script>");
                    }
                    else
                    {
                        WebMsgBox.Show(msg1);
                    }
                }
                else if ((lvdays - lvtemp) > 0)
                {
                    msg1 = CheckLeave();
                    if (msg1 == "OK")
                    {
                        SaveData();
                        LoadLeave(Session["SID"].ToString());
                        WebMsgBox.Show("Leave transaction has been saved successfully!");
                    }
                    else
                    {
                        WebMsgBox.Show(msg1);
                    }
                }
                else if ((lvdays - lvtemp) < 0)
                {
                    WebMsgBox.Show("You cannot apply. Please check it!");
                }
            }
            //msg1 = CheckLeave();
            //if (msg1 == "OK")
            //{
            //    SaveData();
            //    LoadLeave(Session["SID"].ToString());
            //    WebMsgBox.Show("Leave transaction has been saved successfully!");
            //}
        }
        catch (Exception ex)
        {
            WebMsgBox.Show("Error on save the leave transaction!");
        }
    }
Esempio n. 38
0
    // Use this for initialization
    public void Start()
    {
        DontDestroyOnLoad(this);

        loginMenu = loginMenu.GetComponent<Canvas> ();
        loginFailedMenu = loginFailedMenu.GetComponent<Canvas> ();
        loginSuccessMenu = loginSuccessMenu.GetComponent<Canvas> ();
        loginNewUserMenu = loginNewUserMenu.GetComponent<Canvas> ();
        loginNewUserFailedMenu = loginNewUserFailedMenu.GetComponent<Canvas>();
        loggedInMenu = loggedInMenu.GetComponent<Canvas>();
        lobbyMenu = lobbyMenu.GetComponent<Canvas>();
        sessionFailedMenu = sessionFailedMenu.GetComponent<Canvas>();

        menuGUI = GameObject.FindGameObjectWithTag("Menus");
        menu = menuGUI.GetComponent<MenuScript>();

        lobbyName = lobbyName.GetComponent<InputField>();

        currentUsername = currentUsername.GetComponent<Text> ();
        currentUsername.text = "";

        username = username.GetComponent<InputField> ();
        password = password.GetComponent<InputField> ();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript> ();
        connectionStarted = false;

        if (!clientManager.getLoggedIn())
        {
            loginMenu.enabled = true;
            loginFailedMenu.enabled = false;
            loginSuccessMenu.enabled = false;
            loginNewUserMenu.enabled = false;
            loginNewUserFailedMenu.enabled = false;
            loggedInMenu.enabled = false;
            sessionFailedMenu.enabled = false;
            lobbyMenu.enabled = false;
        }
        else
        {
            loginMenu.enabled = false;
            loginFailedMenu.enabled = false;
            loginSuccessMenu.enabled = false;
            loginNewUserMenu.enabled = false;
            loginNewUserFailedMenu.enabled = false;
            loggedInMenu.enabled = true;
            lobbyMenu.enabled = false;
            sessionFailedMenu.enabled = false;
            currentUsername.text = clientManager.getUsername();
        }
    }
Esempio n. 39
0
    public void GetCYWLT()
    {
        clearText();

        string qsnumber = TextBox1.Text.Trim();

        string qs = DropDownList_QiShu.SelectedValue;

        if (!WTreeBLL.IsRoot(qsnumber, qs, ViewState["dc"].ToString()))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('你不能查看该网络!')</script>");
            return;
        }


        //链路图
        LitLLT.Text = WTreeBLL.SetLianLuTu_CYWLII(ViewState["dc"].ToString(), qsnumber, qs);

        //第一层
        CYWLTModel cm = WTreeBLL.GetCYWLTModelII(qsnumber, qs, "1", "");

        if (cm != null)
        {
            dyc1.Text = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cm.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cm.Number + "</a>";
            dyc2.Text = cm.PetName;
            dyc3.Text = cm.Level;
            dyc4.Text = cm.ZY;
            dyc5.Text = cm.XY;
            dyc6.Text = cm.SY;
            dyc7.Text = cm.Left;
            dyc8.Text = cm.Right;
        }

        //第二层
        CYWLTModel cml2 = WTreeBLL.GetCYWLTModelII(cm == null ? "" : cm.Number, qs, "2", "");

        if (cml2 != null)
        {
            dec1.Text = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cml2.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cml2.Number + "</a>";
            dec2.Text = cml2.PetName;
            dec3.Text = cml2.Level;
            dec4.Text = cml2.ZY;
            dec5.Text = cml2.XY;
            dec6.Text = cml2.SY;
            dec7.Text = cml2.Left;
            dec8.Text = cml2.Right;
        }

        CYWLTModel cmr2 = WTreeBLL.GetCYWLTModelII(cm == null ? "" : cm.Number, qs, "2", cml2 == null?"":cml2.Number);

        if (cmr2 != null)
        {
            dec9.Text  = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cmr2.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cmr2.Number + "</a>";
            dec10.Text = cmr2.PetName;
            dec11.Text = cmr2.Level;
            dec12.Text = cmr2.ZY;
            dec13.Text = cmr2.XY;
            dec14.Text = cmr2.SY;
            dec15.Text = cmr2.Left;
            dec16.Text = cmr2.Right;
        }

        //第三层
        CYWLTModel cml3_1 = WTreeBLL.GetCYWLTModelII(cml2 == null ? "" : cml2.Number, qs, "3", "");

        if (cml3_1 != null)
        {
            dsc1.Text = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cml3_1.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cml3_1.Number + "</a>";
            dsc2.Text = cml3_1.PetName;
            dsc3.Text = cml3_1.Level;
            dsc4.Text = cml3_1.ZY;
            dsc5.Text = cml3_1.XY;
            dsc6.Text = cml3_1.SY;
            dsc7.Text = cml3_1.Left;
            dsc8.Text = cml3_1.Right;
        }

        CYWLTModel cml3_2 = WTreeBLL.GetCYWLTModelII(cml2 == null ? "" : cml2.Number, qs, "3", cml3_1 == null?"":cml3_1.Number);

        if (cml3_2 != null)
        {
            dsc9.Text  = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cml3_2.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cml3_2.Number + "</a>";
            dsc10.Text = cml3_2.PetName;
            dsc11.Text = cml3_2.Level;
            dsc12.Text = cml3_2.ZY;
            dsc13.Text = cml3_2.XY;
            dsc14.Text = cml3_2.SY;
            dsc15.Text = cml3_2.Left;
            dsc16.Text = cml3_2.Right;
        }

        CYWLTModel cmr3_1 = WTreeBLL.GetCYWLTModelII(cmr2 == null ? "" : cmr2.Number, qs, "3", "");

        if (cmr3_1 != null)
        {
            dsc17.Text = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cmr3_1.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cmr3_1.Number + "</a>";
            dsc18.Text = cmr3_1.PetName;
            dsc19.Text = cmr3_1.Level;
            dsc20.Text = cmr3_1.ZY;
            dsc21.Text = cmr3_1.XY;
            dsc22.Text = cmr3_1.SY;
            dsc23.Text = cmr3_1.Left;
            dsc24.Text = cmr3_1.Right;
        }

        CYWLTModel cmr3_2 = WTreeBLL.GetCYWLTModelII(cmr2 == null ? "" : cmr2.Number, qs, "3", cmr3_1 == null?"":cmr3_1.Number);

        if (cmr3_2 != null)
        {
            dsc25.Text = "<a style='color:red' href='CommonlyNetworkII.aspx?qsNumber=" + cmr3_2.Number + "&EndNumber=" + ViewState["dc"] + "'>" + cmr3_2.Number + "</a>";
            dsc26.Text = cmr3_2.PetName;
            dsc27.Text = cmr3_2.Level;
            dsc28.Text = cmr3_2.ZY;
            dsc29.Text = cmr3_2.XY;
            dsc30.Text = cmr3_2.SY;
            dsc31.Text = cmr3_2.Left;
            dsc32.Text = cmr3_2.Right;
        }
    }