示例#1
0
 public TimeTracker()
 {
     this.session    = new Session();
     this.crmAdaptor = new CRMAdaptor();
     this.crmAdaptor.GetCRMConnection();
     GetTimeTrackerMode(new Uri("https://csp.api.crm.dynamics.com/XRMServices/2011/Organization.svc"));
     timer1.Interval = 1000;
     timer1.Tick    += Timer_Tick;
     InitializeComponent();
     GetData();
 }
示例#2
0
        protected void CreateCaseTask(object sender, EventArgs e)
        {
            try
            {
                CRMAdaptor crmAdaptor = new CRMAdaptor();
                bool       isValid    = crmAdaptor.GetCRMConnection();

                if (!isValid)
                {
                    return;
                }

                Cursor.Current = Cursors.WaitCursor;

                List <TimeItem> workItems = MapTimeItems();
                workItems = crmAdaptor.CreateCaseTask(workItems);

                foreach (TimeItem item in workItems)
                {
                    if (item.crmTaskId != null)
                    {
                        crmGuids[(int)item.index] = item.crmTaskId != null?item.crmTaskId.ToString() : null;

                        crmExternalCommentGuids[(int)item.index] = item.crmExternalCommentId != null?item.crmExternalCommentId.ToString() : null;

                        CheckBox submitted = this.Controls.Find(Constants.isSubmitted + item.index, true).FirstOrDefault() as CheckBox;
                        submitted.Checked    = (bool)item.isCRMSubmitted;
                        submitted.Appearance = Appearance.Button;
                        submitted.BackColor  = Color.Green;
                    }
                }
                AutoSave();

                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.InnerException.Message);
            }
        }