示例#1
0
 public Confirm(ConfirmMessage message)
 {
     InitializeComponent();
     this.PreviewKeyDown += Confirm_PreviewKeyDown;
     CurrrentModel        = message;
     this.ApplyBindings(this, CurrrentModel);
 }
示例#2
0
        internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell)
        {
            string image = FileSource(false, cell);

            if (HyperLinkColumn && Grid.DisplayView == DisplayView.Grid)
            {
                string a = Grid.EnableCallBack ? Asynchronous.GetCallbackEventReference(Grid,
                                                                                        string.Format("RecordClick!{0}!{1}", ColumnId,
                                                                                                      cell.Row.PrimaryKeyValues),
                                                                                        false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                                                                                                              string.Format("RecordClick!{0}!{1}",
                                                                                                                                                                                            ColumnId,
                                                                                                                                                                                            cell.Row.
                                                                                                                                                                                            PrimaryKeyValues));

                string b = (String.IsNullOrEmpty(ConfirmMessage))
                               ? string.Empty
                               : String.Format("if(wgconfirm('{0}',this,'{1}')) ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'"));

                image =
                    string.Format(
                        "<a class=\"wglinkfield\" href=\"#\" onclick=\"{0}{1}\">{2}</a>", b, a, image);
            }

            LabelHtml(image, writer, cell);
        }
        /// <summary>
        /// ·¢ËÍÉóºË½áÊøÓʼþ
        /// </summary>
        public void ConfirmOverPhone()
        {
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.FinishPhoneMessageOperationByAssessorID(
                new PhoneMessageType(PhoneMessageEnumType.LeaveRequest,
                                     _LeaveRequestItem.LeaveRequestItemID), _NowAccount);
            if (_LeaveRequestItem.Status == RequestStatus.ApproveCancelFail ||
                _LeaveRequestItem.Status == RequestStatus.ApproveCancelPass ||
                _LeaveRequestItem.Status == RequestStatus.ApproveFail ||
                _LeaveRequestItem.Status == RequestStatus.ApprovePass)
            {
                string contant = "";
                if (_LeaveRequestItem.Status == RequestStatus.ApproveCancelFail ||
                    _LeaveRequestItem.Status == RequestStatus.ApproveFail)
                {
                    contant = "ÄãµÄÇë¼Ùµ¥ÒÑÉóºË¾Ü¾ø";
                }
                else if (_LeaveRequestItem.Status == RequestStatus.ApprovePass ||
                         _LeaveRequestItem.Status == RequestStatus.ApproveCancelPass)
                {
                    contant = "ÄãµÄÇë¼Ùµ¥ÒÑÉóºËͨ¹ý";
                }
                _Sms.SendOneMessage(
                    new SendMessageDataModel(-1, _LeaveRequest.Account.MobileNum, contant,
                                             SmsClientProcessCenter._HrmisId));
            }
        }
示例#4
0
        private void OnConfirmMessage(ConfirmMessage msg)
        {
            var page = new TaskDialogPage
            {
                Title       = msg.Title,
                Text        = msg.Content,
                Instruction = msg.Title,
                Icon        = TaskDialogStandardIcon.Information
            };

            var buttonYes   = page.StandardButtons.Add(TaskDialogResult.Continue);
            var buttonClose = page.StandardButtons.Add(TaskDialogResult.Close);

            buttonYes.Click += (s, e) =>
            {
                msg.ConfirmAction();
            };

            buttonClose.Click += (s, e) =>
            {
                msg.CancelAction();
            };

            var dialog = new TaskDialog(page);

            dialog.Show(new WindowInteropHelper(this).Handle);
        }
示例#5
0
        /// <summary>
        /// </summary>
        public static bool CancelOneItem(OutApplicationItem item, Account account, string remark,
                                         IOutApplication dalOutApplication, OutDiyProcessUtility outDiyProcessUtility,
                                         OutApplication outApplication)
        {
            item = dalOutApplication.GetOutApplicationItemByItemID(item.ItemID);
            bool valide = RequestStatus.CanCancelStatus(item.Status);

            if (valide)
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    RequestStatus status = RequestStatus.Cancelled;
                    if (outApplication.OutType.ID == OutType.InCity.ID || outApplication.OutType.ID == OutType.Train.ID)
                    {
                        status = RequestStatus.ApproveCancelPass;
                        ConfirmMessage confirmmessage = new ConfirmMessage();
                        confirmmessage.FinishPhoneMessageOperation(
                            new PhoneMessageType(PhoneMessageEnumType.OutApplication,
                                                 item.ItemID));
                        valide = false;
                    }
                    dalOutApplication.UpdateOutApplicationItemStatusByItemID(item.ItemID,
                                                                             status);
                    OutApplicationFlow OutApplicationFlow =
                        new OutApplicationFlow(0, account, DateTime.Now, remark,
                                               RequestStatus.Cancelled, 1);
                    dalOutApplication.InsertOutApplicationFlow(item.ItemID, OutApplicationFlow);
                    ts.Complete();
                }
            }
            return(valide);
        }
 private async Task AnimateConfirmMessage()
 {
     ConfirmMessage.Layout(new Rectangle(0, -75, Application.Current.MainPage.Width, 75));
     ConfirmMessage.TextColor       = Color.Black;
     ConfirmMessage.BackgroundColor = Color.LightBlue;
     await ConfirmMessage.LayoutTo(new Rectangle(0, 0, Application.Current.MainPage.Width, 75), 1000, Easing.CubicInOut);
 }
示例#7
0
        private void SendSubmitToPhone(OutApplicationItem outApplicationItem)
        {
            Account        phoneToAccount = GetPhoneToAccount();
            string         contant        = BuildBody(_OutApplication, outApplicationItem);
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.SendNewMessage(_OutApplication.Account, phoneToAccount, contant,
                                          new PhoneMessageType(PhoneMessageEnumType.OutApplication, outApplicationItem.ItemID));
        }
        private void SendSubmitToPhone(OverWorkItem item)
        {
            Account        phoneToAccount = GetPhoneToAccount();
            string         contant        = BuildBody(_OverWork, item);
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.SendNewMessage(_OverWork.Account, phoneToAccount, contant,
                                          new PhoneMessageType(PhoneMessageEnumType.OverWork, item.ItemID));
        }
示例#9
0
        public static void ShowMessage(string msg, Window owner, Action <ConfirmMode> callback, Point startPoint = default(Point))
        {
            ConfirmMessage model = new ConfirmMessage()
            {
                Message  = msg,
                CallBack = callback
            };

            ShowMessage(model, owner, startPoint);
        }
示例#10
0
        public async Task <HttpStatusCode> RaiseAdvertConfirmedMessage(ConfirmMessage model, string topicArn)
        {
            using (var client = new AmazonSimpleNotificationServiceClient())
            {
                var messageJson = JsonConvert.SerializeObject(model);
                var result      = await client.PublishAsync(topicArn, messageJson);

                return(result.HttpStatusCode);
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     var log = new ConfirmMessage("I am Charles", () =>
     {
         var result = MessageBox.Show("I agree!", "Confirm", MessageBoxButton.YesNo);
         return result == MessageBoxResult.Yes;
     });
     //Messenger.Default.Send(log);
     Messenger.Default.Send(new NotificationMessage<ConfirmMessage>(this, log, "sss"));
 }
        /// <summary>
        ///
        /// </summary>
        public void SendPhone()
        {
            Account phoneToAccount = new MailAndPhoneUtility().GetMailToAccount(_LeaveRequest, _NextStep);
            string  contant        = string.Format("请审批{0}取消的请假申请,请假类型为{1},从{2}到{3},共{4}小时,理由为{5}",
                                                   _LeaveRequest.Account.Name, _LeaveRequest.LeaveRequestType.Name,
                                                   _LeaveRequestItem.FromDate, _LeaveRequestItem.ToDate, _LeaveRequestItem.CostTime,
                                                   _LeaveRequest.Reason);
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.SendCancelMessage(phoneToAccount, contant,
                                             new PhoneMessageType(PhoneMessageEnumType.LeaveRequest,
                                                                  _LeaveRequestItem.LeaveRequestItemID));
        }
 /// <summary>
 ///
 /// </summary>
 public void SendPhone()
 {
     if (_TraineeApplication.TraineeApplicationStatuss.Id ==
         TraineeApplicationStatus.Submit.Id)
     {
         Account        phoneToAccount = new TAMailAndPhoneUtility().GetMailToAccount(_TraineeApplication);
         string         contant        = BuildBody(_TraineeApplication);
         ConfirmMessage confirmmessage = new ConfirmMessage();
         confirmmessage.SendNewMessage(_TraineeApplication.Applicant, phoneToAccount, contant,
                                       new PhoneMessageType(PhoneMessageEnumType.TraineeApplication,
                                                            _TraineeApplication.PKID));
     }
 }
示例#14
0
        /// <summary>
        /// 给下一步操作人发邮件
        /// </summary>
        public void SendPhoneToNextOperator(int nextOperator, LeaveRequestItem item, int nowAccount)
        {
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.FinishPhoneMessageOperationByAssessorID(
                new PhoneMessageType(PhoneMessageEnumType.LeaveRequest,
                                     item.LeaveRequestItemID), nowAccount);
            Account phoneToAccount = _AccountBll.GetAccountById(nextOperator);

            confirmmessage.SendConfirmMessage(phoneToAccount,
                                              new PhoneMessageType(PhoneMessageEnumType.LeaveRequest,
                                                                   item.LeaveRequestItemID));
        }
示例#15
0
        private void SendSubmitToPhone()
        {
            Account phoneToAccount = GetPhoneToAccount();
            string  contant        = string.Format("请审批{0}取消的外出申请,从{2}到{3},共{4}小时,地点{1},理由:{5}",
                                                   _OutApplication.Account.Name, _OutApplication.OutLocation,
                                                   _OutApplicationItem.FromDate,
                                                   _OutApplicationItem.ToDate, _OutApplicationItem.CostTime
                                                   , _OutApplication.Reason);
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.SendCancelMessage(phoneToAccount, contant,
                                             new PhoneMessageType(PhoneMessageEnumType.OutApplication,
                                                                  _OutApplicationItem.ItemID));
        }
示例#16
0
 /// <summary>
 ///
 /// </summary>
 public void SendPhone()
 {
     foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
     {
         if (item.Status.Id == RequestStatus.Submit.Id)
         {
             Account        phoneToAccount = new MailAndPhoneUtility().GetMailToAccount(_LeaveRequest, _NextStep);
             string         contant        = BuildBody(item);
             ConfirmMessage confirmmessage = new ConfirmMessage();
             confirmmessage.SendNewMessage(_LeaveRequest.Account, phoneToAccount, contant,
                                           new PhoneMessageType(PhoneMessageEnumType.LeaveRequest, item.LeaveRequestItemID));
         }
     }
 }
示例#17
0
        private void SendSubmitToPhone()
        {
            Account phoneToAccount = GetPhoneToAccount();
            string  contant        = string.Format("请审批{0}取消的{6}申请,从{2}到{3},共{4}小时,项目:{1},理由:{5}",
                                                   _OverWork.Account.Name, _OverWork.ProjectName,
                                                   _OverWorkItem.FromDate,
                                                   _OverWorkItem.ToDate, _OverWorkItem.CostTime
                                                   , _OverWork.Reason, OverWorkUtility.GetOverWorkTypeName(_OverWorkItem.OverWorkType));
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.SendCancelMessage(phoneToAccount, contant,
                                             new PhoneMessageType(PhoneMessageEnumType.OverWork,
                                                                  _OverWorkItem.ItemID));
        }
示例#18
0
        /// <summary>
        /// 给下一步操作人发邮件
        /// </summary>
        public void SendPhoneToNextOperator(Account nextOperator, Account nowAccount)
        {
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.FinishPhoneMessageOperationByAssessorID(
                new PhoneMessageType(PhoneMessageEnumType.OverWork,
                                     _OverWorkItem.ItemID), nowAccount.Id);
            if (nextOperator != null)
            {
                Account phoneToAccount = _AccountBll.GetAccountById(nextOperator.Id);
                confirmmessage.SendConfirmMessage(phoneToAccount, new PhoneMessageType(PhoneMessageEnumType.OverWork,
                                                                                       _OverWorkItem.ItemID));
            }
        }
示例#19
0
        public static void ShowMessage(ConfirmMessage model, Window owner, Point startPoint = default(Point))
        {
            Confirm win = new Confirm(model);

            if (owner != null && owner.Visibility == Visibility.Visible)
            {
                win.Owner = owner;
                if (startPoint != default(Point))
                {
                    startPoint = owner.PointToScreen(startPoint);
                    win.WindowStartupLocation = WindowStartupLocation.Manual;
                    win.Top  = startPoint.Y;
                    win.Left = startPoint.X;
                }
            }
            win.ShowDialog();
        }
        /// <summary>
        /// ·¢ËÍÉóºË½áÊøÓʼþ
        /// </summary>
        public void ConfirmOverPhone()
        {
            ConfirmMessage confirmmessage = new ConfirmMessage();

            confirmmessage.FinishPhoneMessageOperationByAssessorID(
                new PhoneMessageType(PhoneMessageEnumType.LeaveRequest,
                                     _TraineeApplication.PKID), _NowAccount);
            if (_TraineeApplication.TraineeApplicationStatuss == TraineeApplicationStatus.ApproveFail ||
                _TraineeApplication.TraineeApplicationStatuss == TraineeApplicationStatus.ApprovePass)
            {
                string contant = "";
                if (_TraineeApplication.TraineeApplicationStatuss == TraineeApplicationStatus.ApproveFail)
                {
                    contant = "ÄãµÄÅàѵÉêÇëÒÑÉóºË¾Ü¾ø";
                }
                else if (_TraineeApplication.TraineeApplicationStatuss == TraineeApplicationStatus.ApprovePass)
                {
                    contant = "ÄãµÄÅàѵÉêÇëÒÑÉóºËͨ¹ý";
                }
                _Sms.SendOneMessage(
                    new SendMessageDataModel(-1, _TraineeApplication.Applicant.MobileNum, contant,
                                             SmsClientProcessCenter._HrmisId));
            }
        }
示例#21
0
        internal override void RenderEditView(HtmlTextWriter writer, RowCell cell)
        {
            if (Table.m_GotData == false) // Data need to be recovered if CacheDatasourceStructure is active.
            {
                Table.GetData(true);
            }

            if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false))
            {
                RenderLabelView(writer, cell);
                return;
            }

            if (string.IsNullOrEmpty(ValueColumn))
            {
                throw new GridException(
                          String.Format(Table.m_Grid.GetSystemMessage("SystemMessage_ForeignkeyNoValueColumn"), Title));
            }

            StringBuilder s = new StringBuilder(string.Empty);

            switch (ForeignkeyType)
            {
            case ForeignkeyType.Select:
            case ForeignkeyType.SelectMenu:
            {
                StringBuilder eventScript = new StringBuilder(string.Empty);
                StringBuilder javascript  = new StringBuilder(string.Empty);
                if (AutoPostback || string.IsNullOrEmpty(ConfirmMessage) == false)
                {
                    eventScript = new StringBuilder(" onchange=\"");
                    if (string.IsNullOrEmpty(ConfirmMessage) == false)
                    {
                        eventScript.AppendFormat(" if(wgconfirm('{0}',this,'{1}')) ",
                                                 ConfirmMessage.Replace("'", "\\'"),
                                                 Grid.DialogTitle.Replace("'", "\\'"));
                    }
                    string link = Grid.EnableCallBack && !ForcePostBack
                                              ? Asynchronous.GetCallbackEventReference(Grid,
                                                                                       string.Format(
                                                                                           "ElementPostBack!{0}!{1}",
                                                                                           ColumnId,
                                                                                           cell.Row.PrimaryKeyValues),
                                                                                       false,
                                                                                       string.Empty,
                                                                                       string.Empty)
                                              : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                                 string.Format(
                                                                                                     "ElementPostBack!{0}!{1}",
                                                                                                     ColumnId,
                                                                                                     cell.Row.
                                                                                                     PrimaryKeyValues));

                    eventScript.AppendFormat("{0}\"", link);
                }

                StringBuilder onblur = new StringBuilder(" onblur=\"");

                if (Grid.ColumnChangedColour != Color.Empty)
                {
                    onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour));
                }
                onblur.Append("\"");
                javascript.Append(onblur);
                s.AppendFormat("<select {0} class=\"wgeditfield wgselectbox {4}\" id=\"{1}\" name=\"{1}\" {2} {3}>",
                               javascript, cell.CellClientId, eventScript, Attributes, CssClass);
                if (m_Foreignkeytype == ForeignkeyType.SelectMenu && (Grid.Scripts == null || !Grid.Scripts.DisableSelectMenu))
                {
                    if (SelectMenuWidth > 0)
                    {
                        Grid.AddClientScript(writer,
                                             string.Format(
                                                 "$(document).ready(function() {{$('#{0}').selectmenu({{maxHeight: {2},style:'dropdown',width: {1}}});}});",
                                                 cell.CellClientId, SelectMenuWidth, SelectMenuMaxHeight));
                    }
                    else
                    {
                        Grid.AddClientScript(writer,
                                             string.Format(
                                                 "$(document).ready(function() {{$('#{0}').selectmenu({{maxHeight: {1},style:'dropdown'}});}});",
                                                 cell.CellClientId, SelectMenuMaxHeight));
                    }
                }

                if (Table.Rows.Count == 0 && NullText == null)
                {
                    NullText = "No data available.";
                }

                if (NullText != null)
                {
                    s.AppendFormat("<option value=\"{1}\">{0}</option>", NullText, string.Empty);
                }

                //CreateRows(Grid,tree,null,0);

                s.Append(CreateSelectRows(TreeParentId != null, null, 0, cell));
                s.Append("</select>");
            }
            break;

            case ForeignkeyType.Radiobuttons:
                m_IsFormElement = false;
                m_Rowcounter    = RecordsPerRow;
                s.AppendFormat("<table class=\"wgradiobuttons {1}\"><tr><td>{0}</td></tr></table>",
                               CreateRadioButtons((TreeParentId != null), null, 0, cell), CssClass);
                break;
            }

            if (string.IsNullOrEmpty(ToolTipInput) == false)
            {
                s = new StringBuilder(Tooltip.Add(s.ToString(), ToolTipInput));
            }

            EditHtml(s.ToString(), writer, cell);
        }
示例#22
0
        internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell)
        {
            string image = FileSource(true, cell);

            if (!string.IsNullOrEmpty(PopupImageColumn))
            {
                if (!cell.Row.Columns.Contains(PopupImageColumn))
                {
                    throw new ApplicationException(
                              string.Format(@"""PopupImageColumn"" property value for column '{0}' is not valid.", Title));
                }
                string rel = "";
                if (m_PopupImageDisplayType == ImageDisplayType.Navigation || m_PopupImageDisplayType == ImageDisplayType.NavigationSlideShow)
                {
                    rel = string.Format("rel=\"{0}_{1}\"", Grid.ClientID, ColumnId);
                }
                image =
                    string.Format(@"<a href=""{1}"" title=""{3}"" {4} class=""wgimage_{5}""><img class=""wgimage"" src=""{0}"" alt=""{2}""/></a>",
                                  image, ((Image)cell.Row.Columns[PopupImageColumn]).GetUrl(cell.Row[PopupImageColumn]), Title, PopupImageCaption, rel, ColumnId);
                switch (PopupImageDisplayType)
                {
                case ImageDisplayType.Navigation:
                    Grid.AddClientScript(writer, string.Format("$(\"a[rel='{0}_{1}']\").colorbox({{slideshow:false}});", Grid.ClientID, ColumnId));
                    break;

                case ImageDisplayType.NavigationSlideShow:
                    Grid.AddClientScript(writer, string.Format("$(\"a[rel='{0}_{1}']\").colorbox({{slideshow:true}});", Grid.ClientID, ColumnId));
                    break;

                case ImageDisplayType.Single:
                    Grid.AddClientScript(writer, string.Format("$(document).ready(function() {{$(\".wgimage_{0}\").colorbox();}});", ColumnId));
                    break;
                }
            }
            else
            {
                image = string.Format(@"<img class=""wgimage"" src=""{0}"" alt=""{1}""/>", image, Title);
            }

            if (HyperLinkColumn && Grid.DisplayView == DisplayView.Grid)
            {
                string a = Grid.EnableCallBack ? Asynchronous.GetCallbackEventReference(Grid,
                                                                                        string.Format("RecordClick!{0}!{1}", ColumnId,
                                                                                                      cell.Row.PrimaryKeyValues),
                                                                                        false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                                                                                                              string.Format("RecordClick!{0}!{1}",
                                                                                                                                                                                            ColumnId,
                                                                                                                                                                                            cell.Row.
                                                                                                                                                                                            PrimaryKeyValues));

                string b = (String.IsNullOrEmpty(ConfirmMessage))
                               ? string.Empty
                               : String.Format("if(wgconfirm('{0}',this,'{1}')) ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'"));

                image =
                    string.Format(
                        "<a class=\"wglinkfield\" href=\"#\" onclick=\"{0}{1}\">{2}</a>", b, a, image);
            }

            LabelHtml(image, writer, cell);
        }
示例#23
0
        // 2005.01.19 - jorn, added this recursive function.
        private void RenderDetailTree(StringBuilder sb, string parentID, int level, RowCell cell)
        {
            if (parentID == null)
            {
                parentID = string.Empty;
            }
            List <string> selectedItems = new List <string>();

            if (cell.Value != null && Grid.Page != null && Grid.Page.IsPostBack)
            {
                selectedItems.InsertRange(0, cell.Value.ToString().Split(','));
            }

            for (int i = 0; i < Items.Count; i++)
            {
                if ((Items[i].ParentId ?? string.Empty) != parentID)
                {
                    continue;
                }
                if (Grid.Page != null && Grid.Page.IsPostBack && selectedItems.Count > 0)
                {
                    Items[i].Checked = selectedItems.Contains(Items[i].Value);
                }

                StringBuilder indentText = new StringBuilder(string.Empty);
                if (level > 0)
                {
                    for (int j = 0; j < level; j++)
                    {
                        indentText.Append(TreeIndentText);
                    }
                }

                StringBuilder selected = new StringBuilder(string.Empty);

                if (Items[i].Checked)
                {
                    selected.Append(ManyToManyType == ManyToManyType.Multiselect
                                        ? " selected=\"selected\" "
                                        : " checked=\"checked\" ");
                }
                if (AllowEdit == false)
                {
                    selected.Append(" disabled=\"disabled\" ");
                }

                if (ManyToManyType == ManyToManyType.Multiselect)
                {
                    sb.AppendFormat("<option {0} value=\"{1}\">{2}{3}</option>", selected, Items[i].Value, indentText,
                                    Items[i].DisplayText);
                }
                else
                {
                    if (i != 0)
                    {
                        if (m_Rowcounter == 0)
                        {
                            sb.Append("</tr><tr><td>");
                            m_Rowcounter = RecordsPerRow;
                        }
                        else
                        {
                            sb.Append("<td>");
                        }
                    }
                    m_Rowcounter--;
                    sb.Append(indentText);

                    StringBuilder javascript = new StringBuilder(string.Empty);
                    StringBuilder onblur     = new StringBuilder(" onblur=\"");
                    if (Grid.InputHighLight != Color.Empty)
                    {
                        javascript.AppendFormat(
                            " onfocus=\"this.accessKey = this.style.backgroundColor;this.style.backgroundColor='{0}';\"",
                            Grid.ColorToHtml(Grid.InputHighLight));
                        onblur.Append("this.style.backgroundColor=this.accessKey;");
                    }
                    if (Grid.ColumnChangedColour != Color.Empty)
                    {
                        onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour));
                    }
                    onblur.Append("\"");
                    javascript.Append(onblur);

                    if ((AutoPostback || !string.IsNullOrEmpty(ConfirmMessage)) && Grid.Page != null)
                    {
                        StringBuilder eventScript = new StringBuilder(" onclick=\"");
                        if (!string.IsNullOrEmpty(ConfirmMessage))
                        {
                            eventScript.AppendFormat(" if(wgconfirm('{0}',this),'{1}') ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'"));
                        }
                        string link = Grid.EnableCallBack && !ForcePostBack
                                          ? Asynchronous.GetCallbackEventReference(Grid,
                                                                                   string.Format(
                                                                                       "ElementPostBack!{0}!{1}",
                                                                                       ColumnId,
                                                                                       cell.Row.PrimaryKeyValues),
                                                                                   false,
                                                                                   string.Empty, string.Empty)
                                          : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                             string.Format(
                                                                                                 "ElementPostBack!{0}!{1}",
                                                                                                 ColumnId,
                                                                                                 cell.Row.
                                                                                                 PrimaryKeyValues));

                        eventScript.AppendFormat("{0}\"{1}", link, eventScript);
                        javascript.Append(eventScript);
                    }

                    if (!string.IsNullOrEmpty(CheckedAlias) && Items[i].Checked)
                    {
                        sb.Append(CheckedAlias);
                        sb.Append(Items[i].DisplayText);
                    }
                    else if (!string.IsNullOrEmpty(UncheckedAlias) && !Items[i].Checked)
                    {
                        sb.Append(UncheckedAlias);
                        sb.Append(Items[i].DisplayText);
                    }
                    else
                    {
                        sb.AppendFormat(
                            "<input {0} type=\"checkbox\" id=\"cb_{1}_{2}\" name=\"{1}\" value=\"{2}\" {3} />",
                            javascript, cell.CellClientId,
                            Items[i].Value, selected);
                        sb.AppendFormat(
                            "<label class=\"wglabel\"  id=\"label_{0}_{1}\" for=\"cb_{0}_{1}\">", cell.CellClientId, Items[i].Value);

                        sb.AppendFormat("{0}</label>", Items[i].DisplayText);
                    }
                    sb.Append("</td>");
                }

                RenderDetailTree(sb, Items[i].Value, level + 1, cell);
            }
        }
示例#24
0
        // 2005.01.09 - jorn -  String.Compare, string.Length
        // 2005.01.05 - Jorn -  Added check to see if there actually is a checkbox on "previous page".
        //                        Need to add a hidden field since checkbox "returns null" both for unchecked and non-existing
        internal void RenderDetail(bool enabled, WebGridHtmlWriter writer, RowCell cell)
        {
            if (AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false))
            {
                enabled = false;
            }

            string       uniqueId       = cell.CellClientId;
            string       strValue       = DisplayText(cell);
            const string checkedValue   = TrueValue;
            const string uncheckedValue = FalseValue;

            StringBuilder sb;

            if (String.Compare(strValue, checkedValue, true) == 0 && CheckedAlias != null && enabled == false)
            {
                sb = new StringBuilder(CheckedAlias);
            }
            else if (String.Compare(strValue, uncheckedValue, true) == 0 && UncheckedAlias != null &&
                     enabled == false)
            {
                sb = new StringBuilder(UncheckedAlias);
            }
            else
            {
                string bitchecked = string.Empty;
                string bitEnabled = string.Empty;
                if (String.Compare(strValue, checkedValue, true) == 0)
                {
                    bitchecked = " checked=\"checked\"";
                }
                if (enabled == false)
                {
                    bitEnabled = " disabled=\"disabled\"";
                }

                StringBuilder javascript = new StringBuilder(string.Empty);
                StringBuilder onblur     = new StringBuilder(" onblur=\"");
                if (Grid.InputHighLight != Color.Empty)
                {
                    javascript.AppendFormat(
                        " onfocus=\"this.accessKey = this.style.backgroundColor;this.style.backgroundColor='{0}';\"",
                        Grid.ColorToHtml(Grid.InputHighLight));
                    onblur.Append("this.style.backgroundColor=this.accessKey;");
                }
                if (Grid.ColumnChangedColour != Color.Empty)
                {
                    onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour));
                }
                onblur.Append("\"");

                if (AutoPostback || string.IsNullOrEmpty(ConfirmMessage) == false)
                {
                    StringBuilder eventScript = new StringBuilder(" onclick=\"");
                    if (string.IsNullOrEmpty(ConfirmMessage) == false)
                    {
                        eventScript.AppendFormat(" if(wgconfirm('{0}',this,'{1}')) ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'"));
                    }
                    string link = Grid.EnableCallBack && !ForcePostBack?Asynchronous.GetCallbackEventReference(Grid,
                                                                                                               string.Format("ElementPostBack!{0}!{1}",
                                                                                                                             ColumnId, cell.Row.PrimaryKeyValues), false,
                                                                                                               string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                                                                                                                              string.Format(
                                                                                                                                                                                                  "ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues));

                    eventScript.AppendFormat("{0}\"", link);

                    javascript.Append(eventScript);
                }
                javascript.Append(onblur);
                sb =
                    new StringBuilder(
                        string.Format(
                            "<input {0} type=\"checkbox\" {1} {2} {4}  id=\"cb_{3}\" name=\"{3}\" value=\"1\"/>",
                            javascript, bitchecked, bitEnabled, uniqueId, Attributes));
                if (string.IsNullOrEmpty(m_Displaylabel) == false)
                {
                    sb.AppendFormat(
                        "<label class=\"wglabel\" id=\"label_{0}\" for=\"cb_{0}\">{1}</label>", uniqueId, m_Displaylabel);
                }

                if (enabled)
                {
                    writer.Write("<input type=\"hidden\" id=\"{0}_cb\" name=\"{0}_cb\" value=\"{1}\" />",
                                 uniqueId, checkedValue);
                }
            }

            if (string.IsNullOrEmpty(ToolTipInput) == false)
            {
                sb = new StringBuilder(Tooltip.Add(sb.ToString(), ToolTipInput));
            }

            EditHtml(sb.ToString(), writer, cell);
        }