예제 #1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var writer = new TextBoxWriter(SynchronizationContext.Current, this.Messages);
            var client = new CommonClient(writer);

            client.RunAsync("http://signalr-test1.cloudapp.net:81/");
        }
        private static void GetCurrency()
        {
            var client = new CommonClient();


            var currencyResponse = client.GetCurrencyAsync("", false).Result;

            if (currencyResponse != null)
            {
                if (currencyResponse.code == (int)ResponseCode.Success)
                {
                    foreach (var d in currencyResponse.data)
                    {
                        Console.WriteLine($"Currency: {d.currency}");
                        foreach (var c in d.chains)
                        {
                            Console.WriteLine($"Chain name: {c.chain}, base chain: {c.baseChain}, base chain protocol: {c.baseChainProtocol}");
                        }
                    }
                }
                else
                {
                    Console.WriteLine(currencyResponse.message);
                }
            }
        }
예제 #3
0
        public JsonResult GetStandingPAContent()
        {
            if (Session["StandingPaContent"] == null)
            {
                var    email     = Session["emailid"].ToString();
                string domain    = "%" + email.Substring(email.IndexOf('@'));
                var    common    = new CommonClient();
                bool   cachemode = System.Web.HttpContext.Current.Cache["poeid" + Session["SelectedPoe"].ToString()] != null;

                //("poeid+" + Session["SelectedPoe"].ToString() + "") != null;
                var returnValue = common.GetStandingPAContent(int.Parse(Session["id"].ToString()),
                                                              int.Parse(Session["SelectedPoe"].ToString()),
                                                              int.Parse(Session["subid"].ToString()), domain, cachemode);

                Session["StandingPaContent"] = returnValue;
                if (!cachemode)
                {
                    System.Web.HttpContext.Current.Cache.Insert("poeid" + Session["SelectedPoe"].ToString(), returnValue.GetPracticeArea, null, DateTime.Now.AddMonths(2), TimeSpan.Zero);
                }
                else
                {
                    returnValue.GetPracticeArea = (Module[])System.Web.HttpContext.Current.Cache["poeid" + Session["SelectedPoe"].ToString()];
                }
                return(JsonResponse(returnValue));
            }
            return(JsonResponse(Session["StandingPaContent"]));
        }
예제 #4
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var writer = new TextBoxWriter(SynchronizationContext.Current, this.Messages);
            var client = new CommonClient(writer);

            client.RunAsync();
        }
예제 #5
0
        public static void UpdateYammerContent(int id)
        {
            var common = new CommonClient();

            //c
            common.UpdateYammercontent(id);
        }
예제 #6
0
        public static Boolean Register(CommonClient user)
        {
            dbEntities db = new dbEntities();

            if (UserExists(user))
            {
                return(false); //* If user exists-do not register again.
            }
            Clients client = Mapper.UserToDB(user);

            try
            {
                byte[] salt      = Hash.GenerateSalt();
                string hashedPwd = Hash.ComputeHash(client.HashedPassword, salt);
                client.HashedPassword = hashedPwd;
                client.Salt           = Convert.ToBase64String(salt);
                db.Clients.Add(client);
                db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                Debug.WriteLine(dbEx.Message);
            }
            return(true);//* User added succeessfully
        }
예제 #7
0
        public JsonResult GetUserDetails(string emailid)
        {
            var common      = new CommonClient();
            var returnValue = common.GetUserDetailsByEmailId(emailid);

            return(JsonResponse(returnValue));
        }
예제 #8
0
        private static void GetCurrency()
        {
            var client = new CommonClient();

            _logger.Start();
            var currencyResponse = client.GetCurrencyAsync("", false).Result;

            _logger.StopAndLog();

            if (currencyResponse != null)
            {
                if (currencyResponse.code == (int)ResponseCode.Success)
                {
                    foreach (var d in currencyResponse.data)
                    {
                        AppLogger.Info($"Currency: {d.currency}");
                        foreach (var c in d.chains)
                        {
                            AppLogger.Info($"Chain name: {c.chain}, base chain: {c.baseChain}, base chain protocol: {c.baseChainProtocol}");
                        }
                    }
                }
                else
                {
                    AppLogger.Info(currencyResponse.message);
                }
            }
        }
예제 #9
0
        public JsonResult GetConnectHistory(string fromId, string forId)
        {
            var Common         = new CommonClient();
            var connecthistory = Common.GetConnectHistory(fromId, forId);

            return(JsonResponse(connecthistory));
        }
예제 #10
0
        int getNextRow()
        {
            int            i         = 0;
            DataTable      Dt        = null;
            SearchCriteria objSearch = new SearchCriteria();

            objSearch.Query       = _Query;
            objSearch.WhereString = _Where;
            objSearch.SearchOn    = _FilterCol;
            objSearch.SearchValue = this.Text;
            objSearch.MaximumRows = 2;
            objSearch.IsMoveUp    = false;
            CommonClient oDMCommon = new CommonClient();

            Dt = oDMCommon.GetDataSet_Search(objSearch, GetCompanyDBIndex(this).ToString()).Tables[0];
            oDMCommon.Close();

            if (Dt.Rows.Count > 1)
            {
                //if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[1][0]))
                //{
                ((DataView)this.ItemsSource).Table.Rows.RemoveAt(0);

                DataRow dr = ((DataView)this.ItemsSource).Table.NewRow();

                for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++)
                {
                    dr[j] = Dt.Rows[1][j];
                }
                ((DataView)this.ItemsSource).Table.Rows.Add(dr);
                // }
            }

            return(i);
        }
예제 #11
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            var controller = new UIViewController();
            var view       = new UIView(UIScreen.MainScreen.Bounds);

            view.BackgroundColor = UIColor.White;
            controller.View      = view;

            controller.NavigationItem.Title = "SignalR Client";

            var textView = new UITextView(new RectangleF(0, 0, 320, view.Frame.Height - 0));

            view.AddSubview(textView);


            navController = new UINavigationController(controller);

            window.RootViewController = navController;
            window.MakeKeyAndVisible();

            var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);

            var client = new CommonClient(traceWriter);

            client.RunAsync("http://signalr-test1.cloudapp.net:82/");

            return(true);
        }
예제 #12
0
        public JsonResult GetDigDeepSyncScoreByFbid()
        {
            int userMappingId = 0;
            var common        = new CommonClient();

            if (Session["ausermapid"] != null)
            {
                userMappingId = int.Parse(Session["ausermapid"].ToString());
            }
            else if (Session["subid"] != null && Session["id"] != null && Session["SelectedPoe"] != null)
            {
                var rvalue = common.GetMyReceiveFbTeam(int.Parse(Session["id"].ToString()), int.Parse(Session["SelectedPoe"].ToString()), int.Parse(Session["subid"].ToString()));
                if (rvalue != null && rvalue[0] != null)
                {
                    userMappingId = rvalue[0].UserPOEMappingId;
                }
            }
            if (Session["GrpID"] != null && Session["subid"] != null && Session["id"] != null && Session["type"] != null && Session["SelectedPoe"] != null)
            {
                var returnValue = common.GetSyncTeamScore(int.Parse(Session["id"].ToString()), int.Parse(Session["SelectedPoe"].ToString()), int.Parse(Session["subid"].ToString()), int.Parse(Session["type"].ToString()), Session["Grpid"].ToString(), userMappingId);
                return(JsonResponse(returnValue));
            }
            else if (Session["subid"] != null && Session["id"] != null && Session["type"] != null && Session["SelectedPoe"] != null && Session["fbid"] != null)
            {
                var returnValue = common.GetSyncScoresByFbId(int.Parse(Session["id"].ToString()),
                                                             int.Parse(Session["SelectedPoe"].ToString()),
                                                             int.Parse(Session["subid"].ToString()), userMappingId,
                                                             int.Parse(Session["type"].ToString()), int.Parse(Session["fbid"].ToString()));
                return(JsonResponse(returnValue));
            }
            else
            {
                return(null);
            }
        }
예제 #13
0
        public JsonResult GetPassword(string mailid)
        {
            var common = new CommonClient();
            var result = common.GetPasswordForUSer(mailid);

            return(JsonResponse(result));
        }
예제 #14
0
        public JsonResult GetUserMappingDetails()
        {
            var common      = new CommonClient();
            var returnValue = common.GetUserMappingDetails(int.Parse(Session["id"].ToString()), int.Parse(Session["subid"].ToString()));

            return(JsonResponse(returnValue));
        }
예제 #15
0
        public JsonResult GetPoEsByUserId()
        {
            var common      = new CommonClient();
            var returnValue = common.GetPoEsByUserId(int.Parse(Session["id"].ToString()));

            return(JsonResponse(returnValue));
        }
예제 #16
0
        public JsonResult GetNotifications()
        {
            var common        = new CommonClient();
            var getmangerType = common.GetUserNotificationsLatest(int.Parse(Session["id"].ToString()));

            return(JsonResponse(getmangerType));
        }
예제 #17
0
        /// <summary>
        /// Getpasswords the specified email address.
        /// </summary>
        /// <param name="emailAddress">The email address.</param>
        /// <returns></returns>
        public JsonResult GetPassword(string emailAddress)
        {
            var common      = new CommonClient();
            var returnValue = common.GetPassword(emailAddress);

            return(JsonResponse(true));
        }
예제 #18
0
        /// <summary>
        /// Checks the email id.
        /// </summary>
        /// <param name="emailAddress">The email address.</param>
        /// <returns></returns>
        public JsonResult CheckEmailId(string emailAddress)
        {
            var common      = new CommonClient();
            var returnValue = common.CheckEmailId(emailAddress);// "";//;

            return(JsonResponse(returnValue));
        }
예제 #19
0
        /// <summary>
        /// Get All Areas
        /// </summary>
        /// <returns></returns>

        public JsonResult GetAllAreas()
        {
            var common      = new CommonClient();
            var returnValue = common.GetAllArea();

            return(JsonResponse(returnValue));
        }
예제 #20
0
        /// <summary>
        /// Updates the password.
        /// </summary>
        /// <param name="userName">Email id of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>

        public JsonResult UpdatePassword(string userName, string password)
        {
            var common      = new CommonClient();
            var returnValue = common.UpdatePassword(userName, password);

            return(JsonResponse(returnValue));
        }
예제 #21
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            var controller = new UIViewController();

            var label = new UILabel(new RectangleF(0, 0, 320, 30));

            label.Text = "SignalR Client";

            var textView = new UITextView(new RectangleF(0, 35, 320, 500));

            controller.Add(label);
            controller.Add(textView);

            window.RootViewController = controller;
            window.MakeKeyAndVisible();

            var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);

            var client = new CommonClient(traceWriter);

            client.RunAsync("http://signalr-test1.cloudapp.net:82/");

            return(true);
        }
예제 #22
0
        public JsonResult GetMyDetail()
        {
            var common = new CommonClient();

            if (Session["StartPageMode"] != null && int.Parse(Session["StartPageMode"].ToString()) == 0)
            {
                var returnValue = common.GetMyDetail(int.Parse(Session["id"].ToString()),
                                                     int.Parse(Session["SelectedPoe"].ToString()),
                                                     int.Parse(Session["subid"].ToString()));
                if (returnValue != null)
                {
                    return(JsonResponse(returnValue));
                }
                else
                {
                    var userdetail = common.GetUserDetailsByEmailId(Session["emailid"].ToString());

                    return(JsonResponse(new CommonWCF.UserPOEMapping
                    {
                        JobTitle = "Subscriber",
                        User = userdetail
                    }));
                }
            }
            else
            {
                var returnValue = common.GetMyDetailWithArea(int.Parse(Session["id"].ToString()),
                                                             int.Parse(Session["SelectedPoe"].ToString()),
                                                             int.Parse(Session["subid"].ToString()));

                return(JsonResponse(returnValue));
            }
        }
예제 #23
0
        public JsonResult GetUserInfoByMappingId(int userMappingId)
        {
            var common     = new CommonClient();
            var userdetail = common.GetUserdetailsByMappingId(userMappingId);

            return(JsonResponse(userdetail));
        }
예제 #24
0
        public JsonResult GetPoeName()
        {
            var common      = new CommonClient();
            var returnValue = common.GetPoeName(int.Parse(Session["SelectedPoe"].ToString()));

            return(JsonResponse(returnValue.Replace("&", "").Replace(" ", "")));
        }
예제 #25
0
        public JsonResult GetNetworkUsers()
        {
            var common = new CommonClient();

            if (Session["type"] != null)
            {
                if (Session["subid"] != null && Session["id"] != null && Session["type"] != null && int.Parse(Session["type"].ToString()) == 1)
                {
                    var returnValue = common.GetMyReceiveFbTeam(int.Parse(Session["id"].ToString()),
                                                                int.Parse(Session["SelectedPoe"].ToString()),
                                                                int.Parse(Session["subid"].ToString()));
                    return(JsonResponse(returnValue));
                }
                else if (Session["subid"] != null && Session["id"] != null && Session["type"] != null)
                {
                    var returnValue = common.GetMyGiveFbTeam(int.Parse(Session["id"].ToString()),
                                                             int.Parse(Session["SelectedPoe"].ToString()),
                                                             int.Parse(Session["subid"].ToString()));
                    return(JsonResponse(returnValue));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
예제 #26
0
        public JsonResult GetManagerDevPriorities(int tmMappingId)
        {
            var common = new CommonClient();

            if (Session["subid"] != null && Session["id"] != null)
            {
                var returnValue = common.GetManagerDevPriorities(int.Parse(Session["id"].ToString()),
                                                                 int.Parse(Session["SelectedPoe"].ToString()),
                                                                 tmMappingId);
                if (returnValue != null)
                {
                    Session["DevPriorities"] = returnValue;
                    //ProfileView();
                }
                else
                {
                    Session["DevPriorities"] = null;
                }
                return(JsonResponse(returnValue));
            }
            else
            {
                return(null);
            }
        }
예제 #27
0
        public JsonResult GetManagerDevProgress(int tmid, int moduleid)
        {
            var common = new CommonClient();

            if (Session["devProgress"] == null || moduleid == 0)
            {
                var teamDevProgress = common.GetManagerDevProgress(int.Parse(Session["id"].ToString()),
                                                                   int.Parse(Session["SelectedPoe"].ToString()), tmid);
                Session["devProgress"] = teamDevProgress;
                //if (moduleid != 0)
                //{
                //    teamDevProgress = (Results[])teamDevProgress.Where(a => a.ModuleId == moduleid);
                //}
                return(JsonResponse(teamDevProgress));
            }
            else
            {
                var teamDevProgress = (Results[])Session["devProgress"];
                if (moduleid != 0)
                {
                    teamDevProgress = teamDevProgress.Where(a => a.ModuleId == moduleid).ToArray();
                }
                return(JsonResponse(teamDevProgress));
            }
        }
예제 #28
0
        //public JsonResult Notifications()
        //{
        //    if (Session["id"] != null)
        //    {
        //        var commonWcfClient = new CommonWCF.CommonClient();
        //        var notificationResult = commonWcfClient.GetUserNotifications(int.Parse(Session["id"].ToString()), int.Parse(Session["subid"].ToString()));
        //    }

        //    return JsonResponse();
        //}

        //[SessionExpireFilter]
        public ActionResult Start(string userId)
        {
            //For pipe9 cloud development
            if (userId != null)
            {
                var usr    = Convert.ToInt32(DecryptString(userId));
                var signUp = new SignupClient();
                var suser  = signUp.GetUserById(usr);
                Session["user"] = suser;
                var loggeduserName = suser.FirstName + " " + suser.LastName;
                ViewData["username"] = loggeduserName;
                Session["Uname"]     = loggeduserName;
                Session["emailid"]   = suser.EmailAddress;
                Session["id"]        = usr;
                Session["domain"]    = suser.EmailAddress.Split('@')[1];
                Session["subid"]     = -1;
            }
            if (Session["id"] != null)
            {
                var commonWcfClient    = new CommonWCF.CommonClient();
                var notificationResult = commonWcfClient.GetUserNotifications(int.Parse(Session["id"].ToString()), int.Parse(Session["subid"].ToString()));
                ViewBag.notificationResult = notificationResult;
            }
            var common = new CommonClient();

            byte[] userImage = common.GetUserPhoto(int.Parse(Session["id"].ToString())).Photo;

            ViewBag.userImage = userImage;



            Session["DashboardMappingId"] = null;
            Session["GivenClick"]         = null;
            return(View());
        }
예제 #29
0
        public JsonResult GetMyNetworkSubscribedPoes()
        {
            var common         = new CommonClient();
            var mySubscription = common.GetMySubscription(Session["emailid"].ToString());

            if (mySubscription != null)
            {
                var ismySub = mySubscription.Count(a => a.Subscriptionid == int.Parse(Session["subid"].ToString()));
                if (ismySub != 0)
                {
                    var returnValue = common.GetMySubscribedPoes(int.Parse(Session["subid"].ToString()));
                    if (returnValue.Count() != 0)
                    {
                        return(JsonResponse(returnValue.Reverse()));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    var returnValue = common.GetPoEsByUserId(int.Parse(Session["id"].ToString()));
                    return(JsonResponse(returnValue));
                }
            }
            else
            {
                var returnValue = common.GetPoEsByUserId(int.Parse(Session["id"].ToString()));
                return(JsonResponse(returnValue));
            }
        }
예제 #30
0
        public JsonResult GetMyPeers()
        {
            var common      = new CommonClient();
            var returnValue = common.GetMyPeers(int.Parse(Session["id"].ToString()), int.Parse(Session["SelectedPoe"].ToString()), int.Parse(Session["subid"].ToString()));

            return(JsonResponse(returnValue));
        }
예제 #31
0
        int getNextRow()
        {
            int i = 0;
            DataTable Dt = null;
            SearchCriteria objSearch = new SearchCriteria();
            objSearch.Query = _Query;
            objSearch.WhereString = _Where;
            objSearch.SearchOn = _FilterCol;
            objSearch.SearchValue = this.Text;
            objSearch.MaximumRows = 2;
            objSearch.IsMoveUp = false;
            CommonClient oDMCommon = new CommonClient();
            Dt = oDMCommon.GetDataSet_Search(objSearch, CompanyDBIndex.ToString()).Tables[0];
            oDMCommon.Close();

            if (Dt.Rows.Count > 1)
            {
                if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[1][0]))
                {
                    ((DataView)this.ItemsSource).Table.Rows.RemoveAt(0);

                    DataRow dr = ((DataView)this.ItemsSource).Table.NewRow();

                    for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++)
                    {
                        dr[j] = Dt.Rows[1][j];
                    }
                    ((DataView)this.ItemsSource).Table.Rows.Add(dr);
                }
            }

            return i;
        }
예제 #32
0
        void FillListBox()
        {
            DataTable Dt = null;
            SearchCriteria objSearch = new SearchCriteria();
            objSearch.Query = _Query;
            objSearch.WhereString = _Where;
            objSearch.SearchOn = _FilterCol;
            objSearch.SearchValue = this.Text;
            objSearch.MaximumRows = PageSize;
            objSearch.IsMoveUp = false;

            if (valueSelected)
            {
                objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString();
                valueSelected = false;
            }
            else
                objSearch.SelectedValueQuery = "";
            if (_Where.Trim() != "")
                _Query = _Query + " where " + _Where;

            CommonClient oDMCommon = new CommonClient();
            if (GetIsPartiralData(this))
                Dt = oDMCommon.GetDataTable_Search(objSearch, GetCompanyDBIndex(this).ToString());
            else
                Dt = oDMCommon.GetDataTable(_Query, GetCompanyDBIndex(this).ToString());

            oDMCommon.Close();

            IstextChanged = true;

            if (Dt != null && Dt.Rows.Count > 0)
            {
                if (this.ItemsSource == null)
                {
                    this.ItemsSource = Dt.DefaultView;
                    //  ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] };
                }
                else
                {

                    ((DataView)this.ItemsSource).Table.Rows.Clear();
                    //Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] };

                    //for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++)
                    //{
                    //    if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0]))
                    //    {
                    //        ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i);
                    //        i--;
                    //    }
                    //}

                    for (int i = 0; i < Dt.Rows.Count; i++)
                    {
                        //if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0]))
                        //    continue;

                        DataRow dr = ((DataView)this.ItemsSource).Table.NewRow();

                        for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++)
                        {
                            dr[j] = Dt.Rows[i][j];
                        }
                        //  if (((DataView)this.ItemsSource).Table.Rows.Count == i)
                        ((DataView)this.ItemsSource).Table.Rows.Add(dr);
                        //else
                        //    ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i);
                    }
                    //if (popupDataGrid.Items.Count > 0)
                    //    popupDataGrid.SelectedItem = popupDataGrid.Items[0];
                }

                //if (txt != this.Text)
                //{
                //    IstextChanged = true;
                //    this.Text = txt;

                //    for (int i = 0; i < popupDataGrid.Items.Count; i++)
                //    {
                //        if (this.Text == ((DataRowView)popupDataGrid.Items[i]).Row.ItemArray[SearchColumn].ToString())
                //        {
                //            popupDataGrid.SelectedItem = popupDataGrid.Items[i];
                //            return;
                //        }

                //    }

                //}

            }
            IstextChanged = false;
        }
예제 #33
0
        int getPrevRow()
        {
            int i = 0;
            DataTable Dt = null;
            SearchCriteria objSearch = new SearchCriteria();
            objSearch.Query = _Query;
            objSearch.WhereString = _Where;
            objSearch.SearchOn = _FilterCol;
            objSearch.SearchValue = this.Text;
            objSearch.MaximumRows = 2;
            objSearch.IsMoveUp = true;

            CommonClient oDMCommon = new CommonClient();
            Dt = oDMCommon.GetDataSet_Search(objSearch, GetCompanyDBIndex(this).ToString()).Tables[0];
            oDMCommon.Close();
            if (Dt.Rows.Count > 0)
            {

                //if (!((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[0][0]))
                //{
                DataRow dr = ((DataView)this.ItemsSource).Table.NewRow();

                for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++)
                {
                    dr[j] = Dt.Rows[0][j];
                }

                ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, 0);

                ((DataView)this.ItemsSource).Table.Rows.RemoveAt(((DataView)this.ItemsSource).Table.Rows.Count - 1);
                // }
            }

            return i;
        }
예제 #34
0
        void FillListBox()
        {
            IstextChanged = true;

            DataTable Dt = null;
            SearchCriteria objSearch = new SearchCriteria();
            objSearch.Query = _Query;
            objSearch.WhereString = _Where;
            objSearch.SearchOn = _FilterCol;
            objSearch.SearchValue = this.Text;
            objSearch.MaximumRows = PageSize;
            objSearch.IsMoveUp = false;

            if (valueSelected)
            {
                objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString();
                valueSelected = false;
            }

            CommonClient oDMCommon = new CommonClient();
            Dt = oDMCommon.GetDataTable_Search(objSearch, CompanyDBIndex.ToString());
            oDMCommon.Close();

            if (Dt != null && Dt.Rows.Count > 0)
            {
                if (this.ItemsSource == null)
                {
                    this.ItemsSource = Dt.AsDataView();
                    ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] };
                }
                else
                {

                    Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] };

                    for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++)
                    {
                        if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0]))
                        {
                            ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i);
                            i--;
                        }
                    }

                    for (int i = 0; i < Dt.Rows.Count; i++)
                    {
                        if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0]))
                            continue;

                        DataRow dr = ((DataView)this.ItemsSource).Table.NewRow();

                        for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++)
                        {
                            dr[j] = Dt.Rows[i][j];
                        }
                        if (((DataView)this.ItemsSource).Table.Rows.Count == i)
                            ((DataView)this.ItemsSource).Table.Rows.Add(dr);
                        else
                            ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i);
                    }

                    //if (popupDataGrid.Items.Count > 0)
                    //    popupDataGrid.SelectedItem = popupDataGrid.Items[0];
                }

            }

            IstextChanged = false;
        }
예제 #35
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            if (GetFeatureID(this) == 0)
                return;

            CommonClient oDMCommon = new CommonClient();
            DataTable dt = oDMCommon.GetDataTable("SELECT * FROM AdmnLayoutLists WHERE ID=" + GetFeatureID(this).ToString(), GetCompanyDBIndex(this).ToString());
            oDMCommon.Close();
            strTable = dt.Rows[0]["TableName"].ToString();
            strPrimaryKey = dt.Rows[0]["PrimaryKey"].ToString();
            _Where = dt.Rows[0]["WhereClause"].ToString();

            XmlDocument xDoc = new XmlDocument();
            xDoc.LoadXml(dt.Rows[0]["LayoutXML"].ToString());

            XmlNodeList xList = xDoc.SelectNodes("XML/Columns/TreeColumn");
            TreeColumn oCol;
            oColumns = new List<TreeColumn>();

            _Query = "SELECT " + strPrimaryKey;

            this.IsEditable = true;
            Microsoft.Windows.Controls.DataGridTextColumn dgCol;

            dgCol = new Microsoft.Windows.Controls.DataGridTextColumn();
            dgCol.Header = strPrimaryKey;
            dgCol.Binding = new Binding(strPrimaryKey);
            dgCol.Visibility = System.Windows.Visibility.Hidden;
            this.Columns.Add(dgCol);

            for (int i = 0; i < xList.Count; i++)
            {
                oCol = (TreeColumn)PACTSerializer.FromXml(xList[i].OuterXml, typeof(TreeColumn));
                _Query += "," + oCol.Name;

                dgCol = new Microsoft.Windows.Controls.DataGridTextColumn();
                dgCol.Header = oCol.Label;

                if (xList.Count == 1)
                {
                    if (this.Width > 0)
                        dgCol.Width = this.Width;
                    else
                        dgCol.Width = oCol.Width;
                }
                else
                    dgCol.Width = oCol.Width;

                dgCol.CanUserResize = false;
                dgCol.CanUserSort = false;
                dgCol.Binding = new Binding(oCol.Name);
                iWidth += oCol.Width;
                this.Columns.Add(dgCol);
                oColumns.Add(oCol);
            }

            _Query += " FROM " + strTable;

            if (this.SelectedValue != null)
                valueSelected = true;

            //this.SelectedValue = new Binding(strPrimaryKey);
            this.SelectedValuePath = strPrimaryKey;
        }