private void LoadValue()
 {
     try
     {
         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Login.strAPIURL + "/api/User?siteCode=NIL");
         req.ContentType = "application/json;";
         req.Method      = "GET";
         WebResponse          response       = req.GetResponse();
         Stream               responseStream = response.GetResponseStream();
         StreamReader         sr             = new StreamReader(responseStream);
         JavaScriptSerializer js             = new JavaScriptSerializer();
         ComboOutput          oComboOutput   = js.Deserialize <ComboOutput>(sr.ReadToEnd());
         if (oComboOutput.success == "1")
         {
             for (int i = 0; i < oComboOutput.result.Count; i++)
             {
                 ddlUser.Items.Add(new ListItem(oComboOutput.result[i].itemDesc.ToString(), oComboOutput.result[i].itemCode.ToString()));
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
        private void LoadValue()
        {
            try
            {
                oDT_General = (DataTable)JsonConvert.DeserializeObject(apiCalling(System.Configuration.ConfigurationManager.AppSettings["uri"] + "api/ItemSitelists"), (typeof(DataTable)));
                DataView oDV1 = new DataView(oDT_General);
                oDV1.RowFilter = "itemsiteCode='" + strSiteCode + "'";
                oDT_General    = oDV1.ToTable();

                foreach (DataRow oDr in oDT_General.Rows)
                {
                    ddlSite_webBI_StockBalance.Items.Add(new ListItem(oDr["itemsiteDesc"].ToString().Trim(), oDr["itemsiteCode"].ToString().Trim()));
                }

                //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Login.strAPIURL + "/api/siteListing?userCode='" + strUserCode.Trim() + "'");
                //req.ContentType = "application/json;";
                //req.Method = "GET";
                //WebResponse response = req.GetResponse();
                //Stream responseStream = response.GetResponseStream();
                //StreamReader sr = new StreamReader(responseStream);
                //JavaScriptSerializer js = new JavaScriptSerializer();
                //ComboOutput oComboOutput = js.Deserialize<ComboOutput>(sr.ReadToEnd());
                //if (oComboOutput.success == "1")
                //{
                //    for (int i = 0; i < oComboOutput.result.Count; i++)
                //    {
                //        ddlSite_webBI_StockBalance.Items.Add(new ListItem(oComboOutput.result[i].itemDesc.ToString(), oComboOutput.result[i].itemCode.ToString()));
                //    }
                //}

                HttpWebRequest req1 = (HttpWebRequest)WebRequest.Create(Login.strAPIURL + "/api/Brand?siteCode=NIL");
                req1.ContentType = "application/json;";
                req1.Method      = "GET";
                WebResponse          response1       = req1.GetResponse();
                Stream               responseStream1 = response1.GetResponseStream();
                StreamReader         sr1             = new StreamReader(responseStream1);
                JavaScriptSerializer js1             = new JavaScriptSerializer();
                ComboOutput          oComboOutput1   = js1.Deserialize <ComboOutput>(sr1.ReadToEnd());
                if (oComboOutput1.success == "1")
                {
                    for (int i = 0; i < oComboOutput1.result.Count; i++)
                    {
                        ddlBrand_webBI_StockBalance.Items.Add(new ListItem(oComboOutput1.result[i].brandName.ToString(), oComboOutput1.result[i].brandCode.ToString()));
                    }
                }

                HttpWebRequest req2 = (HttpWebRequest)WebRequest.Create(Login.strAPIURL + "/api/StockList?siteCode=NIL");
                req2.ContentType = "application/json;";
                req2.Method      = "GET";
                WebResponse          response2       = req2.GetResponse();
                Stream               responseStream2 = response2.GetResponseStream();
                StreamReader         sr2             = new StreamReader(responseStream2);
                JavaScriptSerializer js2             = new JavaScriptSerializer();
                ComboOutput          oComboOutput2   = js2.Deserialize <ComboOutput>(sr2.ReadToEnd());
                if (oComboOutput2.success == "1")
                {
                    for (int i = 0; i < oComboOutput2.result.Count; i++)
                    {
                        ddlFItem_webBI_StockBalance.Items.Add(new ListItem(oComboOutput2.result[i].itemName.ToString(), oComboOutput2.result[i].itemName.ToString()));
                        ddlTItem_webBI_StockBalance.Items.Add(new ListItem(oComboOutput2.result[i].itemName.ToString(), oComboOutput2.result[i].itemName.ToString()));
                    }
                }

                HttpWebRequest req3 = (HttpWebRequest)WebRequest.Create(Login.strAPIURL + "/api/Range?siteCode=NIL&brandCode=NIL");
                req3.ContentType = "application/json;";
                req3.Method      = "GET";
                WebResponse          response3       = req3.GetResponse();
                Stream               responseStream3 = response3.GetResponseStream();
                StreamReader         sr3             = new StreamReader(responseStream3);
                JavaScriptSerializer js3             = new JavaScriptSerializer();
                ComboOutput          oComboOutput3   = js3.Deserialize <ComboOutput>(sr3.ReadToEnd());
                if (oComboOutput3.success == "1")
                {
                    for (int i = 0; i < oComboOutput3.result.Count; i++)
                    {
                        ddlRange_webBI_StockBalance.Items.Add(new ListItem(oComboOutput3.result[i].rangeName.ToString(), oComboOutput3.result[i].rangeName.ToString()));
                    }
                }

                HttpWebRequest req4 = (HttpWebRequest)WebRequest.Create(Login.strAPIURL + "/api/department?siteCode=NIL");
                req4.ContentType = "application/json;";
                req4.Method      = "GET";
                WebResponse          response4       = req4.GetResponse();
                Stream               responseStream4 = response4.GetResponseStream();
                StreamReader         sr4             = new StreamReader(responseStream4);
                JavaScriptSerializer js4             = new JavaScriptSerializer();
                ComboOutput          oComboOutput4   = js4.Deserialize <ComboOutput>(sr4.ReadToEnd());
                if (oComboOutput4.success == "1")
                {
                    for (int i = 0; i < oComboOutput4.result.Count; i++)
                    {
                        ddlDept_webBI_StockBalance.Items.Add(new ListItem(oComboOutput4.result[i].departmentName.ToString(), oComboOutput4.result[i].departmentCode.ToString()));
                    }
                }


                DateTime _ToDate = DateTime.Now;
                dtAsOnDate_webBI_StockBalance.Value = _ToDate.ToString("dd/MM/yyyy");
            }
            catch (Exception)
            {
                throw;
            }
        }