/// <summary>
        /// 更新指定短信的数据
        /// </summary>
        /// <param name="shortMsgID">短信ID</param>
        /// <param name="shortMsg">更新后的短信内容</param>
        public void Update(string shortMsgID, View_Task_ShortMessage shortMsg)
        {
            TaskManagementDataContext ctx = CommentParameter.TaskManagementDataContext;

            var result = from r in ctx.Task_ShortMessage
                         where r.ID == shortMsgID
                         select r;

            Task_ShortMessage msg = result.Single();

            msg.Status  = shortMsg.状态;
            msg.Content = shortMsg.短信内容;

            if (GlobalObject.GeneralFunction.IsNullOrEmpty(shortMsg.接收人手机号) || !StapleFunction.IsHandset(shortMsg.接收人手机号))
            {
                throw new Exception(string.Format("不正确的手机号码:{0}", shortMsg.接收人手机号));
            }

            msg.MobileNo       = shortMsg.接收人手机号;
            msg.Receiver       = shortMsg.接收人姓名;
            msg.SendTime       = shortMsg.发送时间;
            msg.Remark         = shortMsg.备注;
            msg.CreateTime     = ServerTime.Time;
            msg.ShortMsgTypeID = GetShortMsgType(shortMsg.短信类别).TypeID;

            ctx.SubmitChanges();
        }
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="data">要显示的数据</param>
        private void RefreshData(View_Task_ShortMessage shortMsg)
        {
            txtContent.Text = m_shortMsg.短信内容;

            dtpkSendTime.Value   = m_shortMsg.发送时间;
            dtpkSendTime.Checked = true;

            dataGridView1.Rows.Clear();
            dataGridView1.Rows.Add(new object[] { shortMsg.接收人姓名, shortMsg.接收人手机号 });
        }
        /// <summary>
        /// 初始化窗体
        /// </summary>
        /// <param name="row">要显示的信息</param>
        void InitForm(View_Task_ShortMessage shortMsg)
        {
            if (shortMsg != null)
            {
                m_shortMsg = shortMsg;

                RefreshData(shortMsg);
            }
            else
            {
                btnNew.PerformClick();
            }
        }
        /// <summary>
        /// 更新选择的记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageDialog.ShowPromptMessage("请选择要操作的记录后再进行此操作");
                return;
            }

            if (DialogResult.Yes != MessageDialog.ShowEnquiryMessage("您真的要修改指定记录吗?"))
            {
                return;
            }

            BindingCollection <View_Task_ShortMessage> source = dataGridView1.DataSource as BindingCollection <View_Task_ShortMessage>;

            View_Task_ShortMessage msg = source.First(p => p.短信编号 == dataGridView1.SelectedRows[0].Cells["短信编号"].Value.ToString());

            if (msg != null && msg.编制人工号 != null && msg.编制人工号 != BasicInfo.LoginID)
            {
                MessageDialog.ShowPromptMessage("您不是此记录的编制人,不能进行此操作");
                return;
            }

            msg.短信内容   = txtContent.Text;
            msg.接收人手机号 = txtMobileNo.Text;
            msg.接收人姓名  = txtReceiver.Text;
            msg.发送时间   = dtpkSendTime.Value;
            msg.短信类别   = cmbShortMsgType.Text;

            try
            {
                m_shortMsgServer.Update(msg.短信编号, msg);

                MessageDialog.ShowPromptMessage("更新成功");

                RefreshData();

                PositioningRecord(msg.短信编号);
            }
            catch (Exception exce)
            {
                MessageDialog.ShowErrorMessage(exce.Message);
            }
        }
        /// <summary>
        /// 保存短信
        /// </summary>
        /// <param name="status">保存后的短信状态</param>
        /// <returns>操作是否成功的标志</returns>
        private bool Save(ShortMessageStatus status)
        {
            try
            {
                if (!CheckData())
                {
                    return(false);
                }

                List <View_Task_ShortMessage> lstMsg = new List <View_Task_ShortMessage>();

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["手机号码"].Value != null && !GlobalObject.GeneralFunction.IsNullOrEmpty(dataGridView1.Rows[i].Cells["手机号码"].Value.ToString()))
                    {
                        if (dataGridView1.Rows[i].Cells["姓名"].Value == null || GlobalObject.GeneralFunction.IsNullOrEmpty(dataGridView1.Rows[i].Cells["姓名"].Value.ToString().Trim()))
                        {
                            MessageDialog.ShowErrorMessage("姓名不允许为空");
                            return(false);
                        }
                    }

                    if (dataGridView1.Rows[i].Cells["手机号码"].Value == null || GlobalObject.GeneralFunction.IsNullOrEmpty(dataGridView1.Rows[i].Cells["手机号码"].Value.ToString()))
                    {
                        continue;
                    }

                    View_Task_ShortMessage msg = new View_Task_ShortMessage();

                    if (chk带签名.Checked)
                    {
                        if (txtContent.Text[0] != ' ')
                        {
                            txtContent.Text = "    " + txtContent.Text;
                        }

                        msg.短信内容 = string.Format(@"亲爱的{0}:{1}{2}",
                                                 dataGridView1.Rows[i].Cells["姓名"].Value.ToString(),
                                                 System.Environment.NewLine,
                                                 txtContent.Text);
                    }
                    else
                    {
                        msg.短信内容 = txtContent.Text;
                    }

                    msg.发送时间  = dtpkSendTime.Value;
                    msg.接收人姓名 = dataGridView1.Rows[i].Cells["姓名"].Value.ToString();

                    msg.接收人手机号 = dataGridView1.Rows[i].Cells["手机号码"].Value.ToString();

                    msg.备注 = txtRemark.Text;

                    msg.短信类别 = cmbShortMsgType.Text;

                    lstMsg.Add(msg);
                }

                if (lstMsg.Count > 0)
                {
                    m_shortMsgServer.Add(lstMsg, status);

                    m_changeFlag = true;

                    return(true);
                }
                else
                {
                    MessageDialog.ShowErrorMessage("没有获取到要发送的人员信息");
                    return(false);
                }
            }
            catch (Exception exce)
            {
                MessageDialog.ShowErrorMessage(exce.Message);
                return(false);
            }
        }