private void FeatureLayer_EndSaveEdits(object sender, ESRI.ArcGIS.Client.Tasks.EndEditEventArgs e)
 {
     if (e.Success)
     {
         (MyMap.Layers["PoolPermitDynamicLayer"] as ArcGISDynamicMapServiceLayer).Refresh();
     }
 }
        /// <summary>
        /// When edit is saved then send SMS
        /// </summary>
        void teamFeatureLayer_EndSaveEdits(object sender, client.Tasks.EndEditEventArgs e)
        {
            commitEditCount++;
            if (commitEditCount > 1) //If the edits have been committed then return;
            {
                return;
            }

            #region Check if the edits have been saved successfully
            string assignmentResult      = "";
            bool   assignTeamsSuccessful = e.Success;
            assignmentResult += assignTeamsSuccessful ? "Teams assigned successfully." : "Failed to assign teams.";
            #endregion

            #region Fail to assign team, or phone information not available in team layer, or user choose not to send SMS
            if (assignTeamsSuccessful == false || SMSEnabled == false || SendSMS == false)
            {
                MessageBox.Show(assignmentResult, "Team assignment result");
                return;
            }
            #endregion

            #region Teams were assigned successfully and user chooses to send SMS to the team
            //In order to know more about sending SMS using SmtpClient, read
            //http://en.wikipedia.org/wiki/List_of_SMS_gateways
            try
            {
                //Get the phone numbers from those teams
                List <PhoneInfo> phoneInfos = seletcedTeams.Select(
                    newSeletcedTeam => new PhoneInfo()
                {
                    PhoneNum = newSeletcedTeam.Attributes[numAttribute].ToString(),
                    Carrier  = newSeletcedTeam.Attributes[carrierAttribute].ToString()
                }
                    ).ToList();

                //Set up the mail client and the mail content
                MailMessage sms        = new MailMessage();
                SmtpClient  smtpClient = new SmtpClient("<your email server>");
                sms.From = new MailAddress("<your email address>");
                smtpClient.UseDefaultCredentials = true;
                sms.Body = MessageBody;

                //Set up the recipient information
                foreach (PhoneInfo phoneInfo in phoneInfos)
                {
                    sms.To.Add(string.Format("{0}@{1}", phoneInfo.PhoneNum.TrimEnd('@'), phoneInfo.Carrier.TrimStart('@')));
                }

                //Send the SMS and notify user
                smtpClient.Send(sms);
                assignmentResult += " SMSs sent.";
                MessageBox.Show(assignmentResult, "Team assignment result");
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error sending SMS", "Error sending SMS");
            }
            #endregion
        }
 private void FeatureLayer_EndSaveEdits(object sender, ESRI.ArcGIS.Client.Tasks.EndEditEventArgs e)
 {
     (MyMap.Layers["HomelandSecurityMapServiceLayer"] as
      ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer).Refresh();
 }
예제 #4
0
 private void FeatureLayer_EndSaveEdits(object sender, ESRI.ArcGIS.Client.Tasks.EndEditEventArgs e)
 {
     ResetEditableSelection();
 }