Exemplo n.º 1
0
 public void Login()
 {
     bool bLoginned = false;
     Dictionary<string, string> data = new Dictionary<string, string>();
     try
     {
         //string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER.Replace("http://", "https://") + Properties.Settings.Default.URI_LOGINHANDLER + "?op=oauth&email=" + this.Email + "&password="******"&from=" + DeviceTypes.MSWordWin.ToString();
         string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER + Properties.Settings.Default.URI_LOGINHANDLER + "?op=oauth&email=" + this.Email + "&password="******"&from=" + DeviceTypes.MSWordWin.ToString();
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         data = js.Deserialize<Dictionary<string, string>>(Regex.Replace(req.GetResponseWithNetworkConnHandler(), @"^\(|\)$", ""));
     }
     catch(Exception ex)
     {
         Globals.ThisAddIn.log.WriteLine(LogType.Error, "LoginThread::Login", ex.ToString());
     }
     if (data != null && data.ContainsKey("Result"))
     {
         bLoginned = data["Result"] == "1";
     }
     if (bLoginned)
         loginControl.Invoke(loginControl.LoginSucceedEvent, new Object[] { data });
     else
         loginControl.Invoke(loginControl.LoginFailedEvent, new Object[] { Lang.en_US.Status_Login_Failed });
 }
Exemplo n.º 2
0
        // GET api/values
        private void SendSms(string mobileNo, string oTP)
        {
            CustomHttpRequest oRequest = new CustomHttpRequest();
            var url            = "http://10.156.0.105/OBLSMS/api/sendsms";
            var paraCollection = new NameValueCollection();

            paraCollection.Add("SendTo", mobileNo);
            paraCollection.Add("Msg", "You have sent a request to Log In OBL Mobile App.Your OTP is : " + oTP);
            paraCollection.Add("ApiId", "$01$02#03");
            paraCollection.Add("Password", "0BL$App#0TP@1");

            oRequest.PostJSONRequest(url, paraCollection);
        }
Exemplo n.º 3
0
 public void LoginByAuthentication()
 {
     bool bLoginned = false;
     Dictionary<string, string> data = new Dictionary<string, string>();
     try
     {
         //string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER.Replace("http://", "https://") + Properties.Settings.Default.URI_LOGINHANDLER + "?op=oauthalt&authstr=" + Properties.Settings.Default.USER_AUTHENTICATION;
         string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER + Properties.Settings.Default.URI_LOGINHANDLER + "?op=oauthalt&authstr=" + Properties.Settings.Default.USER_AUTHENTICATION;
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         data = js.Deserialize<Dictionary<string, string>>(System.Text.RegularExpressions.Regex.Replace(req.GetResponseWithNetworkConnHandler(), @"^\(|\)$", ""));
     }
     catch (Exception ex)
     {
         Globals.ThisAddIn.log.WriteLine(LogType.Error, "LoginThread::Login", ex.ToString());
     }
     if (data != null && data.ContainsKey("Result"))
         bLoginned = data["Result"] == "1";
     if (bLoginned)
         loginControl.Invoke(loginControl.LoginSucceedEvent, new Object[] { data });
     else
         loginControl.Invoke(loginControl.LoginFailedEvent, new Object[] { Lang.en_US.Status_Login_Failed });
 }
Exemplo n.º 4
0
 public IEnumerable<Colleague> LoadColleagues()
 {
     IEnumerable<Colleague> enumColleagues = null;
     //string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER.Replace("http://", "https://") + Properties.Settings.Default.URI_ROOTDATAHANDLER + "?op=getallcolleagues&userid=" + UserID;
     string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER + Properties.Settings.Default.URI_ROOTDATAHANDLER + "?op=getallcolleagues&userid=" + UserID;
     List<Colleague> listColleagues = new List<Colleague>();
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     listColleagues = js.Deserialize<List<Colleague>>(Regex.Replace(req.GetResponse(), @"^\(|\)$", ""));
     enumColleagues = listColleagues.OrderBy(Colleague => Colleague.ForeName);
     return enumColleagues;
 }
Exemplo n.º 5
0
 private void refreshCitedItem()
 {
     try
     {
         List<string> user_servers = new List<string>();
         List<string> user_ids = new List<string>();
         if (rci.UserList.Count > 0)
         {
             Dictionary<int, User>.KeyCollection keycoll = rci.UserList.Keys;
             foreach (int key in keycoll)
             {
                 user_ids.Add(rci.UserList[key].UserID + "");
             }
         }
         JavaScriptSerializer sr = new JavaScriptSerializer();
         //string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER.Replace("http://", "https://") + Properties.Settings.Default.URI_ROOTDATAHANDLER + "?op=getusersserveraddress&userlist=" + sr.Serialize(user_ids);
         string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER + Properties.Settings.Default.URI_ROOTDATAHANDLER + "?op=getusersserveraddress&userlist=" + sr.Serialize(user_ids);
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         user_servers = sr.Deserialize<List<string>>(Regex.Replace(req.GetResponse(), @"^\(|\)$", ""));
         for (int i = 0; i < user_ids.Count; i++)
         {
             rci.UserList[int.Parse(user_ids[i])].ServerAddress = user_servers[i];
         }
         listMasterRefItemIDs = new List<int>();
         itemDownloader(0);
         quarantineReferenceList();
     }
     catch (Exception ex)
     {
         log.WriteLine(LogType.Error, "DocumentFormatter::refreshCitedItem", ex.ToString());
     }
 }
Exemplo n.º 6
0
 public int GetColleagueItemCount(string serveraddress, int userid, string folderid)
 {
     Dictionary<string, object> data = new Dictionary<string, object>();
     string strRequestURL = "http://" + serveraddress + "/" + Properties.Settings.Default.URI_LOCALSHARESERVICE + "?op=getfolderinfo&targetid=" + userid + "&authentication=" + Authentication + "&folderid=" + folderid + "&sortorder=0&direction=0&filterfield=2&filterby=";
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     string serial = Regex.Replace(req.GetResponse(), @"^\(""|""\)$", "");
     data = js.Deserialize<Dictionary<string, object>>(Regex.Replace(serial, @"\\", ""));
     if (data.ContainsKey("Count"))
         return (int)data["Count"];
     else
         return 0;
 }
Exemplo n.º 7
0
 public List<string> LoadUserCitationStyleNames()
 {
     List<string> listStyles = new List<string>();
     try
     {
         string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=userstylenames&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication;
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         listStyles = js.Deserialize<List<string>>(req.GetResponse());
     }
     catch(Exception ex)
     {
         this.log.WriteLine(LogType.Error, "User::LoadUserCitationStyleNames", ex.ToString());
     }
     return listStyles;
 }
Exemplo n.º 8
0
 public List<ItemMasterRow> SearchWizFolioCollection(string terms, int start, int count)
 {
     List<ItemMasterRow> listItems = null;
     try
     {
         string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=wizfoliosearch&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication + "&terms=" + HttpUtility.UrlEncode(terms) + "&start=" + start + "&count=" + count;
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         listItems = js.Deserialize<List<ItemMasterRow>>(req.GetResponse());
     }
     catch (Exception ex)
     {
         this.log.WriteLine(LogType.Error, "User::SearchWizFolioCollection", ex.ToString());
     }
     return listItems;
 }
Exemplo n.º 9
0
 public List<ItemMasterRow> LoadItemsInRange(int iFolderID, int iStart, int iCount)
 {
     List<ItemMasterRow> listItems = new List<ItemMasterRow>();
     string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=itemsinrange&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication + "&folderid=" + iFolderID +"&start=" + iStart + "&count=" + iCount;
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     listItems = js.Deserialize<List<ItemMasterRow>>(req.GetResponse());
     return listItems;
 }
Exemplo n.º 10
0
 public CitationStyle LoadStyle(StyleOwner owner, string name)
 {
     string type = (owner == StyleOwner.Public) ? "official" : "user";
     CitationStyle style = new CitationStyle();
     string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=style&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication + "&type=" + type + "&name=" + name;
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     style = js.Deserialize<CitationStyle>(req.GetResponse());
     return style;
 }
Exemplo n.º 11
0
        /// <summary>
        /// WebBrowser load complete event
        /// </summary>
        private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            string strURL = this.wBLogin.Document.Url.ToString();
            Regex.Replace(strURL, @"^\s+|\s$", "");
            if (strURL.Contains("citeidentity="))
            {
                bool bLoginned = false;
                Dictionary<string, string> data = new Dictionary<string, string>();
                string[] strUserInfo = Regex.Split(strURL, "citeidentity=");
                string strDesDecrypt = desDecryptBase64(strUserInfo[1]);//DesDecrypt user's information
                string strEmail = strDesDecrypt.Split('|')[0];//Get Email
                string strPassword = strDesDecrypt.Split('|')[1];//Get PW

                try
                {
                    string strRequestURL = Properties.Settings.Default.URL_ROOTSERVER + Properties.Settings.Default.URI_LOGINHANDLER + "?op=oauth&email=" + strEmail + "&password="******"&from=" + DeviceTypes.MSWordWin.ToString();
                    CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
                    JavaScriptSerializer js = new JavaScriptSerializer();
                    data = js.Deserialize<Dictionary<string, string>>(Regex.Replace(req.GetResponseWithNetworkConnHandler(), @"^\(|\)$", ""));
                }
                catch (Exception ex)
                {
                    Globals.ThisAddIn.log.WriteLine(LogType.Error, "ThirdPartyLoginForm::ThirdPartyLogin", ex.ToString());
                }
                if (data != null && data.ContainsKey("Result"))
                {
                    bLoginned = data["Result"] == "1";
                }
                Form lastOpenedForm = Application.OpenForms[Application.OpenForms.Count - 1];
                if (lastOpenedForm.Name == "ThirdPartyLoginForm")
                {
                    lastOpenedForm.Activate();
                    Form.ActiveForm.Close();//Close the login form to complete the login process
                }
                Globals.ThisAddIn.user = new User(data["UserID"], data["LastName"], data["ForeName"], data["Authentication"], data["ServerAddress"], int.Parse(data["AccountType"]));
                Globals.ThisAddIn.iTempHeight = this.Height;
                Globals.ThisAddIn.iTempWidth = this.Width;
                Globals.ThisAddIn.ShowMasterControl();
                Globals.ThisAddIn.ShowCustomPanel();
            }
        }
Exemplo n.º 12
0
 public bool CheckStyleAccess(string name)
 {
     string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=styleaccess&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication + "&name=" + name;
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     return (req.GetResponse() == "1");
 }
Exemplo n.º 13
0
 public List<ItemMasterRow> LoadColleagueItemsInRange(string serveraddress, int userid, string folderid, int start, int count)
 {
     List<ItemMasterRow> listItems = new List<ItemMasterRow>();
     string strRequestURL = "http://" + serveraddress + "/" + Properties.Settings.Default.URI_LOCALSHARESERVICE + "?op=getitemsbyfolder&targetid=" + userid + "&authentication=" + Authentication + "&folderid=" + folderid + "&from=" + start + "&count=" + count + "&sortorder=0&direction=0&filterfield=2&filterby=&noabstract=false";
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     listItems = js.Deserialize<List<ItemMasterRow>>(Regex.Replace(req.GetResponse(), @"^\(|\)$", ""));
     return listItems;
 }
Exemplo n.º 14
0
 public List<ItemMasterRow> LoadColleagueItems(string serveraddress, int userid, string folderid)
 {
     List<ItemMasterRow> listItems = new List<ItemMasterRow>();
     string strRequestURL = "http://" + serveraddress + "/" + Properties.Settings.Default.URI_LOCALSHARESERVICE + "?op=getitemsbyfolderalt&targetid=" + userid + "&authentication=" + Authentication + "&folderid=" + folderid;
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     listItems = js.Deserialize<List<ItemMasterRow>>(Regex.Replace(req.GetResponse(), @"^\(|\)$", ""));
     return listItems;
 }
Exemplo n.º 15
0
 public IEnumerable<Folder> LoadColleagueFolders(string serveraddress, int userid, int parentid)
 {
     IEnumerable<Folder> enumFolders = null;
     try
     {
         List<Folder> listFolders = new List<Folder>();
         string strRequestURL = "http://" + serveraddress + "/" + Properties.Settings.Default.URI_LOCALSHARESERVICE + "?op=getsharedfoldersalt&targetid=" + userid + "&authentication=" + Authentication + "&parentid=" + parentid;
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         listFolders = js.Deserialize<List<Folder>>(Regex.Replace(req.GetResponse(), @"^\(|\)$", ""));
         enumFolders = listFolders.OrderBy(Folder => Folder.Name);
     }
     catch (Exception ex)
     {
         this.log.WriteLine(LogType.Error, "User::LoadColleagueFolders", ex.ToString());
     }
     return enumFolders;
 }
Exemplo n.º 16
0
 public int GetItemCount(int iFolderID)
 {
     int count = 0;
     string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=itemscount&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication + "&folderid=" + iFolderID;
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     count = int.Parse(req.GetResponse());
     return count;
 }
Exemplo n.º 17
0
 public ItemMasterRow GetItem(string serveraddress, string userid, int itemid, string accesscode)
 {
     ItemMasterRow item = null;
     if(Globals.ThisAddIn.GetItem(ref item, itemid))
     {
         return item;
     }
     try
     {
         string strRequestURL = "http://" + serveraddress + "/" + Properties.Settings.Default.URI_LOCALSHARESERVICE + "?op=getitem&targetid=" + userid + "&itemid=" + itemid + "&accesscode=" + accesscode + "&authentication=" + Authentication;
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         item = js.Deserialize<ItemMasterRow>(Regex.Replace(req.GetResponse(), @"^\(|\)$", ""));
     }
     catch (Exception ex)
     {
         this.log.WriteLine(LogType.Error, "User::LoadItems", ex.ToString());
     }
     return item;
 }
Exemplo n.º 18
0
 public IEnumerable<Folder> LoadFolders()
 {
     IEnumerable<Folder> enumFolders = null;
     try
     {
         List<Folder> listFolders = new List<Folder>();
         string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=ownfolder&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication="+Authentication;
         CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
         JavaScriptSerializer js = new JavaScriptSerializer();
         listFolders = js.Deserialize<List<Folder>>(req.GetResponse());
         enumFolders = listFolders.OrderBy(Folder => Folder.Name);
     }
     catch(Exception ex)
     {
         this.log.WriteLine(LogType.Error, "User::LoadFolders", ex.ToString());
     }
     return enumFolders;
 }
Exemplo n.º 19
0
 public List<ItemMasterRow> AddItems(object listItems)
 {
     string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=additems&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication;
     JavaScriptSerializer js = new JavaScriptSerializer();
     string strPostData = "items=" + HttpUtility.UrlEncode(js.Serialize(listItems));
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL, strPostData);
     List<ItemMasterRow> items = new List<ItemMasterRow>();
     items = js.Deserialize<List<ItemMasterRow>>(req.GetResponse());
     return items;
 }