Ejemplo n.º 1
0
    private void chart5()
    {
        using (WebClient client = new WebClient())
        {
            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            //URL = "http://localhost:50463/Service1.svc";

            string strQuery = "SELECT COUNT(case when client_status_with_rms = 'Connected' then client_status_with_rms end) as Connected, COUNT(case when client_status_with_rms = 'Disconnected' then client_status_with_rms end) as Disconnected FROM pcmc.health_recent";

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

            string result = client.UploadString(URL + "/GetPieChart", "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);

            Reply objReply = json.Deserialize <Reply>(reader);
            //Chart5 Start
            string[] seriesArray = { "Activated", "Pending" };
            int[]    pointsArray = new int[2];

            if (objReply.res && objReply.DS != null)
            {
                pointsArray[0] = Convert.ToInt32(objReply.DS.Tables[0].Rows[0][0]);
                pointsArray[1] = Convert.ToInt32(objReply.DS.Tables[0].Rows[0][1]);
            }

            Title title = Chart5.Titles.Add("Title1");
            title.Font = new System.Drawing.Font("Arial", 16, FontStyle.Bold);
            Chart5.Titles["Title1"].Text = "Machine Activated";
            Chart5.Series["Series1"].Points.DataBindXY(seriesArray, pointsArray);
            Chart5.Series["Series1"].Points[0].Color = Color.Green;
            Chart5.Series["Series1"].Points[1].Color = Color.Red;


            CalloutAnnotation objAnnotation = new CalloutAnnotation();
            objAnnotation.AnchorDataPoint = Chart5.Series["Series1"].Points[0];
            objAnnotation.Text            = pointsArray[0].ToString();
            objAnnotation.Visible         = true;
            Chart5.Annotations.Add(objAnnotation);

            CalloutAnnotation objAnnotation1 = new CalloutAnnotation();
            objAnnotation1.AnchorDataPoint = Chart5.Series["Series1"].Points[1];
            objAnnotation1.Text            = pointsArray[1].ToString();
            objAnnotation1.Visible         = true;
            Chart5.Annotations.Add(objAnnotation1);

            seriesArray    = null;
            pointsArray    = null;
            objAnnotation  = null;
            objAnnotation1 = null;
        }
    }
Ejemplo n.º 2
0
    private void bindBranchlist(string LHO)
    {
        MB_txt_branchName.Text      = MB_txt_Region.Text =
            MB_txt_ModuleCode.Text  = MB_txt_ModuleName.Text =
                MB_txt_Network.Text = "";

        if (Session["Role"].ToString().ToLower().Contains("admin"))
        {
            parameter = "all##" + LHO;
        }
        else
        {
            parameter = Session["Role"].ToString() + "#" + Session["Location"].ToString() + LHO;
        }

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

        Reply objRes = new Reply();

        using (WebClient client = new WebClient())
        {
            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
            string     JsonString    = JsonConvert.SerializeObject(parameter);
            EncRequest objEncRequest = new EncRequest();
            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
            string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
            objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
            //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
            //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
            //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
            //objRes = (Reply)objDCS.ReadObject(objMS);

            Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
            {
                MB_ddl_branch_code.DataSource    = objRes.DS;
                MB_ddl_branch_code.DataTextField = "b_code";
                MB_ddl_branch_code.DataBind();
                MB_ddl_branch_code.Items.Insert(0, new ListItem("--Select Branch Code--"));
            }
            else
            {
                PageUtility.MessageBox(this, "Branch Code List Not found");
            }
        }
    }
Ejemplo n.º 3
0
    private void bindstatelist()
    {
        try
        {
            if (objDataSet == null)
            {
                objDataSet = new DataSet();
            }

            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject("");
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);



                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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)
                {
                    filtercategories1.DataSource    = objRes.DS;
                    filtercategories1.DataTextField = "state";
                    filtercategories1.DataBind();
                    filtercategories1.Items.Insert(0, new ListItem("Select Circle", "NA"));
                    errorlabel.Style["display"] = "block";
                    kiosk_data.Text             = "";
                    kiosklist.Style["display"]  = "none";
                }
                else
                {
                    var page = HttpContext.Current.CurrentHandler as Page;
                    ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "alert('Some Error Occurred');windows.location.href='Dashboard-V3_1.aspx'", true);
                }
            }
        }
        catch (Exception ex)
        {
            var page = HttpContext.Current.CurrentHandler as Page;
            ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('catch error : " + ex.Message + "');", true);
        }
    }
Ejemplo n.º 4
0
    private void bindUserList()
    {
        try
        {
            Userlist.Items.Clear();
            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                if (Session["Role"].ToString() == "admin")
                {
                    parameter = "all";
                }
                else
                {
                    parameter = "user";
                }

                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(parameter);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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)
                {
                    Userlist.DataSource    = objRes.DS;
                    Userlist.DataTextField = "username";
                    Userlist.DataBind();
                    Userlist.Items.Insert(0, new ListItem("New User", "NA"));
                }
                else
                {
                    Userlist.Items.Insert(0, new ListItem("New User", "NA"));
                }
            }
        }
        catch (Exception ex)
        {
            Userlist.Items.Insert(0, new ListItem("New User", "NA"));
        }
    }
Ejemplo n.º 5
0
    private void bindCirclelist(string type)
    {
        try
        {
            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(parameter);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer();
                json.NullValueHandling = NullValueHandling.Ignore;
                StringReader sr = new StringReader(objResponse.ResponseData);
                Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                objRes = json.Deserialize <Reply>(reader);
                locationList.Items.Clear();
                if (objRes.res == true)
                {
                    locationList.DataSource = objRes.DS;
                    if (UserType.SelectedIndex == 2)
                    {
                        locationList.DataTextField = type;
                    }
                    else
                    {
                        locationList.DataTextField = "branch_name";
                    }

                    locationList.DataBind();
                    locationList.Items.Insert(0, new ListItem("Select", "NA"));
                }
                else
                {
                    locationList.Items.Insert(0, new ListItem("No location found", "NA"));
                }
                locationList.Enabled = true;
            }
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }
    private void bindLHOlist()
    {
        try
        {
            if (objDataSet == null)
            {
                objDataSet = new DataSet();
            }

            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject("");
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result));

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS); ;


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer();
                json.NullValueHandling = NullValueHandling.Ignore;
                StringReader sr = new StringReader(objResponse.ResponseData);
                Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                objRes = json.Deserialize <Reply>(reader);

                ddl_lho_list.Items.Clear();
                if (objRes.res == true && objRes.DS.Tables[0].Rows.Count > 0)
                {
                    ddl_lho_list.DataSource    = objRes.DS;
                    ddl_lho_list.DataTextField = "state";
                    ddl_lho_list.DataBind();
                    ddl_lho_list.Items.Insert(0, new ListItem("Select Circle", "NA"));
                }
                else
                {
                    PageUtility.MessageBox(this, "LHO List Not found");
                }
            }
        }
        catch (Exception ex)
        {
            PageUtility.MessageBox(this, "catch error : " + ex.Message + "");
        }
    }
Ejemplo n.º 7
0
    public void bindKioskHealth(string s)
    {
        try
        {
            DataSet objds = new DataSet();

            Reply objRes = new Reply();
            // send request
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                //URL = "http://localhost:50462/Service1.svc";
                string     JsonString    = JsonConvert.SerializeObject(s);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);
                string result        = client.UploadString(URL + "/GetKioskHealth", "POST", dataEncrypted);

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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)
                {
                    //Data Source
                    kiosk_ip.InnerText = objRes.DS.Tables[0].Rows[0]["Kiosk IP"].ToString();
                    kiosk_id.InnerText = objRes.DS.Tables[0].Rows[0]["Kiosk ID"].ToString();

                    cash.InnerText           = objRes.DS.Tables[0].Rows[0]["D1"].ToString();
                    reciept.InnerText        = objRes.DS.Tables[0].Rows[0]["D2"].ToString();
                    barcode.InnerText        = objRes.DS.Tables[0].Rows[0]["D3"].ToString();
                    doc.InnerText            = objRes.DS.Tables[0].Rows[0]["D4"].ToString();
                    camera.InnerText         = objRes.DS.Tables[0].Rows[0]["D5"].ToString();
                    vccamera.InnerText       = objRes.DS.Tables[0].Rows[0]["D6"].ToString();
                    cardreader.InnerText     = objRes.DS.Tables[0].Rows[0]["D7"].ToString();
                    laserprinter.InnerText   = objRes.DS.Tables[0].Rows[0]["D8"].ToString();
                    fingurescanner.InnerText = objRes.DS.Tables[0].Rows[0]["D9"].ToString();
                    keypadmouse.InnerText    = objRes.DS.Tables[0].Rows[0]["D10"].ToString();
                    signagetv.InnerText      = objRes.DS.Tables[0].Rows[0]["D11"].ToString();
                    touchscreen.InnerText    = objRes.DS.Tables[0].Rows[0]["D12"].ToString();
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('" + objRes.strError + "')</script>");
                }
            }
        }
        catch (Exception excp)
        {
            Response.Write("<script type='text/javascript'>alert( 'Service Error Occured Machine Not Connected:-" + excp.Message + "' )</script>");
        }
    }
Ejemplo n.º 8
0
    private void GetBranchDetails(string BranchCode)
    {
        if (objDataSet == null)
        {
            objDataSet = new DataSet();
        }

        Reply objRes = new Reply();

        using (WebClient client = new WebClient())
        {
            parameter = BranchCode;

            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
            string JsonString = JsonConvert.SerializeObject(parameter);

            EncRequest objEncRequest = new EncRequest();
            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);

            string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
            objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);

            //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
            //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
            //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
            //objRes = (Reply)objDCS.ReadObject(objMS);

            Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
            {
                MB_txt_branchName.Text   = objRes.DS.Tables[0].Rows[0]["branch_name"].ToString();
                MB_txt_Region.Text       = objRes.DS.Tables[0].Rows[0]["region"].ToString();
                MB_txt_ModuleName.Text   = objRes.DS.Tables[0].Rows[0]["module_name"].ToString();
                MB_txt_ModuleCode.Text   = objRes.DS.Tables[0].Rows[0]["module_code"].ToString();
                MB_txt_Network.Text      = objRes.DS.Tables[0].Rows[0]["network"].ToString();
                MB_txt_PersonName.Text   = objRes.DS.Tables[0].Rows[0]["ContactPersonName"].ToString();
                MB_txt_PersonNumber.Text = objRes.DS.Tables[0].Rows[0]["ContactPersonNumber"].ToString();
                MB_txt_Email.Text        = objRes.DS.Tables[0].Rows[0]["Email_To"].ToString();
            }
            else
            {
                PageUtility.MessageBox(this, "Data Not Found");
            }
        }
    }
Ejemplo n.º 9
0
    private void bindPulledData(string state)
    {
        try
        {
            if (objDataSet == null)
            {
                objDataSet = new DataSet();
            }

            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(state);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
                {
                    GV_Pulled_data.DataSource = objRes.DS.Tables[0];
                    GV_Pulled_data.DataBind();
                }
                else
                {
                    GV_Pulled_data.DataSource = null;
                    GV_Pulled_data.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            var page = HttpContext.Current.CurrentHandler as Page;
            ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('catch error : " + ex.Message + "');", true);
        }
    }
Ejemplo n.º 10
0
    public void bindKioskHealth()
    {
        try
        {
            int connected    = 0;
            int Disconnected = 0;


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

            Reply objRes = new Reply();
            // send request
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                //URL = "http://localhost:50462/Service1.svc";
                string     JsonString    = JsonConvert.SerializeObject("KioskList");
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                string result = client.UploadString(URL + "/GetTxnDetails", "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);
                JsonTextReader reader = new JsonTextReader(sr);
                objRes = json.Deserialize <Reply>(reader);

                if (objRes.res == true)
                {
                    ErrorImg.Visible           = false;
                    GV_Kiosk_Health.Visible    = true;
                    objGlobal.DS               = objRes.DS;
                    GV_Kiosk_Health.DataSource = objRes.DS;
                    GV_Kiosk_Health.DataBind();
                }
                else
                {
                    ErrorImg.Visible = true;
                }
            }
        }
        catch (Exception excp)
        {
            Response.Write("<script type='text/javascript'>alert( 'Service Error Occured Machine Not Connected:-" + excp.Message + "' )</script>");
        }
    }
Ejemplo n.º 11
0
    private bool SendCOmmand(string LHOName, string Command, out DataSet ds)
    {
        Reply objRes = new Reply();

        ds = null;
        using (WebClient client = new WebClient())
        {
            if (Session["Role"].ToString().Contains("admin"))
            {
                perameter = "all#" + LHOName + "#" + Command;   // role # lhoname # commandname (TotMc)
                                                                //-    @Role = N'all',
                                                                //-	@location = N'Ahmedabad',
                                                                //-	@Command = N'totMc'
            }
            else
            {
                perameter = Session["Role"].ToString() + "#" + Session["Location"].ToString();
            }

            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
            string     JsonString    = JsonConvert.SerializeObject(perameter);
            EncRequest objEncRequest = new EncRequest();
            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
            string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

            string result = client.UploadString(URL + "/Get_LHO_Details", "POST", dataEncrypted);  // , "\"" + perameter + "\"" |   GetDashBoardDetail |GetHealthTxnDataWithState

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
            objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
            //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
            //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
            //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
            //objRes = (Reply)objDCS.ReadObject(objMS);

            Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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)
            {
                ds = objRes.DS;
                return(true);
            }
            else
            {
                return(false);
            }
        }
    }
Ejemplo n.º 12
0
    public void GetMachin(string Number)
    {
        try
        {
            Reply objRes = new Reply();
            // send request
            using (WebClient client = new WebClient())
            {
                parameter = Number;

                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;

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

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);

                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
                {
                    PageUtility.MessageBox(this, "Machine is already Registered.");
                    btn_Create_Machine.Visible = false;
                }
                else
                {
                    btn_Create_Machine.Visible = true;
                }
            }
        }
        catch (Exception ex)
        {
            PageUtility.MessageBox(this, "catch error : " + ex.Message + "");

            btn_Create_Machine.Visible = false;
        }
    }
    private void SearchBranchName_Code(string type, string Value)
    {
        if (objDataSet == null)
        {
            objDataSet = new DataSet();
        }

        Reply objRes = new Reply();

        using (WebClient client = new WebClient())
        {
            if (Session["Role"].ToString().ToLower().Contains("admin"))
            {
                parameter = type + "#" + Value;
            }

            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
            string     JsonString    = JsonConvert.SerializeObject(parameter);
            EncRequest objEncRequest = new EncRequest();
            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
            string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
            objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);

            //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
            //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
            //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
            //objRes = (Reply)objDCS.ReadObject(objMS);

            Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
            {
                PageUtility.MessageBox(this, "Branch Name already exist! . Try again.");
                btn_save_branch.Enabled = false;
            }
            else
            {
                btn_save_branch.Enabled = true;
            }
        }
    }
Ejemplo n.º 14
0
    private void GetDetailReport()
    {
        try
        {
            string sendstring = "";
            sendstring = filtertype.SelectedIndex + "#" + Modefilter.SelectedIndex;
            Reply objRes = new Reply();

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

            WebClient client1 = new WebClient();
            client1.Headers[HttpRequestHeader.ContentType] = "text/json";
            string result1 = client1.UploadString(URL + "/GetActivatedKioskReport", "POST", dataEncrypted);

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

            if (objRes.res)
            {
                GV_Kiosk_Health.DataSource = objRes.DS;
                GV_Kiosk_Health.Visible    = true;
                GV_Kiosk_Health.DataBind();
                ErrorImg.Visible = false;
                pdfdiv.Visible   = true;
                exdiv.Visible    = true;
                Session["Data"]  = objRes.DS;
            }
            else
            {
                Session["Data"]         = null;
                GV_Kiosk_Health.Visible = false;
                ErrorImg.Visible        = true;
            }
        }
        catch (Exception ex)
        {
            Session["Data"]         = null;
            ErrorImg.Visible        = true;
            GV_Kiosk_Health.Visible = false;
        }
    }
Ejemplo n.º 15
0
    protected void btnReset_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(usernametext2.Text))
        {
            string password = CreateRandomPassword(8);

            ResetPassword objReq = new ResetPassword();
            objReq.name     = usernametext2.Text;
            objReq.password = password;

            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(objReq);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                string resultUser = client.UploadString(URL + "/ResetPassword", "POST", dataEncrypted);

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(resultUser);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //resultUser = (string)objDCS.ReadObject(objMS);

                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer();
                json.NullValueHandling = NullValueHandling.Ignore;
                StringReader sr = new StringReader(objResponse.ResponseData);
                Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                resultUser = json.Deserialize <string>(reader);

                if (resultUser == "true")
                {
                    PageUtility.MessageBox(this, "Password is :-  " + password);
                }
                else
                {
                    PageUtility.MessageBox(this, "Error :-  " + resultUser);
                }
            }
        }
        else
        {
            PageUtility.MessageBox(this, "Please enter User Name ! ");
        }
    }
Ejemplo n.º 16
0
    public void bindKioskDetails()
    {
        Reply objRes = new Reply();

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


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

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

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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)
                {
                    GV_Kiosk_Details.DataSource = objRes.DS;
                    GV_Kiosk_Details.DataBind();
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('" + objRes.strError + "')</script>");
                }
            }
        }
        catch (Exception excp)
        {
            Response.Write("<script type='text/javascript'>alert('" + objRes.strError + "')</script>");
        }
    }
Ejemplo n.º 17
0
    private void bindLocationddl()
    {
        try
        {
            WebClient client = new WebClient();
            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            string strQuery = "SELECT distinct location FROM pcmc.kiosk_master where location <> '' or location<> null";

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

            string result = client.UploadString(URL + "/GetPieChart", "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);

            Reply objReply = json.Deserialize <Reply>(reader);

            if (objReply.res && objReply.DS != null && objReply.DS.Tables[0] != null)
            {
                foreach (DataRow item in objReply.DS.Tables[0].Rows)
                {
                    ddlLocations.Items.Add(item[0].ToString());
                }
            }
        }
        catch (Exception ex)
        {
            throw;
        }
    }
Ejemplo n.º 18
0
    public static Result EncryptV10(string pwd, string encryptedKey, out byte[] password)
    {
        Result res = ExtractEncryptedKey(encryptedKey, out byte[] encryptedBytes);

        if (res != Result.Success)
        {
            password = null;
            return(res);
        }

        byte[] version = Encoding.ASCII.GetBytes(MODE_V10);
        string ver     = Encoding.ASCII.GetString(version);

        if (ver != MODE_V10)
        {
            password = null;
            return(Result.UnsupportedProtocol);
        }

        byte[] nonce = AesGcm256.Nonce(12);
        res = AesGcm256.Encrypt(pwd, encryptedBytes, nonce, out byte[] ciphertextTag);
        if (res != Result.Success)
        {
            password = null;
            return(res);
        }

        res = CombineCipherText(version, nonce, ciphertextTag, out password);
        if (res != Result.Success)
        {
            password = null;
            return(res);
        }

        return(Result.Success);
    }
Ejemplo n.º 19
0
    private void chart7()
    {
        WebClient client = new WebClient();

        client.Headers[HttpRequestHeader.ContentType] = "text/json";

        //Chart7 Start
        string[] seriesArray = { "Offline Activate Machine", "Online Activate Machine" };
        int[]    pointsArray = new int[2];

        // string strQuery = "SELECT COUNT(case when [Status] = '000' then [Status] end) as Successful,COUNT(case when [Status] != '000' then [Status] end)as Unsuccessful FROM pcmc.o.[cashtxndetails] where [TxnDate] >= '" + DateTime.Now.ToString("yyyy-MM-dd") + "' and [TxnDate] <= '" + DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59'";
        DateTime healthTime = DateTime.Now.AddHours(-2);
        string   strQuery   = "SELECT * FROM pcmc.health_recent ";


        string     JsonString    = JsonConvert.SerializeObject(strQuery);
        EncRequest objEncRequest = new EncRequest();

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

        string result = client.UploadString(URL + "/GetPieChart", "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);

        Reply objReply = json.Deserialize <Reply>(reader);

        int connected    = 1;
        int disConnected = 0;


        //foreach (DataRow item in objReply.DS.Tables[0].Rows)
        //{
        //    var timestr = item["date_time"].ToString();
        //    DateTime dt = DateTime.ParseExact(timestr, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);

        //    if (dt > healthTime)
        //    {
        //        connected++;
        //    }
        //    else {
        //        disConnected++;
        //    }
        //}



        pointsArray[0] = disConnected;
        pointsArray[1] = connected;


        Title title = Chart7.Titles.Add("Title1");

        title.Font = new System.Drawing.Font("Arial", 16, FontStyle.Bold);
        Chart7.Titles["Title1"].Text = "Machine Connected with server";
        Chart7.Series["Series1"].Points.DataBindXY(seriesArray, pointsArray);
        Chart7.Series["Series1"].Points[0].Color = Color.Red;
        Chart7.Series["Series1"].Points[1].Color = Color.Green;


        CalloutAnnotation objAnnotation = new CalloutAnnotation();

        objAnnotation.AnchorDataPoint = Chart7.Series["Series1"].Points[0];
        objAnnotation.Text            = pointsArray[0].ToString();
        objAnnotation.Visible         = true;
        Chart7.Annotations.Add(objAnnotation);

        CalloutAnnotation objAnnotation1 = new CalloutAnnotation();

        objAnnotation1.AnchorDataPoint = Chart7.Series["Series1"].Points[1];
        objAnnotation1.Text            = pointsArray[1].ToString();
        objAnnotation1.Visible         = true;
        Chart7.Annotations.Add(objAnnotation1);

        objAnnotation  = null;
        objAnnotation1 = null;
    }
Ejemplo n.º 20
0
    protected void downloadCommand_Click(object sender, EventArgs e)
    {
        try
        {
            if ((MachineLogs.Checked || EJLogs.Checked) && (startDT.Text == "" || endDT.Text == ""))
            {
                srch.Value   = "";
                startDT.Text = ""; endDT.Text = "";
                bindKioskHealth(filtercategories1.SelectedItem.Text);
                var page = HttpContext.Current.CurrentHandler as Page;
                ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Fill Start Date and End Date');", true);
                return;
            }
            else if (OtherData.Checked && (orderid.Text == "" || filtercategories.SelectedIndex == 0))
            {
                srch.Value   = "";
                startDT.Text = ""; endDT.Text = "";
                bindKioskHealth(filtercategories1.SelectedItem.Text);
                DownloadData.Style["display"] = "block";
                SelectDate.Style["display"]   = "none";
                OtherData.Checked             = true;
                var page = HttpContext.Current.CurrentHandler as Page;
                ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Select Type and Give Valid Path');", true);
                return;
            }
            else
            {
                ReqCommandExecute reqCommandExecute = new ReqCommandExecute();
                string            CommandString     = "";
                if (MachineLogs.Checked || EJLogs.Checked)
                {
                    if (MachineLogs.Checked)
                    {
                        CommandString = "MachineLogs";
                    }
                    else
                    {
                        CommandString = "EjLogs";
                    }

                    DateTime startDate, endDate;

                    if (!DateTime.TryParseExact(startDT.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out startDate) || !DateTime.TryParseExact(endDT.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out endDate))
                    {
                        srch.Value   = "";
                        startDT.Text = ""; endDT.Text = "";
                        bindKioskHealth(filtercategories1.SelectedItem.Text);
                        var page = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Date Format Not Proper');", true);
                        return;
                    }
                    else if (startDate > endDate || endDate > DateTime.Today)
                    {
                        srch.Value = "";
                        bindKioskHealth(filtercategories1.SelectedItem.Text);
                        startDT.Text = ""; endDT.Text = "";
                        var page = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Start Date can not be greater than End Date and End Date should be less than equal to today');", true);
                        return;
                    }

                    if ((endDate.Date - startDate.Date).TotalDays > 7)
                    {
                        srch.Value = "";
                        bindKioskHealth(filtercategories1.SelectedItem.Text);
                        var page = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Date difference should be less than or equal to 7 days.');", true);
                        return;
                    }

                    CommandString += "#" + startDate.ToString("yyyy-MM-dd") + "#" + endDate.ToString("yyyy-MM-dd");
                    reqCommandExecute.DisplayData = "Log Pull";
                }
                else
                {
                    CommandString = "OtherData#" + filtercategories.SelectedItem.Text + "#" + orderid.Text;
                    DownloadData.Style["display"] = "block";
                    SelectDate.Style["display"]   = "none";
                    OtherData.Checked             = true;
                    reqCommandExecute.DisplayData = filtercategories.SelectedItem.Text + " Pull";
                }

                string[] ipArray = hiddenItem.Value.Split('#');
                Array.Resize(ref ipArray, ipArray.Length - 1);
                reqCommandExecute.KioskIPs  = ipArray;
                reqCommandExecute.Command   = CommandString;
                reqCommandExecute.Patchdata = "";
                using (WebClient client = new WebClient())
                {
                    client.Headers[HttpRequestHeader.ContentType] = "text/json";
                    ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                    string     JsonString    = JsonConvert.SerializeObject(reqCommandExecute);
                    EncRequest objEncRequest = new EncRequest();
                    objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                    string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

                    string result1 = client.UploadString(URL + "/CommandExecute", "POST", dataEncrypted);

                    EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result1);
                    objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);

                    //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                    //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                    //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                    //ResCommandExecute objRes = (ResCommandExecute)objDCS.ReadObject(objMS);


                    Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer();
                    json.NullValueHandling = NullValueHandling.Ignore;
                    StringReader sr = new StringReader(objResponse.ResponseData);
                    Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
                    ResCommandExecute objRes = json.Deserialize <ResCommandExecute>(reader);

                    if (objRes.Result)
                    {
                        srch.Value   = "";
                        startDT.Text = ""; endDT.Text = "";
                        var page = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Request Send SuccessFully');", true);
                        bindKioskHealth(filtercategories1.SelectedItem.Text);
                    }
                    else
                    {
                        srch.Value   = "";
                        startDT.Text = ""; endDT.Text = "";
                        var page = HttpContext.Current.CurrentHandler as Page;
                        ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Request Sending Failed');", true);
                        bindKioskHealth(filtercategories1.SelectedItem.Text);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            srch.Value   = "";
            startDT.Text = ""; endDT.Text = "";
            var page = HttpContext.Current.CurrentHandler as Page;
            ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('Exception :" + ex.Message + "');", true);
            bindKioskHealth(filtercategories1.SelectedItem.Text);
        }
    }
Ejemplo n.º 21
0
    public void bindKioskHealth(string state)
    {
        try
        {
            if (objDataSet == null)
            {
                objDataSet = new DataSet();
            }

            Reply objRes = new Reply();

            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(state);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS);


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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)
                {
                    if (objRes.DS.Tables[1].Rows.Count > 0)
                    {
                        GV_Pulled_data.DataSource = objRes.DS.Tables[1];
                        GV_Pulled_data.DataBind();
                    }
                    else
                    {
                        GV_Pulled_data.DataSource = null;
                        GV_Pulled_data.DataBind();
                    }
                    for (int iStateIndex = 0; iStateIndex < objRes.DS.Tables[0].Rows.Count; iStateIndex++)
                    {
                        State_List_with_IP += "<tr>" +
                                              "<td class=''>" +
                                              " <label class='option block mn'>" +
                                              " <input type = 'checkbox' name= 'inputname' value= 'FR'> " +
                                              " <span class='checkbox mn'></span> " +
                                              "  </label> " +
                                              " </td> " +
                                              " <td class=''>" + objRes.DS.Tables[0].Rows[iStateIndex][0].ToString() + "</td> " +
                                              " <td class=''>" + objRes.DS.Tables[0].Rows[iStateIndex][1].ToString() + "</td> " +
                                              " <td class=''>" + objRes.DS.Tables[0].Rows[iStateIndex][2].ToString() + "</td> " +
                                              " <td > " +
                                              " <span>" + objRes.DS.Tables[0].Rows[iStateIndex][3].ToString() + "</span> " +
                                              " </td> " +
                                              " <td class=''>" + objRes.DS.Tables[0].Rows[iStateIndex][4].ToString() + "</td> " +
                                              " <td class=''>" + objRes.DS.Tables[0].Rows[iStateIndex][5].ToString() + "</td> " +
                                              " </tr>";
                    }
                    errorlabel.Style["display"] = "none";
                    kiosklist.Style["display"]  = "block";
                    srch.Value      = "";
                    kiosk_data.Text = State_List_with_IP;
                }
                else
                {
                    var page = HttpContext.Current.CurrentHandler as Page;
                    ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('" + objRes.strError + "');", true);
                }
            }
        }
        catch (Exception ex)
        {
            var page = HttpContext.Current.CurrentHandler as Page;
            ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "errorDisplay('catch error : " + ex.Message + "');", true);
        }
    }
Ejemplo n.º 22
0
    private void chart3()
    {
        using (WebClient client = new WebClient())
        {
            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            // URL = "http://localhost:50463/Service1.svc";

            DateTime objTxnDtTime = DateTime.Today;

            string strQuery = "SELECT SUM(bill_payemnt_txn) as total_bill_payemnt_txn, SUM(birth_certificate_txn) as total_birth_certificate_txn, SUM(death_certificate_txn) as total_death_certificate_txn FROM seva_sindhu_" + objTxnDtTime.ToString("yy") + ".txn_detail_" + objTxnDtTime.ToString("MMM") + " where txn_date_time >= '" + DateTime.Now.ToString("yyyy-MM-dd") + "' and txn_date_time <= '" + DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59'";

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

            string result = client.UploadString(URL + "/GetPieChart", "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);

            Reply objReply = json.Deserialize <Reply>(reader);

            //Chart3 Start
            string[] seriesArray = { "Bill Payment", "Birth Certificate", "Death Certificate" };
            int[]    pointsArray = new int[3];

            if (objReply.res && objReply.DS != null)
            {
                pointsArray[0] = Convert.ToInt32(objReply.DS.Tables[0].Rows[0][0].ToString() != "" ? objReply.DS.Tables[0].Rows[0][0].ToString() : "0");
                pointsArray[1] = Convert.ToInt32(objReply.DS.Tables[0].Rows[0][1].ToString() != "" ? objReply.DS.Tables[0].Rows[0][1].ToString() : "0");
                pointsArray[2] = Convert.ToInt32(objReply.DS.Tables[0].Rows[0][2].ToString() != "" ? objReply.DS.Tables[0].Rows[0][2].ToString() : "0");
            }

            Title title = Chart3.Titles.Add("Title1");
            title.Font = new System.Drawing.Font("Arial", 16, FontStyle.Bold);
            Chart3.Titles["Title1"].Text = "Transaction Hitting On Service Type";
            Chart3.Series["Series1"].Points.DataBindXY(seriesArray, pointsArray);

            Chart3.Series["Series1"].Points[0].Color = Color.LightBlue;
            Chart3.Series["Series1"].Points[1].Color = Color.LightGreen;
            Chart3.Series["Series1"].Points[2].Color = Color.LightYellow;
            Chart3.Series["Series1"].ChartType       = SeriesChartType.Pie;

            CalloutAnnotation objAnnotation = new CalloutAnnotation();
            objAnnotation.AnchorDataPoint = Chart3.Series["Series1"].Points[0];
            objAnnotation.Text            = pointsArray[0].ToString();
            objAnnotation.Visible         = true;
            Chart3.Annotations.Add(objAnnotation);

            CalloutAnnotation objAnnotation1 = new CalloutAnnotation();
            objAnnotation1.AnchorDataPoint = Chart3.Series["Series1"].Points[1];
            objAnnotation1.Text            = pointsArray[1].ToString();
            objAnnotation1.Visible         = true;
            Chart3.Annotations.Add(objAnnotation1);


            CalloutAnnotation objAnnotation2 = new CalloutAnnotation();
            objAnnotation2.AnchorDataPoint = Chart3.Series["Series1"].Points[2];
            objAnnotation2.Text            = pointsArray[2].ToString();
            objAnnotation1.Visible         = true;
            Chart3.Annotations.Add(objAnnotation2);

            objAnnotation  = null;
            objAnnotation1 = null;
            objAnnotation2 = null;
        }
    }
Ejemplo n.º 23
0
    private void chart4()
    {
        //Chart4 Start
        DateTime objFromDate;
        DateTime objToDate;

        objToDate   = DateTime.Now.AddDays(-1);
        objFromDate = DateTime.Now.AddDays(-8);
        string[] seriesArray = new string[7];
        int      i;
        DateTime objWeek = DateTime.Today;

        for (i = 0; i < seriesArray.Length; i++)
        {
            objWeek            = objWeek.AddDays(-1);
            seriesArray[6 - i] = objWeek.ToString("dd-MMM-yy");
        }

        int[] pointsArray = new int[7];
        Title title       = Chart4.Titles.Add("Title1");

        title.Font = new System.Drawing.Font("Arial", 16, FontStyle.Bold);
        Chart4.Titles["Title1"].Text = "Last 7 Days Transaction Hitting";

        CalloutAnnotation objAnnotation = null;

        for (int iDays = 1; iDays <= 7; iDays++)  //Last 7 Days Txn
        {
            using (WebClient client = new WebClient())
            {
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                //URL = "http://localhost:50463/Service1.svc";

                DateTime objTxnDtTime = DateTime.Today;
                objTxnDtTime = objTxnDtTime.AddDays(-iDays);

                string strQuery = "SELECT bill_payemnt_txn as total_bill_payemnt_txn, birth_certificate_txn as total_birth_certificate_txn, death_certificate_txn as total_death_certificate_txn FROM seva_sindhu_" + objTxnDtTime.ToString("yy") + ".txn_detail_" + objTxnDtTime.ToString("MMM") + " where txn_date_time >= '" + objTxnDtTime.ToString("yyyy-MM-dd") + "' and txn_date_time <= '" + objTxnDtTime.ToString("yyyy-MM-dd") + " 23:59:59'";

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

                string result = client.UploadString(URL + "/GetPieChart", "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);

                Reply objReply = json.Deserialize <Reply>(reader);

                if (objReply.res && objReply.DS != null)
                {
                    pointsArray[7 - iDays] = Convert.ToInt32(objReply.DS.Tables[0].Rows[0][0].ToString() != "" ? objReply.DS.Tables[0].Rows[0][0].ToString() : "0") +
                                             Convert.ToInt32(objReply.DS.Tables[0].Rows[0][1].ToString() != "" ? objReply.DS.Tables[0].Rows[0][0].ToString() : "0") +
                                             Convert.ToInt32(objReply.DS.Tables[0].Rows[0][2].ToString() != "" ? objReply.DS.Tables[0].Rows[0][2].ToString() : "0");
                }
                else
                {
                    pointsArray[7 - iDays] = 0;
                }
            }
        }

        Chart4.Series["Series1"].Points.DataBindXY(seriesArray, pointsArray);

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[0];
        objAnnotation.Text            = pointsArray[0].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[1];
        objAnnotation.Text            = pointsArray[1].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[2];
        objAnnotation.Text            = pointsArray[2].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[3];
        objAnnotation.Text            = pointsArray[3].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[4];
        objAnnotation.Text            = pointsArray[4].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[5];
        objAnnotation.Text            = pointsArray[5].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;

        objAnnotation = new CalloutAnnotation();
        objAnnotation.AnchorDataPoint = Chart4.Series["Series1"].Points[6];
        objAnnotation.Text            = pointsArray[6].ToString();
        objAnnotation.Visible         = true;
        Chart4.Annotations.Add(objAnnotation);
        objAnnotation = null;
    }
Ejemplo n.º 24
0
    protected void search_Click(object sender, EventArgs e)
    {
        if (filtertype.SelectedIndex == 0)
        {
            Response.Write("<script>alert('Please Select Filter Type')</script>");
            return;
        }
        else
        {
            if (filtertype.SelectedIndex == 1 && machineiplist.SelectedIndex == 0)
            {
                Response.Write("<script>alert('Please Select Kiosk IP')</script>");
                return;
            }
            if (filtertype.SelectedIndex == 2 && machineidlist.SelectedIndex == 0)
            {
                Response.Write("<script>alert('Please Select Kiosk ID')</script>");
                return;
            }
            string sendString;
            if (filtertype.SelectedIndex == 1)
            {
                sendString = "1#" + machineiplist.SelectedValue;
            }
            else
            {
                sendString = "2#" + machineidlist.SelectedValue;
            }

            WebClient client1 = new WebClient();
            client1.Headers[HttpRequestHeader.ContentType] = "text/json";

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


            string      result1     = client1.UploadString(URL + "/GetScreenData", "POST", dataEncrypted);
            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result1);
            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);

            string objRes = json.Deserialize <string>(reader);
            if (objRes != "fail")
            {
                byte[] vs = Convert.FromBase64String(objRes);
                Response.Clear();
                // for the browser's download dialog
                Response.AddHeader("Content-Disposition",
                                   "attachment; filename=Screencapture" + DateTime.Now + ".zip");
                // Add a HTTP header to the output stream that contains the
                Response.AddHeader("Content-Length",
                                   vs.Length.ToString());
                // Set the HTTP MIME type of the output stream
                Response.ContentType = "application/zip";
                // Write the data out to the client.
                Response.BinaryWrite(vs);
            }
            else
            {
                ErrorImg.Visible = true;
            }
        }
    }
Ejemplo n.º 25
0
    protected void filtertype_SelectedIndexChanged(object sender, EventArgs e)
    {
        ErrorImg.Visible  = false;
        machineid.Visible = false;
        machineip.Visible = false;
        if (filtertype.SelectedIndex == 0)
        {
            return;
        }
        else if (filtertype.SelectedIndex == 1)
        {
            string s = "MachineIP";

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

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

            string result1 = client1.UploadString(URL + "/GetKioskReport", "POST", dataEncrypted);

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result1);
            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)
            {
                machineiplist.Items.Clear();
                machineiplist.DataSource    = objRes.DS;
                machineiplist.DataTextField = "kiosk_ip";
                machineiplist.DataBind();
                machineiplist.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "NA"));
                machineip.Visible = true;
            }
            else
            {
                Response.Write("<script>alert('Please try again after sometime as :" + objRes.strError + "')</script>");
            }
        }
        else if (filtertype.SelectedIndex == 2)
        {
            string s = "MachineID";

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

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

            string result1 = client1.UploadString(URL + "/GetKioskReport", "POST", dataEncrypted);

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result1);
            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)
            {
                machineidlist.Items.Clear();
                machineidlist.DataSource    = objRes.DS;
                machineidlist.DataTextField = "kiosk_id";
                machineidlist.DataBind();
                machineidlist.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "NA"));
                machineid.Visible = true;
            }
            else
            {
                Response.Write("<script>alert('Please try again after sometime as :" + objRes.strError + "')</script>");
            }
        }
    }
Ejemplo n.º 26
0
    private void bindKioskMasterlistKioskType(string Parameter)
    {
        try
        {
            if (objDataSet == null)
            {
                objDataSet = new DataSet();
            }

            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                if (Parameter == "")
                {
                    Parameter = "All";
                }
                //  else
                //  Parameter = DDLKioskLocationType.SelectedItem.Text;
                string URL = System.Configuration.ConfigurationManager.AppSettings["URL"].ToString();
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(Parameter);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result));

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS); ;


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
                {
                    lbl_tot.Text = "Total Records are : " + objRes.DS.Tables[0].Rows.Count.ToString();
                    GV_Kiosk_Details.DataSource = objRes.DS.Tables[0];
                    GV_Kiosk_Details.DataBind();
                    //ExportBtn.Visible = true;
                }
                else
                {
                    PageUtility.MessageBox(this, "Data Not Exist.");
                    lbl_tot.Text = "";
                    GV_Kiosk_Details.DataSource = null;
                    GV_Kiosk_Details.DataBind();
//ExportBtn.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            PageUtility.MessageBox(this, "catch error : " + ex.Message + "");
        }
    }
Ejemplo n.º 27
0
    //public void GetKioskHealth(string lho)
    //{
    //    try
    //    {
    //        Reply objRes = new Reply();
    //        // send request
    //        using (WebClient client = new WebClient())
    //        {
    //            if (Session["Role"].ToString().ToLower().Contains("admin"))
    //            {
    //                perameter = "all##" + lho;
    //            }
    //            else
    //            {
    //                perameter = Session["Role"].ToString() + "#" + Session["Location"].ToString() + "#";
    //            }
    //            client.Headers[HttpRequestHeader.ContentType] = "text/json";
    //            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    //            string JsonString = JsonConvert.SerializeObject(perameter);
    //            EncRequest objEncRequest = new EncRequest();
    //            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
    //            string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

    //            EncResponse objResponse = JsonConvert.DeserializeObject<EncResponse>(result);
    //            objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
    //            //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
    //            //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
    //            //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
    //            //objRes = (Reply)objDCS.ReadObject(objMS);

    //            Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
    //            {
    //                lbl_tot.Text = "Total Records are : " + objRes.DS.Tables[0].Rows.Count.ToString();
    //                GV_Kiosk_Details.DataSource = objRes.DS.Tables[0];
    //                GV_Kiosk_Details.DataBind();
    //                ExportBtn.Visible = true;
    //            }
    //            else
    //            {
    //                PageUtility.MessageBox(this, "Data Not Exist.");
    //                lbl_tot.Text = "";
    //                GV_Kiosk_Details.DataSource = null;
    //                GV_Kiosk_Details.DataBind();
    //                ExportBtn.Visible = false;
    //            }
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        PageUtility.MessageBox(this, "catch error : " + ex.Message + "");
    //        GV_Kiosk_Details.DataSource = null;
    //        GV_Kiosk_Details.DataBind();
    //        ExportBtn.Visible = false;
    //    }
    //}

    protected void btnExport_Click(object sender, EventArgs e)
    {
        try
        {
            if (objDataSet == null)
            {
                objDataSet = new DataSet();
            }

            Reply objRes = new Reply();
            using (WebClient client = new WebClient())
            {
                //  if (DDLKioskLocationType.SelectedItem.Text == "")
                // Parameter = "All";
                //  else
                //  Parameter = DDLKioskLocationType.SelectedItem.Text;
                string URL = System.Configuration.ConfigurationManager.AppSettings["URL"].ToString();
                client.Headers[HttpRequestHeader.ContentType] = "text/json";
                ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
                string     JsonString    = JsonConvert.SerializeObject(DDLKioskLocationType.SelectedItem.Text);
                EncRequest objEncRequest = new EncRequest();
                objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
                string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

                MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result));

                EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
                objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
                //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
                //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
                //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
                //objRes = (Reply)objDCS.ReadObject(objMS); ;


                Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.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 && objRes.DS.Tables[0].Rows.Count > 0)
                {
                    lbl_tot.Text = "Total Records are : " + objRes.DS.Tables[0].Rows.Count.ToString();
                    GV_Kiosk_Details.DataSource = objRes.DS.Tables[0];
                    GV_Kiosk_Details.DataBind();
                    // Clear all content output from the buffer stream
                    Response.ClearContent();
                    // Specify the default file name using "content-disposition" RESPONSE header
                    Response.AppendHeader("content-disposition", "attachment; filename=PbKioskLocationReport " + DateTime.Now.ToString("ddMMyy_HHmm") + ".xls");
                    // Set excel as the HTTP MIME type
                    Response.ContentType = "application/excel";
                    // Create an instance of stringWriter for writing information to a string
                    StringWriter stringWriter = new StringWriter();
                    // Create an instance of HtmlTextWriter class for writing markup
                    // characters and text to an ASP.NET server control output stream
                    HtmlTextWriter htw = new HtmlTextWriter(stringWriter);

                    int ColTot = GV_Kiosk_Details.Rows[0].Cells.Count;

                    HttpContext.Current.Response.Write("<Table border='1' bgColor='#ffffff' " +
                                                       "borderColor='#000000' Text-align='Center' cellSpacing='0' cellPadding='0' " + "style='font-size:10.0pt; font-family:Calibri; background:white'> " +
                                                       "<TR><TD COLSPAN='" + ColTot.ToString() + "' style='background:yellow; font-size:14.0pt; vertical-align:middle; Text-align:Center;  height:35px;'><B>" + globle.BankName + " PASSBOOK PRINTING KIOSKS - KIOSK MASTER REPORT GENERATED ON " + DateTime.Now.ToString("dd MMM yyyy, hh:mm tt") + "</B></TD></TR>");

                    GV_Kiosk_Details.HeaderStyle.ForeColor = Color.White;
                    GV_Kiosk_Details.HeaderStyle.BackColor = Color.Blue;
                    GV_Kiosk_Details.HeaderStyle.Font.Bold = true;
                    GV_Kiosk_Details.Font.Name             = "Calibri";

                    GV_Kiosk_Details.RenderControl(htw);


                    Response.Write(stringWriter.ToString());

                    HttpContext.Current.Response.Flush();

                    HttpContext.Current.Response.End();

                    Response.End();
                }
                else
                {
                    PageUtility.MessageBox(this, "Data Not Exist.");
                    lbl_tot.Text = "";
                    GV_Kiosk_Details.DataSource = null;
                    GV_Kiosk_Details.DataBind();
                    //ExportBtn.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            PageUtility.MessageBox(this, "catch error : " + ex.Message + "");
        }
    }
Ejemplo n.º 28
0
    protected void Broadcast_Click(object sender, EventArgs e)
    {
        CommandIniUpdate objReq = new CommandIniUpdate();

        if (tempList.SelectedValue.ToLower() == "datapurging")
        {
            objReq.Command = "datapurging#" + datapurg.Text + "#" + days.Text;
        }

        objReq.KioskIP     = new string[0];
        objReq.MachineSrNo = new string[0];
        int  newSize = 0;
        bool okey    = false;

        for (int i = 0; i < GV_Kiosk_Details.Rows.Count; i++)
        {
            CheckBox cb = (CheckBox)GV_Kiosk_Details.Rows[i].Cells[0].FindControl("cbSelect");//Gets the

            if (cb.Checked == true)
            {
                Array.Resize(ref objReq.KioskIP, newSize + 1);
                Array.Resize(ref objReq.MachineSrNo, newSize + 1);
                // how to get those select values and how store those values in array
                objReq.KioskIP[newSize]     = GV_Kiosk_Details.Rows[i].Cells[2].Text;
                objReq.MachineSrNo[newSize] = GV_Kiosk_Details.Rows[i].Cells[3].Text;
                newSize++;
                okey = true;
            }
        }
        if (okey == false)
        {
            Response.Write("<script type='text/javascript'>alert( 'Select Atleast one option' )</script>");
            return;
        }
        try
        {
            if (objds == null)
            {
                objds = new DataSet();
            }

            Reply objRes = new Reply();

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

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

                string result = client.UploadString(URL + "/CommandIniUpdate", "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);
                JsonTextReader reader = new JsonTextReader(sr);
                result = json.Deserialize <string>(reader);

                if (result.ToLower().Contains("true"))
                {
                    //Data Source
                    Response.Write("<script type='text/javascript'>alert('Ini Updated Succesfully')</script>");
                    bindKioskDetails();
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('" + objRes.strError + "')</script>");
                }
            }
        }
        catch (Exception excp)
        {
            Response.Write("<script type='text/javascript'>alert( 'catch error : '" + excp.Message + "' )</script>");
        }
    }
Ejemplo n.º 29
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        Reply objRes = new Reply();

        try
        {
            if (txtUserName.Text == "" || txtUserName.Text == null)
            {
                txtUserName.Text = "";
                txtUserName.Text = "";
                Response.Write("<script>alert('Kindly enter username')</script>");
                return;
            }
            if (txtPassword.Text == "" || txtPassword.Text == null)
            {
                txtUserName.Text = "";
                txtPassword.Text = "";
                Response.Write("<script>alert('Kindly enter password')</script>");
                return;
            }
            UserLogin userLogin      = new UserLogin();
            var       decodedString1 = Base64.Decode(txtUserName.Text);
            userLogin.UserName = Convert.ToString(TrimString(System.Text.Encoding.UTF8.GetString(decodedString1), '&'));
            var decodedString2 = Base64.Decode(txtPassword.Text);
            userLogin.Password = Convert.ToString(TrimString(System.Text.Encoding.UTF8.GetString(decodedString2), '*'));
            WebClient objWC = new WebClient();
            objWC.Headers[HttpRequestHeader.ContentType] = "text/json";

            string     JsonString    = JsonConvert.SerializeObject(userLogin);
            EncRequest objEncRequest = new EncRequest();
            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
            string EncData = JsonConvert.SerializeObject(objEncRequest);
            string result  = objWC.UploadString(URL + "/Login", "POST", EncData);

            EncResponse objEncResponse = JsonConvert.DeserializeObject <EncResponse>(result);
            objEncResponse.ResponseData = AesGcm256.Decrypt(objEncResponse.ResponseData);

            JsonSerializer json = new JsonSerializer();
            json.NullValueHandling = NullValueHandling.Ignore;
            StringReader sr = new StringReader(objEncResponse.ResponseData);
            Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
            objRes = json.Deserialize <Reply>(reader);

            if (objRes.res == true)
            {
                Session["Username"] = userLogin.UserName;
                Session["Role"]     = objRes.DS.Tables[0].Rows[0]["credential_type"].ToString();
                Response.Redirect("Dashboard//PieChart.aspx", false);

                if (objRes.DS.Tables[0].Rows[0]["Credential_type"].ToString().ToLower().Trim() == "user")
                {
                    HtmlGenericControl hideUserManagment = (HtmlGenericControl)Page.Master.FindControl("UserManagement");
                    hideUserManagment.Style.Add("display", "none");
                }
            }
            else if (result == "redirect")
            {
                Session["Username"] = userLogin.UserName;
                Response.Redirect("ResetPassword.aspx?Username="******"";
                txtPassword.Text = "";
                Response.Write("<script>alert('Invalid Username Password')</script>");
            }
        }
        catch (Exception ex)
        {
            txtUserName.Text = "";
            txtPassword.Text = "";
        }
    }
Ejemplo n.º 30
0
    protected void MB_btn_Update_Click(object sender, EventArgs e)
    {
        if (MB_txt_branchName.Text == "" ||

            MB_txt_ModuleCode.Text == "" ||
            MB_txt_ModuleName.Text == "" ||
            MB_txt_Network.Text == "" ||
            MB_txt_Region.Text == "")
        {
            PageUtility.MessageBox(this, "Please enter all values ");
            return;
        }

        if ((MB_txt_branchName.Text.ToCharArray().All(c => Char.IsLetter(c))) == false)
        {
            PageUtility.MessageBox(this, "Input data is invalid in branch name accepts only alphabetical characters ! Try again");
            MB_txt_branchName.Text.Remove(MB_txt_branchName.Text.Length - 1);
            return;
        }

        if ((MB_txt_ModuleCode.Text.ToCharArray().All(c => Char.IsNumber(c))) == false)
        {
            PageUtility.MessageBox(this, "Input data is invalid in module code accepts only numeric values ! Try again");
            MB_txt_ModuleCode.Text.Remove(MB_txt_ModuleCode.Text.Length - 1);
            return;
        }

        if ((MB_txt_ModuleName.Text.ToCharArray().All(c => Char.IsLetter(c))) == false)
        {
            PageUtility.MessageBox(this, "Input data is invalid in module name accepts only alphabetical characters ! Try again");
            MB_txt_ModuleName.Text.Remove(MB_txt_ModuleName.Text.Length - 1);
            return;
        }

        if ((MB_txt_Network.Text.ToCharArray().All(c => Char.IsNumber(c))) == false)
        {
            PageUtility.MessageBox(this, "Input data is invalid in branch code accepts only numeric values ! Try again");
            MB_txt_Network.Text.Remove(MB_txt_Network.Text.Length - 1);
            return;
        }

        if ((MB_txt_Region.Text.ToCharArray().All(c => Char.IsNumber(c))) == false)
        {
            PageUtility.MessageBox(this, "Input data is invalid in branch code accepts only numeric values ! Try again");
            MB_txt_Region.Text.Remove(MB_txt_Region.Text.Length - 1);
            return;
        }


        try
        {
            BranchDetails branchDetails = new BranchDetails();
            branchDetails.BranchCode  = MB_ddl_branch_code.SelectedItem.Text;
            branchDetails.BranchName  = MB_txt_branchName.Text;
            branchDetails.PersonName  = MB_txt_PersonName.Text;
            branchDetails.PersonPhone = MB_txt_PersonNumber.Text;
            branchDetails.PersonEmail = MB_txt_Email.Text;
            branchDetails.ModuleCode  = MB_txt_ModuleCode.Text;
            branchDetails.ModuleName  = MB_txt_ModuleName.Text;
            branchDetails.Network     = MB_txt_Network.Text;
            branchDetails.Region      = MB_txt_Region.Text;
            branchDetails.CircleCode  = MB_ddl_Circle_Name.SelectedItem.Value;

            WebClient client = new WebClient();

            client.Headers[HttpRequestHeader.ContentType] = "text/json";
            ServicePointManager.SecurityProtocol          = SecurityProtocolType.Tls12;
            string     JsonString    = JsonConvert.SerializeObject(branchDetails);
            EncRequest objEncRequest = new EncRequest();
            objEncRequest.RequestData = AesGcm256.Encrypt(JsonString);
            string dataEncrypted = JsonConvert.SerializeObject(objEncRequest);

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

            EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result);
            objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData);
            //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData);
            //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply));
            //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData));
            //result = (string)objDCS.ReadObject(objMS);

            Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer();
            json.NullValueHandling = NullValueHandling.Ignore;
            StringReader sr = new StringReader(objResponse.ResponseData);
            Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr);
            result = json.Deserialize <string>(reader);

            if (result.Contains("true"))
            {
                PageUtility.MessageBox(this, "Branch Update Successfully");
            }
            else
            {
                PageUtility.MessageBox(this, "Failed");
            }
        }
        catch (Exception ex)
        {
            PageUtility.MessageBox(this, "Catch Error : " + ex.Message.ToString());
        }
        finally
        {
            MB_ddl_Circle_Name.ClearSelection();
            MB_ddl_branch_code.ClearSelection();
            MB_txt_branchName.Text        = MB_txt_Region.Text =
                MB_txt_ModuleCode.Text    = MB_txt_ModuleName.Text =
                    MB_txt_Network.Text   = MB_txt_PersonName.Text =
                        MB_txt_Email.Text = MB_txt_PersonNumber.Text = "";
        }
    }