private void FormFeatureRequest_Load(object sender, System.EventArgs e)
        {
            if (IsSelectionMode)
            {
                this.Text                = "Select a Feature Request";
                butClose.Text            = "Cancel";
                butOK.Visible            = true;
                labelSearchFirst.Visible = false;
                labelVote.Visible        = false;
            }
            else
            {
                butEdit.Visible = false;
            }
            _tableRequests = new ODDataTable();
            FillGrid();             //Fills column headings on load

            /*
             *      if(Security.IsAuthorized(Permissions.Setup,true)) {
             *              butCheck2.Visible=true;
             *      }
             *      else {
             *              textConnectionMessage.Text=Lan.g(this,"Not authorized for")+" "+GroupPermissions.GetDesc(Permissions.Setup);
             *      }
             */
            //if(!Synch()){
            //	return;
            //}
            //FillGrid();
        }
Example #2
0
		///<summary>Never happens with a new request.</summary>
		private void FillGrid(){
			Cursor=Cursors.WaitCursor;
			//prepare the xml document to send--------------------------------------------------------------------------------------
			XmlWriterSettings settings = new XmlWriterSettings();
			settings.Indent = true;
			settings.IndentChars = ("    ");
			StringBuilder strbuild=new StringBuilder();
			using(XmlWriter writer=XmlWriter.Create(strbuild,settings)){
				writer.WriteStartElement("FeatureRequestDiscussGetList");
				writer.WriteStartElement("RegistrationKey");
				writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
				writer.WriteEndElement();
				writer.WriteStartElement("RequestId");
				writer.WriteString(RequestId.ToString());
				writer.WriteEndElement();
				writer.WriteEndElement();
			}
			#if DEBUG
				OpenDental.localhost.Service1 updateService=new OpenDental.localhost.Service1();
			#else
				OpenDental.customerUpdates.Service1 updateService=new OpenDental.customerUpdates.Service1();
				updateService.Url=PrefC.GetString(PrefName.UpdateServerAddress);
			#endif
			//Send the message and get the result-------------------------------------------------------------------------------------
			string result="";
			try {
				result=updateService.FeatureRequestDiscussGetList(strbuild.ToString());
			}
			catch(Exception ex) {
				Cursor=Cursors.Default;
				MessageBox.Show("Error: "+ex.Message);
				return;
			}
			//textConnectionMessage.Text=Lan.g(this,"Connection successful.");
			//Application.DoEvents();
			Cursor=Cursors.Default;
			//MessageBox.Show(result);
			XmlDocument doc=new XmlDocument();
			doc.LoadXml(result);
			//Process errors------------------------------------------------------------------------------------------------------------
			XmlNode node=doc.SelectSingleNode("//Error");
			if(node!=null) {
				//textConnectionMessage.Text=node.InnerText;
				MessageBox.Show(node.InnerText,"Error");
				return;
			}
			//Process a valid return value------------------------------------------------------------------------------------------------
			node=doc.SelectSingleNode("//ResultTable");
			ODDataTable table=new ODDataTable(node.InnerXml);
			gridMain.BeginUpdate();
			gridMain.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TableRequestDiscuss","Date"),70);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequestDiscuss","Note"),200);
			gridMain.Columns.Add(col);
			gridMain.Rows.Clear();
			ODGridRow row;
			for(int i=0;i<table.Rows.Count;i++){
				row=new ODGridRow();
				row.Cells.Add(table.Rows[i]["dateTime"]);
				row.Cells.Add(table.Rows[i]["Note"]);
				gridMain.Rows.Add(row);
			}
			gridMain.EndUpdate();
		}
Example #3
0
		private void GetOneFromServer(){
			//get a table with data
			Cursor=Cursors.WaitCursor;
			//prepare the xml document to send--------------------------------------------------------------------------------------
			XmlWriterSettings settings = new XmlWriterSettings();
			settings.Indent = true;
			settings.IndentChars = ("    ");
			StringBuilder strbuild=new StringBuilder();
			using(XmlWriter writer=XmlWriter.Create(strbuild,settings)){
				writer.WriteStartElement("FeatureRequestGetOne");
				writer.WriteStartElement("RegistrationKey");
				writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
				writer.WriteEndElement();
				writer.WriteStartElement("RequestId");
				writer.WriteString(RequestId.ToString());
				writer.WriteEndElement();
				writer.WriteEndElement();
			}
			#if DEBUG
				OpenDental.localhost.Service1 updateService=new OpenDental.localhost.Service1();
			#else
				OpenDental.customerUpdates.Service1 updateService=new OpenDental.customerUpdates.Service1();
				updateService.Url=PrefC.GetString(PrefName.UpdateServerAddress);
			#endif
			//Send the message and get the result-------------------------------------------------------------------------------------
			string result="";
			try {
				result=updateService.FeatureRequestGetOne(strbuild.ToString());
			}
			catch(Exception ex) {
				Cursor=Cursors.Default;
				MessageBox.Show("Error: "+ex.Message);
				return;
			}
			//textConnectionMessage.Text=Lan.g(this,"Connection successful.");
			//Application.DoEvents();
			Cursor=Cursors.Default;
			//MessageBox.Show(result);
			XmlDocument doc=new XmlDocument();
			doc.LoadXml(result);
			//Process errors------------------------------------------------------------------------------------------------------------
			XmlNode node=doc.SelectSingleNode("//Error");
			if(node!=null) {
				//textConnectionMessage.Text=node.InnerText;
				MessageBox.Show(node.InnerText,"Error");
				DialogResult=DialogResult.Cancel;
				return;
			}
			//Process a valid return value------------------------------------------------------------------------------------------------
			node=doc.SelectSingleNode("//ResultTable");
			tableObj=new ODDataTable(node.InnerXml);
			ODDataRow row=tableObj.Rows[0];
			textDescription.Text=row["Description"];
			string detail=row["Detail"];
			detail=detail.Replace("\n","\r\n");
			textDetail.Text=detail;
			checkIsMine.Checked=PIn.Bool(row["isMine"]);
			textDifficulty.Text=row["Difficulty"];
			int approval=PIn.Int(row["Approval"]);
			if(IsAdminMode){
				textSubmitter.Text=row["submitter"];
			}
			comboApproval.SelectedIndex=approval;
			//textApproval gets set automatically due to comboApproval_SelectedIndexChanged.
			if(!IsAdminMode && PIn.Bool(row["isMine"])){//user editing their own request
				if((ApprovalEnum)approval==ApprovalEnum.New
					|| (ApprovalEnum)approval==ApprovalEnum.NeedsClarification
					|| (ApprovalEnum)approval==ApprovalEnum.NotARequest
					|| (ApprovalEnum)approval==ApprovalEnum.Redundant
					|| (ApprovalEnum)approval==ApprovalEnum.TooBroad)
					//so user not allowed to edit if Approved,AlreadyDone,Obsolete, or InProgress.
				{
					textDescription.BackColor=Color.White;
					textDescription.ReadOnly=false;
					textDetail.BackColor=Color.White;
					textDetail.ReadOnly=false;
					if((ApprovalEnum)approval!=ApprovalEnum.New){
						butResubmit.Visible=true;
					}
					butDelete.Visible=true;
				}
			}
			if((ApprovalEnum)approval!=ApprovalEnum.Approved){
				//only allowed to vote on Approved features.
				//All others should always have zero votes, except InProgress and Complete
				groupMyVotes.Visible=false;
			}
			if((ApprovalEnum)approval==ApprovalEnum.Approved
				|| (ApprovalEnum)approval==ApprovalEnum.InProgress
				|| (ApprovalEnum)approval==ApprovalEnum.Complete)
			{//even administrators should not be able to change things at this point
				textDescription.BackColor=colorDisabled;
				textDescription.ReadOnly=true;
				textDetail.BackColor=colorDisabled;
				textDetail.ReadOnly=true;
			}
			myPointsUsed=PIn.Int(row["myPointsUsed"]);
			try {
				myPointsAllotted=PIn.Int(row["myPointsAllotted"]);
			}
			catch {
				myPointsAllotted=100;
			}
			//textMyPointsRemain.Text=;this will be filled automatically when myPoints changes
			textMyPoints.Text=row["myPoints"];
			RecalcMyPoints();
			checkIsCritical.Checked=PIn.Bool(row["IsCritical"]);
			textMyPledge.Text=row["myPledge"];
			textTotalPoints.Text=row["totalPoints"];
			textTotalCritical.Text=row["totalCritical"];
			textTotalPledged.Text=row["totalPledged"];
			textWeight.Text=row["Weight"];
			try {
				textBounty.Text=row["Bounty"];
			}
			catch { }
		}
Example #4
0
        ///<summary>Never happens with a new request.</summary>
        private void FillGrid()
        {
            Cursor = Cursors.WaitCursor;
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){
                writer.WriteStartElement("FeatureRequestDiscussGetList");
                writer.WriteStartElement("RegistrationKey");
                writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
                writer.WriteEndElement();
                writer.WriteStartElement("RequestId");
                writer.WriteString(RequestId.ToString());
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
                        #if DEBUG
            OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
                        #else
            OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
            updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
                        #endif
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";
            try {
                result = updateService.FeatureRequestDiscussGetList(strbuild.ToString());
            }
            catch (Exception ex) {
                Cursor = Cursors.Default;
                MessageBox.Show("Error: " + ex.Message);
                return;
            }
            //textConnectionMessage.Text=Lan.g(this,"Connection successful.");
            //Application.DoEvents();
            Cursor = Cursors.Default;
            //MessageBox.Show(result);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result);
            //Process errors------------------------------------------------------------------------------------------------------------
            XmlNode node = doc.SelectSingleNode("//Error");
            if (node != null)
            {
                //textConnectionMessage.Text=node.InnerText;
                MessageBox.Show(node.InnerText, "Error");
                return;
            }
            //Process a valid return value------------------------------------------------------------------------------------------------
            node = doc.SelectSingleNode("//ResultTable");
            ODDataTable table = new ODDataTable(node.InnerXml);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableRequestDiscuss", "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequestDiscuss", "Note"), 200);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(table.Rows[i]["dateTime"]);
                row.Cells.Add(table.Rows[i]["Note"]);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Example #5
0
        private void GetOneFromServer()
        {
            //get a table with data
            Cursor = Cursors.WaitCursor;
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){
                writer.WriteStartElement("FeatureRequestGetOne");
                writer.WriteStartElement("RegistrationKey");
                writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
                writer.WriteEndElement();
                writer.WriteStartElement("RequestId");
                writer.WriteString(RequestId.ToString());
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
                        #if DEBUG
            OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
                        #else
            OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
            updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
                        #endif
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";
            try {
                result = updateService.FeatureRequestGetOne(strbuild.ToString());
            }
            catch (Exception ex) {
                Cursor = Cursors.Default;
                MessageBox.Show("Error: " + ex.Message);
                return;
            }
            //textConnectionMessage.Text=Lan.g(this,"Connection successful.");
            //Application.DoEvents();
            Cursor = Cursors.Default;
            //MessageBox.Show(result);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result);
            //Process errors------------------------------------------------------------------------------------------------------------
            XmlNode node = doc.SelectSingleNode("//Error");
            if (node != null)
            {
                //textConnectionMessage.Text=node.InnerText;
                MessageBox.Show(node.InnerText, "Error");
                DialogResult = DialogResult.Cancel;
                return;
            }
            //Process a valid return value------------------------------------------------------------------------------------------------
            node     = doc.SelectSingleNode("//ResultTable");
            tableObj = new ODDataTable(node.InnerXml);
            ODDataRow row = tableObj.Rows[0];
            textDescription.Text = row["Description"];
            string detail = row["Detail"];
            detail              = detail.Replace("\n", "\r\n");
            textDetail.Text     = detail;
            checkIsMine.Checked = PIn.Bool(row["isMine"]);
            textDifficulty.Text = row["Difficulty"];
            int approval = PIn.Int(row["Approval"]);
            if (IsAdminMode)
            {
                textSubmitter.Text = row["submitter"];
            }
            comboApproval.SelectedIndex = approval;
            //textApproval gets set automatically due to comboApproval_SelectedIndexChanged.
            if (!IsAdminMode && PIn.Bool(row["isMine"]))            //user editing their own request
            {
                if ((ApprovalEnum)approval == ApprovalEnum.New ||
                    (ApprovalEnum)approval == ApprovalEnum.NeedsClarification ||
                    (ApprovalEnum)approval == ApprovalEnum.NotARequest ||
                    (ApprovalEnum)approval == ApprovalEnum.Redundant ||
                    (ApprovalEnum)approval == ApprovalEnum.TooBroad)
                //so user not allowed to edit if Approved,AlreadyDone,Obsolete, or InProgress.
                {
                    textDescription.BackColor = Color.White;
                    textDescription.ReadOnly  = false;
                    textDetail.BackColor      = Color.White;
                    textDetail.ReadOnly       = false;
                    if ((ApprovalEnum)approval != ApprovalEnum.New)
                    {
                        butResubmit.Visible = true;
                    }
                    butDelete.Visible = true;
                }
            }
            if ((ApprovalEnum)approval != ApprovalEnum.Approved)
            {
                //only allowed to vote on Approved features.
                //All others should always have zero votes, except InProgress and Complete
                groupMyVotes.Visible = false;
            }
            if ((ApprovalEnum)approval == ApprovalEnum.Approved ||
                (ApprovalEnum)approval == ApprovalEnum.InProgress ||
                (ApprovalEnum)approval == ApprovalEnum.Complete)
            {            //even administrators should not be able to change things at this point
                textDescription.BackColor = colorDisabled;
                textDescription.ReadOnly  = true;
                textDetail.BackColor      = colorDisabled;
                textDetail.ReadOnly       = true;
            }
            myPointsUsed = PIn.Int(row["myPointsUsed"]);
            try {
                myPointsAllotted = PIn.Int(row["myPointsAllotted"]);
            }
            catch {
                myPointsAllotted = 100;
            }
            //textMyPointsRemain.Text=;this will be filled automatically when myPoints changes
            textMyPoints.Text = row["myPoints"];
            RecalcMyPoints();
            checkIsCritical.Checked = PIn.Bool(row["IsCritical"]);
            textMyPledge.Text       = row["myPledge"];
            textTotalPoints.Text    = row["totalPoints"];
            textTotalCritical.Text  = row["totalCritical"];
            textTotalPledged.Text   = row["totalPledged"];
            textWeight.Text         = row["Weight"];
            try {
                textBounty.Text = row["Bounty"];
            }
            catch { }
        }
Example #6
0
        private void FillGrid()
        {
            //if(textSearch.Text.Length<3){
            //	MsgBox.Show(this,"Please enter a search term with at least three letters in it.");
            //	return;
            //}
            Cursor = Cursors.WaitCursor;
            //Yes, this would be slicker if it were asynchronous, but no time right now.
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){
                writer.WriteStartElement("FeatureRequestGetList");
                writer.WriteStartElement("RegistrationKey");
                writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
                writer.WriteEndElement();
                writer.WriteStartElement("SearchString");
                writer.WriteString(textSearch.Text);
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
                        #if DEBUG
            OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
                        #else
            OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
            updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
                        #endif
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";
            try {
                result = updateService.FeatureRequestGetList(strbuild.ToString());
            }
            catch (Exception ex) {
                Cursor = Cursors.Default;
                MessageBox.Show("Error: " + ex.Message);
                return;
            }
            //textConnectionMessage.Text=Lan.g(this,"Connection successful.");
            //Application.DoEvents();
            Cursor = Cursors.Default;
            //MessageBox.Show(result);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result);
            //Process errors------------------------------------------------------------------------------------------------------------
            XmlNode node = doc.SelectSingleNode("//Error");
            if (node != null)
            {
                //textConnectionMessage.Text=node.InnerText;
                MessageBox.Show(node.InnerText, "Error");
                return;
            }
            node = doc.SelectSingleNode("//KeyDisabled");
            if (node == null)
            {
                //no error, and no disabled message
                if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, false))                //this is one of two places in the program where this happens.
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
            }
            else
            {
                //textConnectionMessage.Text=node.InnerText;
                MessageBox.Show(node.InnerText);
                if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, true))                //this is one of two places in the program where this happens.
                {
                    DataValid.SetInvalid(InvalidType.Prefs);
                }
                return;
            }
            //Process a valid return value------------------------------------------------------------------------------------------------
            node  = doc.SelectSingleNode("//ResultTable");
            table = new ODDataTable(node.InnerXml);
            //Admin mode----------------------------------------------------------------------------------------------------------------
            node = doc.SelectSingleNode("//IsAdminMode");
            if (node.InnerText == "true")
            {
                isAdminMode = true;
            }
            else
            {
                isAdminMode = false;
            }
            //FillGrid used to start here------------------------------------------------
            long selectedRequestId = 0;
            int  selectedIndex     = gridMain.GetSelectedIndex();
            if (selectedIndex != -1)
            {
                if (table.Rows.Count > selectedIndex)
                {
                    selectedRequestId = PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["RequestId"]);
                }
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableRequest", "Req#"), 40);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "Mine"), 40);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "My Votes"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "Total Votes"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "Diff"), 40);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "Weight"), 45);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "Approval"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRequest", "Description"), 500);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(table.Rows[i]["RequestId"]);
                row.Cells.Add(table.Rows[i]["isMine"]);
                row.Cells.Add(table.Rows[i]["myVotes"]);
                row.Cells.Add(table.Rows[i]["totalVotes"]);
                row.Cells.Add(table.Rows[i]["Difficulty"]);
                row.Cells.Add(table.Rows[i]["Weight"]);
                row.Cells.Add(table.Rows[i]["approval"]);
                row.Cells.Add(table.Rows[i]["Description"]);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (selectedRequestId.ToString() == table.Rows[i]["RequestId"])
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
		private void FillGrid(){
			//if(textSearch.Text.Length<3){
			//	MsgBox.Show(this,"Please enter a search term with at least three letters in it.");
			//	return;
			//}
			Cursor=Cursors.WaitCursor;
			//Yes, this would be slicker if it were asynchronous, but no time right now.
			//prepare the xml document to send--------------------------------------------------------------------------------------
			XmlWriterSettings settings = new XmlWriterSettings();
			settings.Indent = true;
			settings.IndentChars = ("    ");
			StringBuilder strbuild=new StringBuilder();
			using(XmlWriter writer=XmlWriter.Create(strbuild,settings)){
				writer.WriteStartElement("FeatureRequestGetList");
				writer.WriteStartElement("RegistrationKey");
				writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
				writer.WriteEndElement();
				writer.WriteStartElement("SearchString");
				writer.WriteString(textSearch.Text);
				writer.WriteEndElement();
				writer.WriteEndElement();
			}
			#if DEBUG
				OpenDental.localhost.Service1 updateService=new OpenDental.localhost.Service1();
			#else
				OpenDental.customerUpdates.Service1 updateService=new OpenDental.customerUpdates.Service1();
				updateService.Url=PrefC.GetString(PrefName.UpdateServerAddress);
			#endif
			//Send the message and get the result-------------------------------------------------------------------------------------
			string result="";
			try {
				result=updateService.FeatureRequestGetList(strbuild.ToString());
			}
			catch(Exception ex) {
				Cursor=Cursors.Default;
				MessageBox.Show("Error: "+ex.Message);
				return;
			}
			//textConnectionMessage.Text=Lan.g(this,"Connection successful.");
			//Application.DoEvents();
			Cursor=Cursors.Default;
			//MessageBox.Show(result);
			XmlDocument doc=new XmlDocument();
			doc.LoadXml(result);
			//Process errors------------------------------------------------------------------------------------------------------------
			XmlNode node=doc.SelectSingleNode("//Error");
			if(node!=null) {
				//textConnectionMessage.Text=node.InnerText;
				MessageBox.Show(node.InnerText,"Error");
				return;
			}
			node=doc.SelectSingleNode("//KeyDisabled");
			if(node==null) {
				//no error, and no disabled message
				if(Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled,false)) {//this is one of two places in the program where this happens.
					DataValid.SetInvalid(InvalidType.Prefs);
				}
			}
			else {
				//textConnectionMessage.Text=node.InnerText;
				MessageBox.Show(node.InnerText);
				if(Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled,true)) {//this is one of two places in the program where this happens.
					DataValid.SetInvalid(InvalidType.Prefs);
				}
				return;
			}
			//Process a valid return value------------------------------------------------------------------------------------------------
			node=doc.SelectSingleNode("//ResultTable");
			table=new ODDataTable(node.InnerXml);
			//Admin mode----------------------------------------------------------------------------------------------------------------
			node=doc.SelectSingleNode("//IsAdminMode");
			if(node.InnerText=="true"){
				isAdminMode=true;
			}
			else{
				isAdminMode=false;
			}
			//FillGrid used to start here------------------------------------------------
			long selectedRequestId=0;
			int selectedIndex=gridMain.GetSelectedIndex();
			if(selectedIndex!=-1){
				if(table.Rows.Count>selectedIndex){
					selectedRequestId=PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["RequestId"]);
				}
			}
			gridMain.BeginUpdate();
			gridMain.Columns.Clear();
			ODGridColumn col=new ODGridColumn(Lan.g("TableRequest","Req#"),40);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","Mine"),40);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","My Votes"),60);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","Total Votes"),70);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","Diff"),40);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","Weight"),45);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","Approval"),90);
			gridMain.Columns.Add(col);
			col=new ODGridColumn(Lan.g("TableRequest","Description"),500);
			gridMain.Columns.Add(col);
			gridMain.Rows.Clear();
			ODGridRow row;
			for(int i=0;i<table.Rows.Count;i++){
				row=new ODGridRow();
				row.Cells.Add(table.Rows[i]["RequestId"]);
				row.Cells.Add(table.Rows[i]["isMine"]);
				row.Cells.Add(table.Rows[i]["myVotes"]);
			  row.Cells.Add(table.Rows[i]["totalVotes"]);
				row.Cells.Add(table.Rows[i]["Difficulty"]);
				row.Cells.Add(table.Rows[i]["Weight"]);
				row.Cells.Add(table.Rows[i]["approval"]);
				row.Cells.Add(table.Rows[i]["Description"]);
				gridMain.Rows.Add(row);
			}
			gridMain.EndUpdate();
			for(int i=0;i<table.Rows.Count;i++){
				if(selectedRequestId.ToString()==table.Rows[i]["RequestId"]){
					gridMain.SetSelected(i,true);
				}
			}
		}
        private void FillGrid()
        {
            table = _tableRequests;
            table.Rows.Sort(FeatureRequestSort);            //Sort user submited/voted features to the top.
            //FillGrid used to start here------------------------------------------------
            long selectedRequestId = 0;
            int  selectedIndex     = gridMain.GetSelectedIndex();

            if (selectedIndex != -1)
            {
                if (table.Rows.Count > selectedIndex)
                {
                    selectedRequestId = PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["RequestId"]);
                }
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableRequest", "Req#"), 40, GridSortingStrategy.AmountParse);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Mine"), 40, GridSortingStrategy.StringCompare);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "My Votes"), 60, GridSortingStrategy.StringCompare);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Total Votes"), 70, GridSortingStrategy.StringCompare);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Comments"), 70, GridSortingStrategy.AmountParse);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Version\r\nCompleted"), 75, GridSortingStrategy.VersionNumber);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Diff"), 40, GridSortingStrategy.AmountParse);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Weight"), 45, HorizontalAlignment.Right, GridSortingStrategy.AmountParse);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Approval"), 90, GridSortingStrategy.StringCompare);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRequest", "Description"), 500, GridSortingStrategy.StringCompare);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                if ((checkMine.Checked && PIn.String(table.Rows[i]["isMine"]) != "X") ||
                    (checkMyVotes.Checked && PIn.String(table.Rows[i]["myVotes"]) == ""))
                {
                    continue;
                }
                row = new GridRow();
                row.Cells.Add(table.Rows[i]["RequestId"]);
                row.Cells.Add(table.Rows[i]["isMine"]);
                row.Cells.Add(table.Rows[i]["myVotes"]);
                row.Cells.Add(table.Rows[i]["totalVotes"]);
                row.Cells.Add(table.Rows[i]["TotalComments"]);
                row.Cells.Add(table.Rows[i]["versionCompleted"]);
                row.Cells.Add(table.Rows[i]["Difficulty"]);
                row.Cells.Add(PIn.Double(table.Rows[i]["Weight"]).ToString("F"));
                row.Cells.Add(table.Rows[i]["approval"]);
                row.Cells.Add(table.Rows[i]["Description"]);
                //If they voted or pledged on this feature, mark it so they can see. Can be re-added when/if they need to be more visible.
                if (table.Rows[i]["isMine"].ToString() != "" &&
                    table.Rows[i]["personalVotes"].ToString() == "0" &&
                    table.Rows[i]["personalCrit"].ToString() == "0" &&
                    table.Rows[i]["personalPledged"].ToString() == "0" &&
                    table.Rows[i]["approval"].ToString() != "Complete")
                {
                    row.ColorBackG = Color.FromArgb(255, 255, 230);                //light yellow.
                }
                gridMain.ListGridRows.Add(row);
                row.Tag = table.Rows[i];
            }
            gridMain.EndUpdate();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (selectedRequestId.ToString() == table.Rows[i]["RequestId"])
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
 ///<summary>Makes a web call to WebServiceCustomersUpdate in order to get an updated list of feature requests.</summary>
 private void RefreshRequestTable()
 {
     //Always clear the table first.
     _tableRequests = new ODDataTable();
     Cursor         = Cursors.WaitCursor;
     //Yes, this would be slicker if it were asynchronous, but no time right now.
     #region prepare the xml document to send--------------------------------------------------------------------------------------
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Indent      = true;
     settings.IndentChars = ("    ");
     StringBuilder strbuild = new StringBuilder();
     using (XmlWriter writer = XmlWriter.Create(strbuild, settings)) {
         writer.WriteStartElement("FeatureRequestGetList");
         writer.WriteStartElement("RegistrationKey");
         writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
         writer.WriteEndElement();
         writer.WriteStartElement("SearchString");
         writer.WriteString(textSearch.Text);
         writer.WriteEndElement();
         writer.WriteEndElement();
     }
                 #if DEBUG
     OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
                 #else
     OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
     updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
                 #endif
     #endregion
     #region Send the message and get the result-------------------------------------------------------------------------------------
     string result = "";
     try {
         result = updateService.FeatureRequestGetList(strbuild.ToString());
     }
     catch (Exception ex) {
         Cursor = Cursors.Default;
         MessageBox.Show("Error: " + ex.Message);
         return;
     }
     #endregion
     Cursor = Cursors.Default;
     XmlDocument doc = new XmlDocument();
     doc.LoadXml(result);
     #region Process errors------------------------------------------------------------------------------------------------------------
     XmlNode node = doc.SelectSingleNode("//Error");
     if (node != null)
     {
         //textConnectionMessage.Text=node.InnerText;
         MessageBox.Show(node.InnerText, "Error");
         return;
     }
     node = doc.SelectSingleNode("//KeyDisabled");
     if (node == null)
     {
         //no error, and no disabled message
         if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, false))                //this is one of two places in the program where this happens.
         {
             DataValid.SetInvalid(InvalidType.Prefs);
         }
     }
     else
     {
         //textConnectionMessage.Text=node.InnerText;
         MessageBox.Show(node.InnerText);
         if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, true))                //this is one of two places in the program where this happens.
         {
             DataValid.SetInvalid(InvalidType.Prefs);
         }
         return;
     }
     #endregion
     #region Process a valid return value------------------------------------------------------------------------------------------------
     node = doc.SelectSingleNode("//IsAdminMode");
     if (node.InnerText == "true")
     {
         isAdminMode = true;
     }
     else
     {
         isAdminMode = false;
     }
     node = doc.SelectSingleNode("//ResultTable");
     #endregion
     _tableRequests = new ODDataTable(node.InnerXml);
 }