Advertisement
Advertisement
| 05.09.2008 at 06:38AM PDT, ID: 23389224 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: |
ActionsPaneControl1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Office = Microsoft.Office.Core;
using System.Data;
namespace TestXpath
{
partial class ActionsPaneControl1 : UserControl
{
public ActionsPaneControl1()
{
InitializeComponent();
this.Load += new EventHandler(ActionsPaneControl1_Load);
}
private void ActionsPaneControl1_Load(object sender, EventArgs e)
{
this.cONTRACT_ITEM_VIEWTableAdapter.Fill(this.baseline_Consultancy_MSCRMDataSet.CONTRACT_ITEM_VIEW);
this.Insert.Click += new EventHandler(Insert_Click);
}
static void SetHeadings(Microsoft.Office.Interop.Word.Cell tblCell, string text)
{
tblCell.Range.Text = text;
tblCell.Range.Font.Bold = 1;
tblCell.Range.ParagraphFormat.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
}
private void AddData(DataRow row, string companyName)
{
object missing = System.Type.Missing;
// Create a table if it doesn't already exist.
if (Globals.ThisDocument.Tables.Count == 0)
{
try
{
// Create a table.
Microsoft.Office.Interop.Word.Table tbl = Globals.ThisDocument.Tables.Add
(Globals.ThisDocument.Application.Selection.Range, 1, 4, ref missing, ref missing);
// Insert headings.
SetHeadings(tbl.Cell(1, 1), "Contract No");
SetHeadings(tbl.Cell(1, 2), "Tag No");
SetHeadings(tbl.Cell(1, 3), "Item Description");
SetHeadings(tbl.Cell(1, 4), "Serial No");
}
catch (Exception ex)
{
MessageBox.Show("Problem creating Contracts table: " + ex.Message,
"Actions Pane", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// Add data from data row to the table.
Microsoft.Office.Interop.Word.Selection selection = Globals.ThisDocument.Application.Selection;
if (selection.Tables.Count > 0)
{
Microsoft.Office.Interop.Word.Row newRow = Globals.ThisDocument.Tables[1].Rows.Add(ref missing);
newRow.Range.Font.Bold = 0;
newRow.Range.ParagraphFormat.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft;
newRow.Cells[4].Range.ParagraphFormat.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;
newRow.Cells[1].Range.Text = row["ContractNo"].ToString();
newRow.Cells[2].Range.Text = row["TagNo"].ToString();
newRow.Cells[3].Range.Text = row["ItemDescription"].ToString();
newRow.Cells[4].Range.Text = row["SerialNo"].ToString();
}
else
{
MessageBox.Show("Cursor must be within a table.",
"Actions Pane", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Insert_Click(object sender, System.EventArgs e)
{
DataTable tbl = baseline_Consultancy_MSCRMDataSet.CONTRACT_ITEM_VIEW;
DataRow[] rows;
// Check if a Customer is selected.
if (this.customerComboBox.SelectedIndex >= 0)
{
DataRowView customerRow = (System.Data.DataRowView)this.customerComboBox.SelectedItem;
string customer = this.customerComboBox.Text;
// Return the data row from the selected Customer.
rows = tbl.Select("Customer = '" + customer.Replace("'", "''") + "'");
this.AddData(rows[0], customer);
}
else
{
MessageBox.Show("Please select a product.", "Actions Pane", MessageBoxButtons.OK);
}
}
private void customerComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
ThisDocument.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Office = Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
namespace TestXpath
{
public partial class ThisDocument
{
private ActionsPaneControl1 actions = new ActionsPaneControl1();
private void ThisDocument_Startup(object sender, System.EventArgs e)
{
this.ActionsPane.Controls.Add(actions);
}
private void ThisDocument_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Shutdown += new System.EventHandler(this.ThisDocument_Shutdown);
this.Startup += new System.EventHandler(this.ThisDocument_Startup);
}
#endregion
}
}
|