Example #1
0
        public string SendRequest(string url)
        {
            try
            {
                HttpWebRequest request = ((HttpWebRequest)(WebRequest.Create(url)));
                request.Method          = "GET";
                request.Timeout         = 30000;
                request.PreAuthenticate = true;
                request.KeepAlive       = false;
                //webreq.ContentType = "application/x-www-form-urlencoded";
                request.ContentType = "application/json;charset=UTF-8";
                request.Credentials = CredentialCache.DefaultCredentials;
                request.UserAgent   = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

                HttpWebResponse response    = (HttpWebResponse)request.GetResponse();
                Stream          resst       = response.GetResponseStream();
                StreamReader    sr          = new StreamReader(resst);
                string          strresponse = sr.ReadToEnd();
                sr.Close();
                response.Close();
                resst.Close();

                return(strresponse);
            }
            catch (Exception ex)
            {
                ClsLog.LogException(ex, "Error at Page Client Store Home-->SendRequest");
                return(ex.ToString());
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    //string DomainName = "www.myappstore.co.in";
                    string DomainName = HttpContext.Current.Request.Url.Host;
                    string MainDomain = ConfigurationManager.AppSettings["MainDomain"].ToString();
                    DomainName = DomainName.Replace("www.", "");
                    if (DomainName != MainDomain)
                    {
                        string Details_Directory    = ConfigurationManager.AppSettings["Details_Directory"].ToString();
                        string getDetails_Directory = System.IO.File.ReadAllText(Details_Directory + "details.txt");
                        var    details = JObject.Parse(getDetails_Directory);

                        string domain = details["domain"].ToString().Replace("\"", "").Trim();
                        DomainName = DomainName.Replace("." + MainDomain.ToString(), "");
                        //DomainName = DomainName.Replace("www.", "");
                        Response.Redirect("http://" + DomainName + domain + "/ClientStore/Home.aspx", false);
                    }
                    else
                    {
                        LoadCards();
                    }
                }
            }
            catch (Exception ex)
            {
                ClsLog.LogException(ex, "Error at Page Store Home-->OnLoad");
                Notification("Error at Page Store Home OnLoad", "error");
            }
        }
Example #3
0
        protected void btnSendSms_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMobile.Text == "")
                {
                    Notification("Enter Mobile Number", "error");
                    return;
                }
                string Details_Directory    = ConfigurationManager.AppSettings["Details_Directory"].ToString();
                string getDetails_Directory = System.IO.File.ReadAllText(Details_Directory + "details.txt");
                var    details = JObject.Parse(getDetails_Directory);

                string smsUrl = details["smsurl"].ToString().Replace("\"", "").Trim();

                smsUrl = smsUrl.Replace("<mobileno>", txtMobile.Text);
                smsUrl = smsUrl.Replace("<message>", hiddenText.Value.ToString());
                string response = SendRequest(smsUrl);
                if (response.Contains("success"))
                {
                    Notification("Sms Sent Successfully", "success");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "onSendSms('');", true);
                }
                else
                {
                    Notification("Error in Sending Sms", "error");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "onSendSms('');", true);
                }
            }
            catch (Exception ex)
            {
                Notification("Error at btnSendSms", "error");
                ClsLog.LogException(ex, "Error at Page Client Store Home-->btnSendSms");
            }
        }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             //string DomainName = "bonrix.myappstore.co.in";
             //ClsLog.Url_Log("Request", "Url --> " + HttpContext.Current.Request.Url.ToString());
             string DomainName = HttpContext.Current.Request.Url.Host;
             //ClsLog.Url_Log("Request ", "DomainName--> " + DomainName);
             if (DomainName.Contains("."))
             {
                 string[] spltDomain = DomainName.Split('.');
                 subDomain            = spltDomain[0].ToString();
                 Session["SubDomain"] = subDomain;
                 //ClsLog.Url_Log("Request", "Sub Domain Name--> " + subDomain);
                 divTitle.InnerText = subDomain.ToUpper() + " APP STORE";
                 LoadStore(subDomain);
             }
         }
     }
     catch (Exception ex)
     {
         ClsLog.LogException(ex, "Error at Page Client Store Home-->OnLoad");
         Notification("Error at Page Client Store Home OnLoad", "error");
     }
 }
Example #5
0
        protected void OnDelete(object sender, EventArgs e)
        {
            try
            {
                RepeaterItem item       = (sender as LinkButton).Parent as RepeaterItem;
                string       lblApkName = (item.FindControl("lblApkName") as Label).Text.Trim();

                string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                StoreDirectory = StoreDirectory + "\\" + Session["SubDomain"].ToString() + "\\APP\\" + lblApkName;

                File.Delete(StoreDirectory);

                StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString() + "\\" + Session["SubDomain"].ToString() + "\\APP\\" + lblApkName.Substring(0, lblApkName.Length - 4) + ".txt";
                if (File.Exists(StoreDirectory))
                {
                    File.Delete(StoreDirectory);
                }

                Notification("Deleted Successfully", "success");
                LoadStore(Session["SubDomain"].ToString());
            }
            catch (Exception ex)
            {
                Notification("Error at OnDelete", "danger");
                ClsLog.LogException(ex, "Error at Page StoreList-->OnDelete");
            }
        }
Example #6
0
        protected void OnEdit(object sender, EventArgs e)
        {
            //Find the reference of the Repeater Item.
            try
            {
                //Check for password file of store
                string filePath = "";
                txtEditName.Text    = "";
                txtEditPackage.Text = "";
                txtEditVersion.Text = "";

                filePath = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                if (System.IO.File.Exists(filePath + "\\" + Session["SubDomain"].ToString() + "\\password.txt"))
                {
                    if (Session["StoreUserName"] == null)
                    {
                        Notification("Login to Edit APP.", "error");
                        return;
                    }
                }

                RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "ShowModal('" + (item.FindControl("lblApkName") as Label).Text.Trim() +
                                                        "','" + (item.FindControl("hiddenName") as HiddenField).Value.Trim() +
                                                        "','" + (item.FindControl("hiddenPackage") as HiddenField).Value.Trim() +
                                                        "','" + (item.FindControl("hiddenVersion") as HiddenField).Value.Trim() + "');", true);
            }
            catch (Exception ex)
            {
                Notification("Error at OnEdit", "error");
                ClsLog.LogException(ex, "Error at Client Store Home-->OnEdit");
            }
            //this.ToggleElements(item, true);
        }
        protected void OnDeleteAPK(object sender, EventArgs e)
        {
            try
            {
                RepeaterItem item          = (sender as LinkButton).Parent as RepeaterItem;
                string       lblFolderName = (item.FindControl("lblFolderName") as Label).Text.Trim();

                string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                StoreDirectory = StoreDirectory + "\\" + lblFolderName + "\\StoreAPK";

                string[] subdirectoryEntries = Directory.GetFiles(StoreDirectory);
                if (subdirectoryEntries.Length > 0)
                {
                    foreach (var directory in subdirectoryEntries)
                    {
                        DirectoryInfo dirInfo = new DirectoryInfo(directory);
                        File.Delete(dirInfo.ToString());
                    }
                    //Directory.Delete(StoreDirectory, true);
                    loadData();
                    Notification("Deleted Successfully", "success");
                }
                else
                {
                    Notification("No Store Apk Uploaded.", "danger");
                }
            }
            catch (Exception ex)
            {
                Notification("Error at OnDelete", "danger");
                ClsLog.LogException(ex, "Error at Page Admin Home-->OnDelete");
            }
        }
 protected void btnEditSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string lblFolderName  = hiddenFolderName.Value.ToString();
         string lblApkFileName = hiddenFolderApkName.Value.ToString();
         string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
         StoreDirectory = StoreDirectory + "\\" + hiddenFolderName.Value.ToString() + "\\StoreAPK";
         StoreDirectory = StoreDirectory + "\\" + lblApkFileName + ".txt";
         if (System.IO.File.Exists(StoreDirectory))
         {
             System.IO.File.Delete(StoreDirectory);
         }
         //Write Package file
         StreamWriter sw = new StreamWriter(StoreDirectory, true);
         sw.Write("{\"name\":\"" + txtName.Text.ToString().Trim() + "\",\"package\":\"" + txtPackageName.Text.ToString().Trim() + "\",\"version\":\"" + txtVersion.Text.ToString().Trim() + "\"}");
         sw.Close();
         Notification("Updated Successfully", "success");
     }
     catch (Exception ex)
     {
         Notification("Error at OnDelete APK", "danger");
         ClsLog.LogException(ex, "Error at Page Admin Home-->OnDelete APK");
     }
 }
Example #9
0
        protected void lnkSendSmsMain_Click(object sender, EventArgs e)
        {
            try
            {
                string ApkPath  = "";
                string linkcopy = "";

                string Details_Directory    = ConfigurationManager.AppSettings["Details_Directory"].ToString();
                string getDetails_Directory = System.IO.File.ReadAllText(Details_Directory + "details.txt");
                var    details = JObject.Parse(getDetails_Directory);

                string domain = details["domain"].ToString().Replace("\"", "").Trim();
                subDomain = Session["SubDomain"].ToString();

                ApkPath = ConfigurationManager.AppSettings["Store_Directory"].ToString() + "\\" + subDomain + "\\StoreAPK";

                string[] subdirectoryEntries = Directory.GetFiles(ApkPath, "*.apk");
                if (subdirectoryEntries.Length > 0)
                {
                    DirectoryInfo dirInfoApk = new DirectoryInfo(subdirectoryEntries[0]);
                    linkcopy = "http://" + subDomain + domain + "/Raw_Details/Store/" + subDomain + "/StoreAPK/" + dirInfoApk.Name;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "onSendSms('" + linkcopy + "');", true);
                }
            }
            catch (Exception ex)
            {
                Notification("Error at OnSendSmsMain", "error");
                ClsLog.LogException(ex, "Error at Page Client Store Home-->OnSendSmsMain");
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             if (Session["StoreUserName"] == null)
             {
                 Response.Redirect("~/Admin/Login.aspx", false);
             }
             else
             {
                 B2CNameRight.InnerText = " " + Session["StoreUserName"].ToString();
                 B2CNameLeft.InnerText  = " " + Session["StoreUserName"].ToString();
             }
         }
         catch (Exception ex)
         {
             ClsLog.LogException(ex, "Error at Page Master-->Page_Load");
         }
     }
     else
     {
         if (Session["StoreUserName"] == null)
         {
             Response.Redirect("~/Admin/Login.aspx", false);
         }
     }
 }
        protected void loadData()
        {
            try
            {
                // SHOW THE ENTIRE LIST OF THE FOLDER.
                List <Store> objStoreList        = new List <Store>();
                string       StoreDirectory      = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                string[]     subdirectoryEntries = Directory.GetDirectories(StoreDirectory);
                if (subdirectoryEntries.Length > 0)
                {
                    foreach (var directory in subdirectoryEntries)
                    {
                        DirectoryInfo dirInfo  = new DirectoryInfo(directory);
                        Store         objStore = new Store();
                        objStore.FolderName = dirInfo.Name.ToString();
                        objStore.DateTime   = dirInfo.CreationTime.ToShortDateString();
                        objStore.ImageUrl   = "../Images/android_logo.png";
                        objStoreList.Add(objStore);
                        //foreach (var friend in friendz)
                        //{
                        //    friendsList.Add(
                        //        new Friends { ID = friend.id, Name = friend.name }
                        //    );

                        //}

                        //var data = new List<KeyValuePair<string, string>>()
                        //{
                        //    new KeyValuePair<string, string>( "folder_name",  dirInfo.Name.ToString()),
                        //     new KeyValuePair<string, string>( "date_time",  dirInfo.CreationTime.ToShortDateString())
                        //};

                        // Notice I've created a DirectoryInfo variable.


                        // And likewise a name variable for storing the name.
                        // If this is not added, only the first directory will
                        // be captured in the loop; the rest won't.

                        //string name = dirInfo.Name;


                        //resultList2.Add(data);

                        // Finally we add the directory name to our defined List.
                        //subdirectoryEntries.Add(name);
                    }
                }
                //BIND THE FILE LIST WITH THE REPEATER CONTROL.
                tableData.DataSource = objStoreList;
                tableData.DataBind();
            }
            catch (Exception ex)
            {
                ClsLog.LogException(ex, "Error at Page Home-->loadData");
                Notification("Error at Page Home LoadData", "error");
            }
        }
Example #12
0
        protected void LoadStore(string subDomain)
        {
            try
            {
                // SHOW THE ENTIRE LIST OF THE FOLDER.
                string          ApkPath              = "";
                List <GridList> lstGridList          = new List <GridList>();
                string          Details_Directory    = ConfigurationManager.AppSettings["Details_Directory"].ToString();
                string          getDetails_Directory = System.IO.File.ReadAllText(Details_Directory + "details.txt");
                var             details              = JObject.Parse(getDetails_Directory);

                string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                StoreDirectory = StoreDirectory + "\\" + subDomain + "\\APP";

                string[] subdirectoryEntries = Directory.GetFiles(StoreDirectory, "*.apk");
                if (subdirectoryEntries.Length > 0)
                {
                    //For file name
                    ApkPath = ConfigurationManager.AppSettings["Store_Directory"].ToString() + "\\" + subDomain + "\\StoreAPK";
                    string[] ApkStoreDirectory = Directory.GetFiles(ApkPath);
                    if (ApkStoreDirectory.Length > 0)
                    {
                        DirectoryInfo dirInfoApk = new DirectoryInfo(ApkStoreDirectory[0]);
                        dwnldlink.Attributes["href"] = "/Raw_Details/Store/" + subDomain + "/StoreAPK/" + dirInfoApk.Name;
                    }
                    foreach (var directory in subdirectoryEntries)
                    {
                        DirectoryInfo dirInfo     = new DirectoryInfo(directory);
                        GridList      objGridList = new GridList();

                        if (System.IO.File.Exists(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + ".txt"))
                        {
                            //getDetails_Directory = System.IO.File.ReadAllText(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + "\\.txt");
                            details             = JObject.Parse(System.IO.File.ReadAllText(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + ".txt"));
                            objGridList.Package = details["package"].ToString().Replace("\"", "").Trim();
                            objGridList.Version = details["version"].ToString().Replace("\"", "").Trim();
                            objGridList.Name    = details["name"].ToString().Replace("\"", "").Trim();
                        }

                        objGridList.ApkName  = dirInfo.Name.ToString();
                        objGridList.DateTime = dirInfo.CreationTime.ToShortDateString();
                        objGridList.ImageUrl = "../Images/android_logo.png";
                        lstGridList.Add(objGridList);
                    }
                }
                //BIND THE FILE LIST WITH THE REPEATER CONTROL.
                tableData.DataSource = lstGridList;
                tableData.DataBind();
            }
            catch (Exception ex)
            {
                ClsLog.LogException(ex, "Error at Page Client Store StoreList-->LoadStore");
                Notification("Error at Page Client Store StoreList", "error");
            }
        }
Example #13
0
 protected void lnkLogin_Click(object sender, EventArgs e)
 {
     try
     {
         Response.Redirect("~/Admin/Login.aspx", false);
     }
     catch (Exception ex)
     {
         ClsLog.LogException(ex, "Error at Page Store -->Login_Click");
         Notification("Error at Page Store ", "error");
     }
 }
Example #14
0
 protected void OnSendSms(object sender, EventArgs e)
 {
     try
     {
         RepeaterItem item     = (sender as LinkButton).Parent as RepeaterItem;
         string       linkcopy = (item.FindControl("lnkdownload") as HtmlAnchor).HRef.ToString();
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "onSendSms('" + linkcopy + "');", true);
     }
     catch (Exception ex)
     {
         Notification("Error at OnSendSms", "error");
         ClsLog.LogException(ex, "Error at Page Client Store Home-->OnSendSms");
     }
 }
Example #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
         }
     }
     catch (Exception ex)
     {
         ClsLog.LogException(ex, "Error at Page Store -->Page_Load");
         Notification("Error at Page Store ", "error");
     }
 }
 protected void OnUpload(object sender, EventArgs e)
 {
     //Find the reference of the Repeater Item.
     try
     {
         RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem;
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "ShowModal('" + (item.FindControl("lblFolderName") as Label).Text.Trim() + "');", true);
     }
     catch (Exception ex)
     {
         Notification("Error at OnUpload", "error");
         ClsLog.LogException(ex, "Error at Admin Home-->OnUpload");
     }
     //this.ToggleElements(item, true);
 }
Example #17
0
 protected void OnShare(object sender, EventArgs e)
 {
     try
     {
         RepeaterItem item     = (sender as LinkButton).Parent as RepeaterItem;
         string       linkcopy = (item.FindControl("lnkdownload") as HtmlAnchor).HRef.ToString();
         string       name     = (item.FindControl("lblName") as Label).Text.Trim();
         string       version  = (item.FindControl("lblAPKVersion") as Label).Text.Trim();
         version = version.Replace("Version:", "");
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "onShare('" + name + "','" + linkcopy + "','" + version + "','" + Session["SubDomain"].ToString().ToUpper() + "');", true);
     }
     catch (Exception ex)
     {
         Notification("Error at OnShare", "error");
         ClsLog.LogException(ex, "Error at Page Client Store Home-->OnShare");
     }
 }
Example #18
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtsearch.Text == "")
         {
             Notification("Enter store name to Search", "error");
             return;
         }
         Session["SearchValue"] = txtsearch.Text.ToString().Trim();
         Response.Redirect("~/Store/Home.aspx");
     }
     catch (Exception ex)
     {
         ClsLog.LogException(ex, "Error at Page Store -->Search_Click");
         Notification("Error at Page Store Search ", "error");
     }
 }
Example #19
0
 protected void btnEditSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string ApkPath = "";
         ApkPath = ConfigurationManager.AppSettings["Store_Directory"].ToString() + "\\" + Session["SubDomain"] + "\\APP\\" + hiddenEditApkName.Value.Substring(0, hiddenEditApkName.Value.Length - 4).ToString() + ".txt";
         System.IO.File.Delete(ApkPath);
         StreamWriter sw = new StreamWriter(ApkPath, true);
         sw.Write("{\"name\":\"" + txtEditName.Text.ToString().Trim() + "\",\"package\":\"" + txtEditPackage.Text.ToString().Trim() + "\",\"version\":\"" + txtEditVersion.Text.ToString().Trim() + "\"}");
         sw.Close();
         LoadStore(Session["SubDomain"].ToString());
         Notification("Updated Successfully", "success");
     }
     catch (Exception ex)
     {
         Notification("Error at btnEditSubmit_Click", "error");
         ClsLog.LogException(ex, "Error at Client Store Home-->btnEditSubmit_Click");
     }
 }
        protected void tableData_ItemCreated(Object Sender, RepeaterItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    ScriptManager scriptMan = ScriptManager.GetCurrent(this);
                    LinkButton    btn       = e.Item.FindControl("lnkUpload") as LinkButton;
                    if (btn != null)
                    {
                        btn.Click += OnUpload;
                        scriptMan.RegisterAsyncPostBackControl(btn);
                    }

                    btn = e.Item.FindControl("lnkEdit") as LinkButton;
                    if (btn != null)
                    {
                        btn.Click += OnEdit;
                        scriptMan.RegisterAsyncPostBackControl(btn);
                    }

                    btn = e.Item.FindControl("lnkDeleteAPK") as LinkButton;
                    if (btn != null)
                    {
                        btn.Click += OnDeleteAPK;
                        scriptMan.RegisterAsyncPostBackControl(btn);
                    }

                    btn = e.Item.FindControl("lnkDelete") as LinkButton;
                    if (btn != null)
                    {
                        btn.Click += OnDelete;
                        scriptMan.RegisterAsyncPostBackControl(btn);
                    }
                }
            }
            catch (Exception ex)
            {
                Notification("Error at  Admin Home OnItemCreated", "error");
                ClsLog.LogException(ex, "Error at Page Admin Home-->OnItemCreated");
            }
        }
        protected void OnDelete(object sender, EventArgs e)
        {
            try
            {
                RepeaterItem item          = (sender as LinkButton).Parent as RepeaterItem;
                string       lblFolderName = (item.FindControl("lblFolderName") as Label).Text.Trim();

                string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                StoreDirectory = StoreDirectory + "\\" + lblFolderName;

                Directory.Delete(StoreDirectory, true);
                loadData();
                Notification("Deleted Successfully", "success");
            }
            catch (Exception ex)
            {
                Notification("Error at OnDelete", "danger");
                ClsLog.LogException(ex, "Error at Page Admin Home-->OnDelete");
            }
        }
Example #22
0
        protected void lnkShareMain_Click(object sender, EventArgs e)
        {
            try
            {
                string ApkPath  = "";
                string linkcopy = "";
                string name     = "";
                string version  = "";

                string Details_Directory    = ConfigurationManager.AppSettings["Details_Directory"].ToString();
                string getDetails_Directory = System.IO.File.ReadAllText(Details_Directory + "details.txt");
                var    details = JObject.Parse(getDetails_Directory);

                string domain = details["domain"].ToString().Replace("\"", "").Trim();
                domain = domain.Substring(1, domain.Length - 1);

                ApkPath = Details_Directory;

                string[] subdirectoryEntries = Directory.GetFiles(ApkPath, "*.apk");
                if (subdirectoryEntries.Length > 0)
                {
                    DirectoryInfo dirInfoApk = new DirectoryInfo(subdirectoryEntries[0]);
                    linkcopy = "http://" + domain + "/Raw_Details/" + dirInfoApk.Name;
                    if (System.IO.File.Exists(ApkPath + dirInfoApk.Name.Substring(0, dirInfoApk.Name.Length - 4) + ".txt"))
                    {
                        //getDetails_Directory = System.IO.File.ReadAllText(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + "\\.txt");
                        details = JObject.Parse(System.IO.File.ReadAllText(ApkPath + "\\" + dirInfoApk.Name.Substring(0, dirInfoApk.Name.Length - 4) + ".txt"));
                        version = details["version"].ToString().Replace("\"", "").Trim();
                        name    = details["name"].ToString().Replace("\"", "").Trim();
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "onShare('" + name + "','" + linkcopy + "','" + version + "','myAppStore');", true);
                }
            }
            catch (Exception ex)
            {
                Notification("Error at OnShareMain", "error");
                ClsLog.LogException(ex, "Error at Page Store Home-->OnShareMain");
            }
        }
Example #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             //if (Session["SubDomain"] == null)
             if (Session["StoreUserName"] == null)
             {
                 Response.Redirect("~/ClientStore/Home.aspx");
             }
             else
             {
                 LoadStore(Session["SubDomain"].ToString());
             }
         }
     }
     catch (Exception ex)
     {
         ClsLog.LogException(ex, "Error at Page Client Store StoreList-->OnLoad");
         Notification("Error at Page Client Store StoreList OnLoad", "error");
     }
 }
Example #24
0
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     try
     {
         //Check for password file of store
         string filePath = "";
         filePath = ConfigurationManager.AppSettings["Store_Directory"].ToString();
         if (System.IO.File.Exists(filePath + "\\" + Session["SubDomain"].ToString() + "\\password.txt"))
         {
             if (Session["StoreUserName"] == null)
             {
                 Notification("Login to Upload APP.", "error");
                 return;
             }
         }
         ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "ShowPanelAdd();", true);
     }
     catch (Exception ex)
     {
         Notification("Error at OnUpload", "error");
         ClsLog.LogException(ex, "Error at Page Client Store Home-->btnUpload");
     }
 }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    if (Session["StoreUserName"] == null && Session["SubDomain"] == null)
                    {
                        Response.Redirect("~/ClientStore/Login.aspx", false);
                    }
                    else
                    {
                        if (Session["StoreUserName"] != null)
                        {
                            lnkStore.Visible    = true;
                            liLogin.Visible     = false;
                            liUser_Menu.Visible = true;

                            B2CNameRight.InnerText = " " + Session["StoreUserName"].ToString();
                            B2CNameLeft.InnerText  = " " + Session["StoreUserName"].ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    ClsLog.LogException(ex, "Error at Page Master-->Page_Load");
                }
            }
            else
            {
                if (Session["StoreUserName"] == null)
                {
                    //Response.Redirect("~/ClientStore/Login.aspx", false);
                }
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string path = "";

            try
            {
                if (txtStoreName.Text == "")
                {
                    Notification("Please Enter Store Name", "error");
                    return;
                }

                if (txtStoreName.Text.Contains(" "))
                {
                    txtStoreName.Text = txtStoreName.Text.Replace(" ", "").ToString();
                }

                if (chkActive.Checked)
                {
                    if (txtpassword.Text == "")
                    {
                        Notification("Please Enter Store Password", "error");
                        return;
                    }
                }

                string        StoreDirectory   = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                DirectoryInfo objDirectoryInfo = new DirectoryInfo(StoreDirectory);
                if (!objDirectoryInfo.Exists)
                {
                    Directory.CreateDirectory(StoreDirectory);
                }

                StoreDirectory = StoreDirectory + "\\" + txtStoreName.Text.ToString().Trim();
                path           = StoreDirectory;

                //Check if store name exists
                objDirectoryInfo = new DirectoryInfo(path);
                if (objDirectoryInfo.Exists)
                {
                    Notification("Store Name Already Exists", "error");
                    return;
                }
                else
                {
                    Directory.CreateDirectory(StoreDirectory);
                }


                //objDirectoryInfo = new DirectoryInfo(StoreDirectory);
                //if (!objDirectoryInfo.Exists)
                //{
                //    Directory.CreateDirectory(StoreDirectory);
                //}

                StoreDirectory   = path + "\\APP";
                objDirectoryInfo = new DirectoryInfo(StoreDirectory);
                if (!objDirectoryInfo.Exists)
                {
                    Directory.CreateDirectory(StoreDirectory);
                }

                StoreDirectory   = path + "\\StoreAPK";
                objDirectoryInfo = new DirectoryInfo(StoreDirectory);
                if (!objDirectoryInfo.Exists)
                {
                    Directory.CreateDirectory(StoreDirectory);
                }

                if (chkActive.Checked)
                {
                    path = path + "\\password.txt";
                    StreamWriter sw = new StreamWriter(path, true);
                    sw.Write("{\"username\":\"" + txtStoreName.Text.ToString().Trim() + "\",\"password\":\"" + txtpassword.Text.ToString().Trim() + "\"}");
                    sw.Close();
                }
                loadData();
                Notification("Store Created Successfully", "success");
            }
            catch (Exception ex)
            {
                ClsLog.LogException(ex, "Error at Page Home-->Submit");
                Notification("Error at Page Home", "error");
            }
        }
Example #27
0
        public void GetApp_List()
        {
            try
            {
                string jsonresponse                   = "";
                JavaScriptSerializer js               = new JavaScriptSerializer();
                List <ClsAppList>    LstClsAppList    = new List <ClsAppList>();
                GetClsAppList        objGetClsAppList = new GetClsAppList();

                string DomainName = HttpContext.Current.Request.Url.Host;
                //string DomainName = "myappstore.co.in";
                string MainDomain     = ConfigurationManager.AppSettings["MainDomain"].ToString();
                string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();

                if (DomainName == MainDomain)
                {
                    if (System.IO.Directory.Exists(StoreDirectory))
                    {
                        // StoreDirectory = StoreDirectory + "\\" + DomainName + "\\APP";
                        string[] subdirectoryEntries = Directory.GetDirectories(StoreDirectory);

                        if (subdirectoryEntries.Length > 0)
                        {
                            foreach (var directory in subdirectoryEntries)
                            {
                                DirectoryInfo dirInfo = new DirectoryInfo(directory + "\\StoreAPK");

                                if (System.IO.Directory.Exists(dirInfo.ToString()))
                                {
                                    string[] innerSubdirectoryEntries = Directory.GetFiles(dirInfo.ToString(), "*.apk");

                                    if (innerSubdirectoryEntries.Length > 0)
                                    {
                                        foreach (var innerDirectory in innerSubdirectoryEntries)
                                        {
                                            ClsAppList    objClsAppList = new ClsAppList();
                                            DirectoryInfo innerDirInfo  = new DirectoryInfo(innerDirectory);

                                            objClsAppList.ApkName = innerDirInfo.Name.ToString();
                                            int    StringPosition = innerDirectory.IndexOf("Raw_Details");
                                            string path           = innerDirectory.Substring(StringPosition, innerDirectory.Length - StringPosition);

                                            if (System.IO.File.Exists(directory + "\\StoreAPK" + "\\" + innerDirInfo.Name.Substring(0, innerDirInfo.Name.Length - 4) + ".txt"))
                                            {
                                                //getDetails_Directory = System.IO.File.ReadAllText(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + "\\.txt");
                                                var details = JObject.Parse(System.IO.File.ReadAllText(directory + "\\StoreAPK" + "\\" + innerDirInfo.Name.Substring(0, innerDirInfo.Name.Length - 4) + ".txt"));
                                                objClsAppList.Name    = details["name"].ToString().Replace("\"", "").Trim();
                                                objClsAppList.Package = details["package"].ToString().Replace("\"", "").Trim();
                                                objClsAppList.Version = details["version"].ToString().Replace("\"", "").Trim();
                                            }
                                            objClsAppList.DateTime = innerDirInfo.CreationTime.ToShortDateString();
                                            objClsAppList.ImageUrl = "/Images/android_logo.jpg";
                                            objClsAppList.ApkPath  = path.Replace("Raw_Details", "").Replace(@"\", "/");
                                            LstClsAppList.Add(objClsAppList);
                                        }
                                    }
                                }
                            }
                            objGetClsAppList.Data    = LstClsAppList;
                            objGetClsAppList.Status  = "True";
                            objGetClsAppList.Message = "Total Store: " + subdirectoryEntries.Length.ToString();
                        }
                        else
                        {
                            objGetClsAppList.Status  = "False";
                            objGetClsAppList.Message = "No Store Created.";
                        }
                    }
                    else
                    {
                        objGetClsAppList.Status  = "False";
                        objGetClsAppList.Message = "Store Not Available.";
                    }
                }
                else
                {
                    //Getlist of SubDomain APK
                    DomainName = DomainName.Replace("." + MainDomain.ToString(), "");
                    if (System.IO.Directory.Exists(StoreDirectory + "\\" + DomainName))
                    {
                        StoreDirectory = StoreDirectory + "\\" + DomainName + "\\APP";
                        string[] subdirectoryEntries = Directory.GetFiles(StoreDirectory, "*.apk");

                        if (subdirectoryEntries.Length > 0)
                        {
                            foreach (var directory in subdirectoryEntries)
                            {
                                DirectoryInfo dirInfo       = new DirectoryInfo(directory);
                                ClsAppList    objClsAppList = new ClsAppList();

                                if (System.IO.File.Exists(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + ".txt"))
                                {
                                    //getDetails_Directory = System.IO.File.ReadAllText(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + "\\.txt");
                                    var details = JObject.Parse(System.IO.File.ReadAllText(StoreDirectory + "\\" + dirInfo.Name.Substring(0, dirInfo.Name.Length - 4) + ".txt"));
                                    objClsAppList.Name    = details["name"].ToString().Replace("\"", "").Trim();
                                    objClsAppList.Package = details["package"].ToString().Replace("\"", "").Trim();
                                    objClsAppList.Version = details["version"].ToString().Replace("\"", "").Trim();
                                }
                                int    StringPosition = directory.IndexOf("Raw_Details");
                                string path           = directory.Substring(StringPosition, directory.Length - StringPosition);

                                objClsAppList.ApkName  = dirInfo.Name.ToString();
                                objClsAppList.DateTime = dirInfo.CreationTime.ToShortDateString();
                                objClsAppList.ImageUrl = "../Images/android_logo.jpg";
                                objClsAppList.ApkPath  = path.Replace("Raw_Details", "").Replace(@"\", "/");
                                LstClsAppList.Add(objClsAppList);
                            }
                            objGetClsAppList.Data    = LstClsAppList;
                            objGetClsAppList.Status  = "True";
                            objGetClsAppList.Message = "Total APK: " + subdirectoryEntries.Length.ToString();
                        }
                        else
                        {
                            objGetClsAppList.Status  = "False";
                            objGetClsAppList.Message = "No APK Uploaded.";
                        }
                    }
                    else
                    {
                        objGetClsAppList.Status  = "False";
                        objGetClsAppList.Message = "Store Not Available.";
                    }
                }

                jsonresponse = js.Serialize(objGetClsAppList);
                Context.Response.Clear();
                Context.Response.ContentType = "application/json";
                Context.Response.AddHeader("content-length", jsonresponse.Length.ToString());
                Context.Response.Flush();
                Context.Response.Write(jsonresponse);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
            catch (Exception ex)
            {
                ClsLog.LogException(ex, "Error at Page Service-->GetApp_List");
            }
        }
Example #28
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (FileUpload1.HasFile)
                {
                    try
                    {
                        string PackagePath          = "";
                        string username             = "";
                        string password             = "";
                        string getDetails_Directory = "";
                        string filename             = Path.GetFileName(FileUpload1.FileName);
                        string StoreDirectory       = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                        string filePath             = StoreDirectory;

                        StoreDirectory = StoreDirectory + "\\" + Session["SubDomain"].ToString() + "\\APP";
                        PackagePath    = StoreDirectory;

                        StoreDirectory      = StoreDirectory + "\\" + filename;
                        Session["filepath"] = StoreDirectory;

                        if (System.IO.File.Exists(filePath + "\\" + Session["SubDomain"].ToString() + "\\password.txt"))
                        {
                            if (Session["StoreUserName"] == null && Session["StorePassword"] == null)
                            {
                                Notification("Login to upload APK.", "error");
                                return;
                            }

                            getDetails_Directory = System.IO.File.ReadAllText(filePath + "\\" + Session["SubDomain"].ToString() + "\\password.txt");
                            var details = JObject.Parse(getDetails_Directory);

                            username = details["username"].ToString().Replace("\"", "").Trim();
                            password = details["password"].ToString().Replace("\"", "").Trim();

                            if (Session["StoreUserName"].ToString() != username && Session["StorePassword"].ToString() != password)
                            {
                                Notification("Invalid Credential, Login Again..", "error");
                                return;
                            }
                            //divUserName.Visible = true;
                            //divPassword.Visible = true;
                            //divSubmit1.Visible = true;
                            //divSubmit.Visible = false;
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "CallMyFunction", "KeepOpen()", true);
                            //return;
                        }

                        //if (System.IO.File.Exists(StoreDirectory))
                        //{
                        //    Notification("File Already Exists", "error");
                        //    ScriptManager.RegisterStartupScript(this, this.GetType(), "CallMyFunction", "KeepOpen()", true);
                        //    return;
                        //}
                        //else
                        //{

                        FileUpload1.SaveAs(StoreDirectory);
                        //Write Package file
                        System.IO.File.Delete(PackagePath + "\\" + filename.Substring(0, filename.Length - 4) + ".txt");
                        StreamWriter sw = new StreamWriter(PackagePath + "\\" + filename.Substring(0, filename.Length - 4) + ".txt", true);
                        sw.Write("{\"name\":\"" + txtName.Text.ToString().Trim() + "\",\"package\":\"" + txtPackageName.Text.ToString().Trim() + "\",\"version\":\"" + txtVersion.Text.ToString().Trim() + "\"}");
                        sw.Close();

                        LoadStore(Session["SubDomain"].ToString());
                        Notification("File Uploaded", "success");
                        Session["filepath"] = null;
                        //}
                    }
                    catch (Exception ex)
                    {
                        ClsLog.LogException(ex, "Error at Page Client Store Home -->fileUpload");
                    }
                }
                else
                {
                    Notification("Select Image to Upload", "error");
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "CallMyFunction", "KeepOpen()", true);
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "Notification('" + message + "','" + iconn + "');", true);
                    return;
                }
            }
            catch (Exception ex1)
            {
                Notification("Error OnUpload", "error");
                ClsLog.LogException(ex1, "Error at Page Client Store Home-->OnUpload");
            }
        }
        protected void OnEdit(object sender, EventArgs e)
        {
            //Find the reference of the Repeater Item.
            try
            {
                string       getDetails_Directory = "";
                string       name           = "";
                string       package        = "";
                string       version        = "";
                string       ApkFileName    = "";
                RepeaterItem item           = (sender as LinkButton).Parent as RepeaterItem;
                string       lblFolderName  = (item.FindControl("lblFolderName") as Label).Text.Trim();
                string       StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                string       filePath       = StoreDirectory;

                txtName.Text        = "";
                txtPackageName.Text = "";
                txtVersion.Text     = "";

                DirectoryInfo dirInfo = new DirectoryInfo(filePath + "\\" + lblFolderName + "\\" + "StoreAPK\\");
                if (System.IO.Directory.Exists(dirInfo.ToString()))
                {
                    string[] innerSubdirectoryEntries = Directory.GetFiles(dirInfo.ToString(), "*.apk");

                    if (innerSubdirectoryEntries.Length > 0)
                    {
                        foreach (var innerDirectory in innerSubdirectoryEntries)
                        {
                            int StringPosition = innerDirectory.IndexOf("StoreAPK");
                            ApkFileName = innerDirectory.Substring(StringPosition, innerDirectory.Length - StringPosition);
                            ApkFileName = ApkFileName.Replace("StoreAPK", "").Replace(@"\", "");
                            ApkFileName = ApkFileName.Replace(".apk", "");
                            if (System.IO.File.Exists(filePath + "\\" + lblFolderName + "\\" + "StoreAPK\\" + ApkFileName + ".txt"))
                            {
                                if (Session["StoreUserName"] == null && Session["StorePassword"] == null)
                                {
                                    Notification("Login to upload APK.", "error");
                                    return;
                                }
                                getDetails_Directory = System.IO.File.ReadAllText(filePath + "\\" + lblFolderName + "\\" + "StoreAPK\\" + ApkFileName + ".txt");
                                var details = JObject.Parse(getDetails_Directory);

                                name    = details["name"].ToString().Replace("\"", "").Trim();
                                package = details["package"].ToString().Replace("\"", "").Trim();
                                version = details["version"].ToString().Replace("\"", "").Trim();
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "EditValue('" + lblFolderName + "','" + ApkFileName + "','" + name + "','" + package + "','" + version + "');", true);
                            }
                            else
                            {
                                string aa = filePath + "\\" + lblFolderName + "\\" + "StoreAPK\\" + ApkFileName + ".txt";
                                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Msg", "EditValue('" + lblFolderName + "','" + ApkFileName + "','" + name + "','" + package + "','" + version + "');", true);
                            }
                        }
                    }
                    else
                    {
                        Notification("First Upload APP", "error");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Notification("Error at OnEdit", "error");
                ClsLog.LogException(ex, "Error at Admin Home-->OnEdit");
            }
            //this.ToggleElements(item, true);
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                if (FileUpload1.HasFile)
                {
                    try
                    {
                        string PackagePath = "";
                        //string username = "";
                        //string password = "";
                        //string getDetails_Directory = "";
                        string filename       = Path.GetFileName(FileUpload1.FileName);
                        string StoreDirectory = ConfigurationManager.AppSettings["Store_Directory"].ToString();
                        string filePath       = StoreDirectory;

                        StoreDirectory = StoreDirectory + "\\" + hiddenFolderName.Value.ToString() + "\\StoreAPK";
                        PackagePath    = StoreDirectory;

                        StoreDirectory = StoreDirectory + "\\" + filename;
                        //Session["filepath"] = StoreDirectory;

                        //if (System.IO.File.Exists(filePath + "\\" + hiddenFolderName.Value.ToString() + "\\password.txt"))
                        //{
                        //    if (Session["StoreUserName"] == null && Session["StorePassword"] == null)
                        //    {
                        //        Notification("Login to upload APK.", "error");
                        //        return;
                        //    }

                        //    getDetails_Directory = System.IO.File.ReadAllText(filePath + "\\" + Session["SubDomain"].ToString() + "\\password.txt");
                        //    var details = JObject.Parse(getDetails_Directory);

                        //    username = details["username"].ToString().Replace("\"", "").Trim();
                        //    password = details["password"].ToString().Replace("\"", "").Trim();

                        //    if (Session["StoreUserName"].ToString() != username && Session["StorePassword"].ToString() != password)
                        //    {
                        //        Notification("Invalid Credential, Login Again..", "error");
                        //        return;
                        //    }
                        //}

                        //if (System.IO.File.Exists(StoreDirectory))
                        //{
                        //    Notification("File Already Exists", "error");
                        //    ScriptManager.RegisterStartupScript(this, this.GetType(), "CallMyFunction", "KeepOpen()", true);
                        //    return;
                        //}
                        //else
                        //{

                        FileUpload1.SaveAs(StoreDirectory);
                        loadData();
                        Notification("File Uploaded", "success");
                        //Session["filepath"] = null;
                        //}
                    }
                    catch (Exception ex)
                    {
                        ClsLog.LogException(ex, "Error at Page Client Store Home -->fileUpload");
                    }
                }
                else
                {
                    Notification("Select Image to Upload", "error");
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "CallMyFunction", "KeepOpen()", true);
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "Msg", "Notification('" + message + "','" + iconn + "');", true);
                    return;
                }
            }
            catch (Exception ex1)
            {
                Notification("Error OnUpload", "error");
                ClsLog.LogException(ex1, "Error at Page Admin Home-->btnUpload");
            }
        }