Ejemplo n.º 1
0
        private void cboSystem_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            cboSystem.Items.Clear();

            Facade.ImportMessage facImportMessages = new Facade.ImportMessage();
            DataSet ds = facImportMessages.GetAllSystems();

            int itemsPerRequest = 20;
            int itemOffset      = e.NumberOfItems;
            int endOffset       = itemOffset + itemsPerRequest;

            if (endOffset > ds.Tables[0].Rows.Count)
            {
                endOffset = ds.Tables[0].Rows.Count;
            }

            DataTable dt = ds.Tables[0];

            Telerik.Web.UI.RadComboBoxItem rcItem = null;
            for (int i = itemOffset; i < endOffset; i++)
            {
                rcItem      = new Telerik.Web.UI.RadComboBoxItem();
                rcItem.Text = dt.Rows[i]["System"].ToString();

                cboSystem.Items.Add(rcItem);
            }

            if (dt.Rows.Count > 0)
            {
                e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString());
            }

            //if (dt.Rows.Count > 0)
            //    e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffSet.ToString(), dt.Rows.Count.ToString());
        }
Ejemplo n.º 2
0
        public void SendImportMessages(string[] Messages)
        {
            Facade.ImportMessage facImportMessage = new Facade.ImportMessage();

            foreach (string message in Messages)
            {
                facImportMessage.Create(
                    INTEGRATION_SOURCE_NAME,
                    eMessageState.Unprocessed,
                    message,
                    USERNAME);
            }
        }
Ejemplo n.º 3
0
        private void grdMessageList_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            Facade.ImportMessage facImportMessage = new Facade.ImportMessage();
            string system      = cboSystem.Text;
            string messageType = cboMessageType.SelectedValue;

            if (system != null && rdiStartDate.SelectedDate != null)
            {
                DataSet dsImportMessage = facImportMessage.GetAllFailedMessagesForDateRange((DateTime)rdiStartDate.SelectedDate, (DateTime)rdiEndDate.SelectedDate, system, messageType);
                this.grdMessageList.DataSource = dsImportMessage;
            }
            else
            {
                DataSet dsImportMessage = facImportMessage.GetAllFailedMessagesForDateRange(DateTime.Now.Date.AddDays(-8), DateTime.Now.Date, system, messageType);
                this.grdMessageList.DataSource = dsImportMessage;
            }
        }
Ejemplo n.º 4
0
        private void GetImportMessages()
        {
            if (dteDateFrom.SelectedDate.HasValue && dteDateTo.SelectedDate.HasValue)
            {
                var dateFrom = dteDateFrom.SelectedDate.Value;
                var dateTo   = dteDateTo.SelectedDate.Value;

                TimeSpan toTime = new TimeSpan(23, 59, 0);
                dateTo = dateTo + toTime;

                Facade.ImportMessage facImportMes = new Facade.ImportMessage();
                var ds = facImportMes.GetAllForView(dateFrom, dateTo, RadFromSystem.Text);
                m_numberOfImportMessages     = ds.Tables[0].Rows.Count;
                grdImportMessages.DataSource = ds;
            }
            else
            {
                grdImportMessages.DataSource = string.Empty;
            }
        }
Ejemplo n.º 5
0
        private void grdMessageList_ItemCommand(object sender, GridCommandEventArgs e)
        {
            Facade.ImportMessage facImportMessage = new Facade.ImportMessage();
            bool success = false;

            if (e.CommandName == "Select")
            {
                if (e.Item is GridDataItem)
                {
                    GridDataItem dataItem = e.Item as GridDataItem;
                    dataItem.Selected = true;
                    GridDataItem dataItemRow = this.grdMessageList.SelectedItems[0] as GridDataItem;

                    string messageState = GetDataItemValue(dataItemRow, "State");

                    //if(messageState.ToUpper() == "UNPROCESSED")
                    //    Button btn = (LinkButton)dataItemRow["Select"].Controls[0];

                    string textID      = GetDataItemValue(dataItemRow, "MessageID");
                    string messageType = GetDataItemValue(dataItemRow, "Type");
                    string userID      = ((Entities.CustomPrincipal)Page.User).UserName;
                    int    messageID;

                    if (int.TryParse(textID, out messageID))
                    {
                        success = facImportMessage.RetryMessage(messageID, messageType, userID);

                        if (success)
                        {
                            ClientScript.RegisterStartupScript(GetType(), "Error", "alert('Message successfully reset');", true);
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(GetType(), "Error", "alert('Unable to reset message, please try again');", true);
                        }
                    }
                }
            }

            grdMessageList.Rebind();
        }
Ejemplo n.º 6
0
        public void RemoveIntegrationGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            string       postcode;
            GridDataItem dataItem = null;

            if (this.pointsToIntegrateGrid.SelectedItems.Count > 0)
            {
                dataItem = this.pointsToIntegrateGrid.SelectedItems[0] as GridDataItem;
            }

            if (dataItem != null && GetDataItemValue(dataItem, "PostCode") != "")
            {
                ClientScript.RegisterStartupScript(GetType(), "Error", "document.getElementById('RemoveIntegrationID').style.visibility = 'visible';", true);
                postcode = GetDataItemValue(dataItem, "PostCode");
                Facade.ImportMessage facImportMessage = new Facade.ImportMessage();
                RemoveIntegrationGrid.DataSource = facImportMessage.GetForIntegrationMapping(postcode);
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "Error", "document.getElementById('RemoveIntegrationID').style.visibility = 'hidden';", true);
                postcode = null;
            }
        }
Ejemplo n.º 7
0
        private void btnHiddenUpdateMessage_Click(object sender, EventArgs e)
        {
            var newImportMessageContent = this.hidImportMessageText.Value;
            int oldImportMessageID      = 0;

            int.TryParse(this.hidImportMessageID.Value, out oldImportMessageID);

            Facade.ImportMessage facImportMes = new Facade.ImportMessage();

            var oldImportMessage = facImportMes.GetForImportMessageId(oldImportMessageID);

            var newImportMessage = new Entities.ImportMessage
                                   (
                oldImportMessage.FileName,
                oldImportMessage.FromSystem,
                eMessageState.Unprocessed,
                newImportMessageContent,
                oldImportMessage.EntityTypeId,
                oldImportMessage.EntityId
                                   );
            string userName = ((Entities.CustomPrincipal)Page.User).UserName;

            facImportMes.Create(newImportMessage, userName);
        }