Пример #1
1
        public NewItemDialog()
        {
            InitializeComponent();

            Filename = "";

            TranslateUI();

            foreach (var item in Workspace.PluginManager.Plugins)
            {
                foreach (var t in item.ItemTemplates)
                {
                    var i = new ListViewDataItem(t.Name);
                    i.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
                    i.Image = t.Icon;
                    i.Tag = t;
                    i.ImageAlignment = System.Drawing.ContentAlignment.MiddleLeft;
                    i.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;

                    Plugin = item;

                    radListView1.Items.Add(i);
                }
            }

            radListView1.SelectedIndex = 0;
        }
Пример #2
0
        ListViewDataItem Checker(string path, StreamReader sr)
        {
            var item = new ListViewDataItem();
            StreamReader srAnswer = new StreamReader(path);

            string[] answer = srAnswer.ReadToEnd().Split(new char[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            string[] trueAnswer = sr.ReadToEnd().Split(new char[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            if (trueAnswer.Length < answer.Length) {
                item.BackColor = Color.Red;
                item.ForeColor = Color.Black;
                item.GradientStyle = GradientStyles.Solid;
                item.Text = "Error:a different number of characters";
                return item;
            }
            for (int i = 0; i < trueAnswer.Length; i++) {
                if (trueAnswer[i] != answer[i]) {
                    item.BackColor = Color.FromArgb(255, 58, 31);
                    item.GradientStyle = GradientStyles.Solid;
                    item.Text = "Error:different value";
                    item.ForeColor = Color.Black;
                    return item;
                }
            }
            sr.Close();
            srAnswer.Close();
            item.BackColor = Color.GreenYellow;
            item.ForeColor = Color.Black;
            item.GradientStyle = GradientStyles.Solid;
            item.Text = "true";

            return item;
        }
        private static bool IsChecked(ListViewDataItem item, string checkBoxId)
        {
            var control = item.FindControl(checkBoxId) as CheckBox;

            if (control == null)
            {
                return(false);
            }
            return(control.Checked);
        }
Пример #4
0
    protected void lvFileList_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            ListViewDataItem dataItem = (ListViewDataItem)e.Item;
            Image            imgList  = (Image)e.Item.FindControl("imgList");

            imgList.ImageUrl = imgPath + "/" + ((FileInfo)dataItem.DataItem).Name;
        }
    }
Пример #5
0
 //get ID Quoc Gia
 protected void ListView3_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (String.Equals(e.CommandName, "Select"))
     {
         ListViewDataItem dataItem = (ListViewDataItem)e.Item;
         string           ID_QG    = ListView3.DataKeys[dataItem.DisplayIndex].Value.ToString();
         Session["ID_QG"] = ID_QG;
         Response.Redirect("/Program.aspx");
     }
 }
Пример #6
0
        private void CheckAllItem()
        {
            int item = 0;

            foreach (DataRow row in techReminders.Rows)
            {
                ListViewDataItem checkedItem = new ListViewDataItem("Checked item");
                this.radListView_Reminders.Items[item++].CheckState = Telerik.WinControls.Enumerations.ToggleState.On;
            }
        }
Пример #7
0
 protected void ListView_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (String.Equals(e.CommandName, "Select1"))
     {
         ListViewDataItem dataItem  = (ListViewDataItem)e.Item;
         string           ID_Truong = ListView.DataKeys[dataItem.DisplayIndex].Value.ToString();
         Session["ID_Truong"] = ID_Truong;
         Response.Redirect("/ChiTietTruong.aspx");
     }
 }
 protected void lvStage_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
     if (lvStage.EditIndex >= 0)
     {
         ListViewDataItem dataItem = (ListViewDataItem)e.Item;
         if (dataItem.DisplayIndex == lvStage.EditIndex)
         {
         }
     }
 }
Пример #9
0
        protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;
                Mailbox          obj      = (Mailbox)dataItem.DataItem;

                //obj.TimeInDetails;
            }
        }
 public override IVirtualizedElement <ListViewDataItem> CreateElement(
     ListViewDataItem data,
     object context)
 {
     if (data is ListViewDataItemGroup)
     {
         return((IVirtualizedElement <ListViewDataItem>) this.OnElementCreating((BaseListViewVisualItem) new IconListViewGroupVisualItem(), ListViewType.IconsView, data));
     }
     return((IVirtualizedElement <ListViewDataItem>) this.OnElementCreating((BaseListViewVisualItem) new CardListViewVisualItem(), ListViewType.IconsView, data));
 }
Пример #11
0
        protected void lvProdDetail_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            ListViewDataItem dataItem = (ListViewDataItem)e.Item;
            XhProduct        p        = (XhProduct)dataItem.DataItem;

            string img_medium = "m.jpg";
            string img_large  = "l.jpg";

            Literal ltProdMan = (Literal)e.Item.FindControl("ltProdMan");

            ltProdMan.Text += p.XhManufacter.man_name;

            Literal ltProdName = (Literal)e.Item.FindControl("ltProdName");

            ltProdName.Text += p.prod_name;

            HyperLink hlEnlargeImage = (HyperLink)e.Item.FindControl("hlEnlargeImage");

            hlEnlargeImage.NavigateUrl = "~/ViewImage.aspx?img=" + p.img_id.ToString() + img_large;
            hlEnlargeImage.Attributes.Add("rel", "lightbox");
            hlEnlargeImage.Attributes.Add("title", p.XhManufacter.man_name + " " + p.prod_name);

            Image imgProductMedium = (Image)e.Item.FindControl("imgProductMedium");

            imgProductMedium.ImageUrl = "~/ViewImage.aspx?img=" + p.img_id.ToString() + img_medium;

            Literal ltModel = (Literal)e.Item.FindControl("ltModel");

            ltModel.Text += p.prod_model;

            Literal ltPrice = (Literal)e.Item.FindControl("ltPrice");

            ltPrice.Text += p.prod_price.ToString();

            HyperLink hlCategory = (HyperLink)e.Item.FindControl("hlCategory");

            hlCategory.NavigateUrl = "~/Search.aspx?ucid=" + p.cat_id.ToString();

            Literal ltStock = (Literal)e.Item.FindControl("ltStock");

            ltStock.Text += p.prod_stock.ToString();

            Literal ltProdDesc = (Literal)e.Item.FindControl("ltProdDesc");

            ltProdDesc.Text += p.prod_desc;

            HyperLink hlAddToCart1 = (HyperLink)e.Item.FindControl("hlAddToCart1");

            hlAddToCart1.NavigateUrl = "~/AddToCart.aspx?id=" + p.prod_id;
            hlAddToCart1.Attributes.Add("title", "Add this product to your cart");

            HyperLink hlAddToCart2 = (HyperLink)e.Item.FindControl("hlAddToCart2");

            hlAddToCart2.NavigateUrl = "~/AddToCart.aspx?id=" + p.prod_id;
        }
Пример #12
0
    protected void lstVisits_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        var              schoolid    = new SchoolInformation().getId();
        var              semesterId  = MyDate.getCurrentSemesterId();
        ListView         lstSubjects = (ListView)(e.Item.FindControl("lstSubjects"));
        ListView         lstClass    = (ListView)(e.Item.FindControl("lstClass"));
        ListView         lstTeacher  = (ListView)(e.Item.FindControl("lstTeacher"));
        ListViewDataItem dataItem    = (ListViewDataItem)e.Item;

        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            DateTime date = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "Date").ToString());

            var lst = new List <int> {
                1, 2, 3, 4, 5, 6
            };
            var lst2 = (from i in lst
                        let visit = (from k in km.LibraryClassVisits
                                     join s in km.SubjectsInSemesters on k.SubjectId equals s.Id
                                     join t in km.Teachers on k.TeacherId equals t.IdentityNumber
                                     where k.Period == i && k.Date == date &&
                                     k.SchoolId == schoolid &&
                                     k.SemesterId == semesterId
                                     select new
            {
                k.Date,
                k.Id,
                k.IsDone,
                k.Period,
                subjectName = (from sub in km.Subjects where sub.Id == s.SubjectId select sub.Name).FirstOrDefault(),
                classId = s.ClassId,
                teacherName = t.Name
            }).FirstOrDefault()
                                    select new
            {
                isNull = (visit == null),
                date,

                Id = (visit == null) ? 0 : visit.Id,
                IsDone = (visit == null) ? false : visit.IsDone,
                Period = i,
                subjectName = (visit == null) ? "" : visit.subjectName,
                classId = (visit == null) ? "" : visit.classId,
                teacherName = (visit == null) ? "" : visit.teacherName
            }).ToList();
            lstSubjects.DataSource = lst2;
            lstSubjects.DataBind();

            lstClass.DataSource = lst2;
            lstClass.DataBind();

            lstTeacher.DataSource = lst2;
            lstTeacher.DataBind();
        }
    }
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"]));

            if (string.IsNullOrEmpty(auraId))
            {
                base.Response.Redirect("/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri));
            }
            WebShoppingCartEx webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault <WebShoppingCartEx>();

            if (webShoppingCartEx == null || webShoppingCartEx.Lines == null)
            {
                base.Response.Redirect("/productcatalog/viewcart");
                return;
            }
            int rowId = Convert.ToInt32(base.Request.QueryString["OL"]);
            WebShoppingCartDetails webShoppingCartDetails = webShoppingCartEx.Lines.First((WebShoppingCartDetails x) => x.Id == rowId);
            MeetingEx meetingByProductId = Helpers.GetMeetingByProductId(webShoppingCartEx.Lines.First((WebShoppingCartDetails x) => x.Id == Convert.ToInt32(rowId)).ProductId.ToString());

            if (this.ListViewSessions.Items.Count > 0)
            {
                if (!this.CheckSessionGroup(meetingByProductId.Id))
                {
                    return;
                }
                if (!this.AtLeastOneSessionChecked())
                {
                    return;
                }
            }
            base.Session["CartLine"] = webShoppingCartDetails;
            webShoppingCartDetails.SessionRanks.Clear();
            for (int i = 0; i < this.ListViewSessions.Items.Count; i++)
            {
                ListViewDataItem listViewDataItem = this.ListViewSessions.Items[i];
                CheckBox         checkBox         = (CheckBox)listViewDataItem.FindControl("SessionSelect");
                int sessionProductID = Convert.ToInt32(checkBox.InputAttributes["productId"]);
                if (checkBox.Checked)
                {
                    webShoppingCartDetails.SessionRanks.Add(new WebShoppingCartDetailsSessionRank
                    {
                        SessionProductID = sessionProductID,
                        Sequence         = i
                    });
                }
            }
            webShoppingCartDetails.BadgeName   = this.txtName1.Text.Trim();
            webShoppingCartDetails.JobTitle    = this.txtTitle.Text.Trim();
            webShoppingCartDetails.CompanyName = this.txtCompany.Text.Trim();
            Helpers.SaveCartLine(webShoppingCartDetails, auraId);
            if (this.SavePersonalInfo())
            {
                base.Response.Redirect("/productcatalog/viewcart");
            }
        }
 private void btnDown_Click(object sender, EventArgs e)
 {
     if ((lvSoftware.SelectedIndex > -1) && (lvSoftware.SelectedIndex < lvSoftware.Items.Count - 1))
     {
         int index = lvSoftware.SelectedIndex;
         ListViewDataItem current = lvSoftware.SelectedItem as ListViewDataItem;
         lvSoftware.Items.Remove(current);
         lvSoftware.Items.Insert(index + 1, current);
         lvSoftware.SelectedIndex = index + 1;
     }
 }
 private void btnUp_Click(object sender, EventArgs e)
 {
     if (lvSoftware.SelectedIndex > 0)
     {
         int index = lvSoftware.SelectedIndex;
         ListViewDataItem current = lvSoftware.SelectedItem as ListViewDataItem;
         lvSoftware.Items.Remove(current);
         lvSoftware.Items.Insert(index - 1, current);
         lvSoftware.SelectedIndex = index - 1;
     }
 }
        private int GetQuantity(ListViewDataItem dataItem)
        {
            int     quantity    = 1;
            TextBox txtQuantity = (TextBox)dataItem.FindControl("txtQuantity");

            if (txtQuantity != null)
            {
                quantity = int.Parse(txtQuantity.Text.Trim());
            }
            return(quantity);
        }
Пример #17
0
 void _listView_ItemMouseMove(object sender, ListViewItemMouseEventArgs e)
 {
     if (e.OriginalEventArgs.Button == MouseButtons.Left)
     {
         if (_dragItem != null)
         {
             _listView.DoDragDrop(new DataObject(LayoutHost.cstDragDropDataFormat, _dragItem.Tag as Type), DragDropEffects.Copy);
         }
     }
     _dragItem = null;
 }
Пример #18
0
        /// <summary>
        /// Handles the OnItemCommand event of the lvPinnedItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ListViewCommandEventArgs"/> instance containing the event data.</param>
        protected void lvPinnedItem_OnItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (!PageBase.StopProcessing)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;
                SelectedItemId = (int)lvPinnedItems.DataKeys[dataItem.DisplayIndex]["ItemId"];
                int itemBookingId = (int)lvPinnedItems.DataKeys[dataItem.DisplayIndex]["ItemBookingId"];

                switch (e.CommandName)
                {
                case "Remove":

                    if (InformItemBriefDetailToGetCompleteItemDirtyStatus != null)
                    {
                        InformItemBriefDetailToGetCompleteItemDirtyStatus();
                    }

                    if (IsCompleteItemTabDirty)
                    {
                        popupConfirmDirtySave.ShowPopup();
                    }
                    else
                    {
                        ShowRemoveConfirmationMessage();
                    }
                    break;

                case "Keep":
                    InventoryBL inventoryBL   = new InventoryBL(DataContext);
                    Code        bookingStatus = inventoryBL.GetItemBookingStatus(itemBookingId);

                    if (bookingStatus != null && bookingStatus.CodeId == Utils.GetCodeIdByCodeValue("ItemBookingStatusCode", "PINNEDDELAYED"))
                    {
                        if (InformParentToShowDelayedPopup != null)
                        {
                            InformParentToShowDelayedPopup(SelectedItemId);
                        }
                    }
                    else if (inventoryBL.CanKeepItem(ItemBriefId, SelectedItemId))
                    {
                        popupBoxKeepItem.ShowPopup();
                    }
                    else if (!GetBL <InventoryBL>().IsItemDeleted(SelectedItemId))
                    {
                        //Needs to be provided by Mat
                        popUpPinError.ShowPopup();
                    }

                    break;
                }

                LoadData();
            }
        }
Пример #19
0
        /// <summary>
        /// This event fires when the user add a job site to a crew or click on the Finish button
        ///     When adding a job site to a crew, it first verifies that a crew is selected
        ///         Then add the Job site
        ///     When user click on the Finish button, it turns off the site menu and the Routes
        ///     It turns on the Job Cards GridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RouteListView_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            string message = "";
            string command = e.CommandName;

            switch (command)
            {
            case "AddSite":
                //Get hold of the row that fired the event
                ListViewDataItem item = RouteListView.Items[e.Item.DisplayIndex];
                DropDownList     list = item.FindControl("SelectTask") as DropDownList;

                InfoUserControl.TryRun(() =>
                {
                    if (string.IsNullOrEmpty(CrewID.Text))
                    {
                        InfoUserControl.ShowWarning("You must first create or select a Crew before adding a job site!");
                    }
                    else
                    {
                        int crewId = int.Parse(CrewID.Text);
                        int siteId = int.Parse(e.CommandArgument.ToString());
                        int taskId = int.Parse(list.SelectedValue);

                        CrewController crewManager = new CrewController();
                        message = crewManager.AddJobCard(crewId, siteId, taskId);
                        RefreshCurrentCrews();
                    }
                });

                if (!string.IsNullOrEmpty(message))
                {
                    InfoUserControl.ShowInfo("The following Crew(s) are already assigned to this same Site:  " + message);
                    RefreshCurrentCrews();
                }
                break;

            case "Finish":
                SiteMenu.Visible      = false;
                RouteListView.Visible = false;
                PopulateRouteStatus();
                PopulateUnitReport();
                MakeCrew.Visible      = true;
                LastCrews.Visible     = true;
                FleetCategory.Visible = false;

                ARoute.CssClass = "default-tab";
                BRoute.CssClass = "default-tab";
                GRoute.CssClass = "default-tab";
                WRoute.CssClass = "default-tab";
                PRoute.CssClass = "default-tab";
                break;
            }
        }
        /// <summary>
        /// The row data bound.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void RowDataBound(object sender, ListViewItemEventArgs e)
        {
            ListViewDataItem dataItem = (ListViewDataItem)e.Item;

            if (e.Item.ItemType != ListViewItemType.DataItem)
            {
                return;
            }

            Label              labelName       = (Label)e.Item.FindControl("labelName");
            Label              labelRoot       = (Label)e.Item.FindControl("labelRoot");
            Label              labelEntryPoint = (Label)e.Item.FindControl("labelEntryPoint");
            Button             buttonDelete    = (Button)e.Item.FindControl("buttonDelete");
            HtmlGenericControl cmsButtonDelete = (HtmlGenericControl)e.Item.FindControl("cmsButtonDelete");

            ClonedContentProviderSettings pageProviderSettings = dataItem.DataItem as ClonedContentProviderSettings;

            if (pageProviderSettings == null)
            {
                return;
            }

            labelName.Text = pageProviderSettings.Name;

            if (pageProviderSettings.EntryPoint > 0)
            {
                PageData page = this.ContentRepository.Get <PageData>(new PageReference(pageProviderSettings.EntryPoint));

                if (page != null)
                {
                    labelEntryPoint.Text = string.Format(
                        CultureInfo.InvariantCulture,
                        "<strong>{0}</strong>: {1}<br/>",
                        "entryPoint",
                        string.Format(CultureInfo.InvariantCulture, "{0} ({1})", page.PageName, page.PageLink.ID));
                }
            }

            if (pageProviderSettings.Root > 0)
            {
                PageData page = this.ContentRepository.Get <PageData>(new PageReference(pageProviderSettings.Root));

                labelRoot.Text = string.Format(
                    CultureInfo.InvariantCulture,
                    "<strong>{0}</strong>: {1}<br/>",
                    "root",
                    string.Format(CultureInfo.InvariantCulture, "{0} ({1})", page.PageName, page.PageLink.ID));
            }
            else
            {
                buttonDelete.Visible    = false;
                cmsButtonDelete.Visible = false;
            }
        }
        protected void lvDetails_ItemEditing(object sender, ListViewEditEventArgs e)
        {
            ListView listDetails = (ListView)sender;

            listDetails.EditIndex = e.NewEditIndex;
            ListViewDataItem listItem   = (ListViewDataItem)listDetails.Parent;
            HiddenField      hfItemCode = (HiddenField)listItem.FindControl("hfItemCode");

            listDetails.DataSource = GetDisbursementDetailsPerItem(hfItemCode.Value);
            listDetails.DataBind();
        }
        protected void Display_InnerList(object sender, CommandEventArgs e)
        {
            LinkButton       linkViewRequest = (LinkButton)sender;
            ListViewDataItem listItem        = (ListViewDataItem)linkViewRequest.Parent;
            ListView         listDetails     = (ListView)listItem.FindControl("lvRequestDetails");
            Label            lblRequestCode  = (Label)listItem.FindControl("lblRequestCode");

            listDetails.Visible    = true;
            listDetails.DataSource = sClerCtrl.GetRequestDetails(lblRequestCode.Text);
            listDetails.DataBind();
        }
        protected void Display_InnerList(object sender, CommandEventArgs e)
        {
            LinkButton       linkViewRequest = (LinkButton)sender;
            ListViewDataItem listItem        = (ListViewDataItem)linkViewRequest.Parent;
            ListView         listDetails     = (ListView)listItem.FindControl("lvDetails");
            HiddenField      hfItemCode      = (HiddenField)listItem.FindControl("hfItemCode");

            listDetails.Visible    = true;
            listDetails.DataSource = GetDisbursementDetailsPerItem(hfItemCode.Value);
            listDetails.DataBind();
        }
 protected string ResultListViewHrefOnclick(ListViewDataItem dataItem)
 {
     if (WebAnalyticsOptions.IsEnabled)
     {
         return("onclick=\"NCIAnalytics.TermsDictionaryResults(this,'" + (dataItem.DataItemIndex + 1).ToString() + "');\""); // Load results onclick script
     }
     else
     {
         return("");
     }
 }
        protected void Auction_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            ListViewDataItem dataitem = (ListViewDataItem)e.Item;
            decimal          pln      = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "Price"));

            Repositories.ICurrencyRepository repo = new Repositories.ICurrencyRepository();
            decimal eur     = Math.Ceiling(repo.CurrencyExchange(pln, "PLN", "EUR") * 100) / 100;
            var     EurName = e.Item.FindControl("EurName") as Label;

            EurName.Text = eur.ToString();
        }
Пример #26
0
        protected void linkAgregar_Click(object sender, EventArgs e)
        {
            lblMensaje.Visible = true;
            lblMensaje.Text    = "";
            ListViewDataItem fila = (ListViewDataItem)(sender as Control).Parent;
            int idMaterial        = Convert.ToInt32(listaMateriales.DataKeys[fila.DataItemIndex].Values[0]);

            Carrito.Instancia.AgregarItem(idMaterial);
            lblMensaje.Visible = true;
            lblMensaje.Text    = "¡Material Agregado!";
        }
Пример #27
0
    protected void Button_Command(object sender, CommandEventArgs e)
    {
        Button           btn  = (Button)sender;
        ListViewDataItem item = btn.NamingContainer as ListViewDataItem;
        TextBox          tb   = item.FindControl("txtNum") as TextBox;
        int num = int.Parse(tb.Text);

        if (num < 0)
        {
            num = 1;
        }
        if (e.CommandArgument == null)
        {
            Page.RegisterStartupScript("kk", "<script>alert('参数不正确!')</script>");
            return;
        }
        if (Session["username1"] == null)
        {
            Page.RegisterStartupScript("kk", "<script>alert('请先登录!');window.location.href='Login.aspx?url=" + Request.RawUrl + "';</script>");
            return;
        }
        string username = Session["username1"].ToString();
        string pIDstr   = e.CommandArgument.ToString();
        int    pID;

        int.TryParse(pIDstr, out pID);
        if (shopping.haveProducts(username, pID))
        {
            try
            {
                shopping.addProductsnum(username, pID, num);
                Page.RegisterStartupScript("kk", "<script>alert('已加入购物车!')</script>");
            }
            catch (Exception ee)
            {
                Page.RegisterStartupScript("kk", "<script>alert('错误')</script>");
                return;
            }
        }
        else
        {
            try
            {
                shopping.addNewproducts(username, pID, num);
                Page.RegisterStartupScript("kk", "<script>alert('已加入购物车!')</script>");
            }
            catch (Exception ee)
            {
                Page.RegisterStartupScript("kk", "<script>alert('错误')</script>");
                return;
            }
        }
    }
Пример #28
0
 protected void ListView2_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (String.Equals(e.CommandName, "Select"))
     {
         ListViewDataItem dataItem = (ListViewDataItem)e.Item;
         string           ID_Event = ListView2.DataKeys[dataItem.DisplayIndex].Value.ToString();
         Session["ID_Event"] = ID_Event;
         Label ChuDe = (Label)e.Item.FindControl("lblChuDe");
         Session["ChuDe"] = ChuDe.Text;
         Response.Redirect("/EventDetails.aspx");
     }
 }
Пример #29
0
    protected void _OnItemCommand(object sender, ListViewCommandEventArgs e)
    {
        ListViewDataItem dataItem = (ListViewDataItem)e.Item;
        string           fotoID   =
            lvFoto.DataKeys[dataItem.DisplayIndex].Value.ToString();

        if (e.CommandName == "cancella")
        {
            PhotoManager.RemovePhoto(int.Parse(fotoID));
        }
        lvFoto.DataBind();
    }
Пример #30
0
        protected void Button_Save_Notes_Click(object sender, EventArgs e)
        {
            ContentPlaceHolder placeholder = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");
            ListView           notes       = (ListView)placeholder.FindControl("ListView_Consultant_Notes");
            ListViewDataItem   item        = notes.Items.First();

            TextBox tb = (TextBox)item.FindControl("TextBox_Consultant_Notes");

            string text = tb.Text;
            string statusMessage;

            try
            {
                string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/joshh/OneDrive/Documents/Database2.accdb";



                OleDbConnection con = new OleDbConnection(connectionString);
                con.Open();


                //insert new name into dtbs

                OleDbCommand updateCmd         = new OleDbCommand();
                string       updateQueryString = "UPDATE Consultants SET Consultants.Notes = (@text) WHERE(((Consultants.ID) = (@id)));";
                updateCmd.CommandText = updateQueryString;
                updateCmd.CommandType = CommandType.Text;
                updateCmd.Connection  = con;
                updateCmd.Parameters.Add(new OleDbParameter("@text", text));
                string id = ConsultantId.Value;
                updateCmd.Parameters.Add(new OleDbParameter("@id", id));

                updateCmd.ExecuteNonQuery();

                statusMessage = "Consultant Notes Successfully updated.";



                con.Close();
            }
            catch (Exception ex)
            {
                statusMessage = ex.Message;
                Response.Write("<script>alert('" + statusMessage + "')</script>");
            }



            tb.ReadOnly = true;
            Button_Edit_Consultant_Notes.Visible = true;
            Button_Save_Notes.Visible            = false;
            Button_Cancel_Notes_Save.Visible     = false;
        }
Пример #31
0
 void _listView_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ListViewDataItem it = _listView.SelectedItem;
         if (it != null)
         {
             _currentCatalogItem = it.Tag as CatalogItem;
             ContentMenuStrip.Show(_listView, e.Location);
         }
     }
 }
Пример #32
0
        protected void lvCRMAgreement_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                CRMAgreement_DetailedEntity ent = (CRMAgreement_DetailedEntity)dataItem.DataItem;

                HyperLink lnkShowApprovalStatus   = (HyperLink)e.Item.FindControl("lnkShowApprovalStatus");
                HyperLink hypAgreementVariableMap = (HyperLink)e.Item.FindControl("hypAgreementVariableMap");
                HyperLink hypAgreementReport      = (HyperLink)e.Item.FindControl("hypAgreementReport");


                hypAgreementVariableMap.NavigateUrl = UrlHelper.BuildSecureUrl(
                    "~/CRM/CRMAgreementVariableMap.aspx",
                    string.Empty,
                    UrlConstants.OVERVIEW_AGREEMENT_ID,
                    ent.AgreementID.ToString()
                    ).ToString();

                hypAgreementVariableMap.Target = "_blank";

                if (ent.AgreementTypeID == MasterDataConstants.CRMMDAgreementType.SPECS)
                {
                    HyperLink hypAgreementSpec = (HyperLink)e.Item.FindControl("hypAgreementSpec");
                    hypAgreementSpec.NavigateUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMAgreementSpecs.aspx", String.Empty, UrlConstants.OVERVIEW_AGREEMENT_ID, ent.AgreementID.ToString()).ToString();
                    hypAgreementSpec.Target      = "_blank";
                    hypAgreementSpec.Visible     = true;
                }

                hypAgreementReport.NavigateUrl = UrlHelper.BuildSecureUrl("~/Reports/ReportViewer.aspx", string.Empty, "do", ReportConstants.AGREEMENT_REPORT, UrlConstants.OVERVIEW_AGREEMENT_ID, ent.AgreementID.ToString()).ToString();
                hypAgreementReport.Target      = "_blank";

                APApprovalProcessEntity aPApprovalProcessEntity = APRobot.GetApprovalProcessByTypeAndReference(MasterDataConstants.APType.AGREEMENT, ent.AgreementID);

                if (aPApprovalProcessEntity.APApprovalProcessID > 0)
                {
                    lnkShowApprovalStatus.NavigateUrl = UrlHelper.BuildSecureUrl(
                        "~/AP/APView.aspx",
                        string.Empty,
                        APApprovalProcessEntity.FLD_NAME_APApprovalProcessID,
                        aPApprovalProcessEntity.APApprovalProcessID.ToString()
                        ).ToString();

                    lnkShowApprovalStatus.Target = "_blank";
                }
                else
                {
                    lnkShowApprovalStatus.NavigateUrl = String.Empty;
                    lnkShowApprovalStatus.Enabled     = false;
                }
            }
        }
Пример #33
0
        void Testing()
        {
            Process cmd = new Process();
            cmd.StartInfo = new ProcessStartInfo(@"cmd.exe");
            cmd.StartInfo.RedirectStandardInput = true;// перенаправить вход
            cmd.StartInfo.RedirectStandardOutput = true;//перенаправить выход
            cmd.StartInfo.RedirectStandardError = true;
            cmd.StartInfo.UseShellExecute = false;//обязательный параметр, для работы предыдущих
            cmd.StartInfo.CreateNoWindow = true;
            cmd.Start();

            cmd.StandardInput.WriteLine(compiler +" "+programPath);

            Thread.Sleep(1000);
            cmd.StandardInput.WriteLine("exit");
            string error = cmd.StandardError.ReadToEnd();
            if (!String.IsNullOrEmpty(error)) {
                var item = new ListViewDataItem();
                item.BackColor = Color.Red;
                item.ForeColor = Color.Black;
                item.GradientStyle = GradientStyles.Solid;
                item.Text = error;
                Invoke((MethodInvoker)delegate {
                    testResultList.Items.Add(item);
                });
                return;
            }
            cmd.Close();
            int i = 1;

            Process program = new Process();
            while ((File.Exists(string.Format("tests/test{0}", i))) && (File.Exists(string.Format("tests/test{0}a", i)))) {
                program.StartInfo = new ProcessStartInfo(@"a.exe");
                program.StartInfo.RedirectStandardInput = true;// перенаправить вход
                program.StartInfo.RedirectStandardOutput = true;//перенаправить выход
                program.StartInfo.UseShellExecute = false;//обязательный параметр, для работы предыдущих
                program.StartInfo.CreateNoWindow = true;
                program.Start();
                using (StreamReader srTest = new StreamReader(String.Format("tests/test{0}", i))) {
                    program.StandardInput.WriteLine(srTest.ReadToEnd());
                }

                StreamReader sr = program.StandardOutput;
                Invoke((MethodInvoker)delegate {
                    testResultList.Items.Add(Checker(string.Format("tests/test{0}a", i), sr));
                });

                program.Close();
                i++;
            }
            cmd.Close();
        }
Пример #34
0
 /// <summary>
 /// Show Audio Files
 /// </summary>
 private void ShowAudioFiles()
 {
     lblStatus.Text = "Showing Audio File(s) ...";
     lblStatus.Refresh();
     this.Refresh();
     Application.DoEvents();
     lvwAudioFiles.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
     lvwAudioFiles.Columns.Clear();
     lvwAudioFiles.Columns.Add("Track Number");
     lvwAudioFiles.Columns.Add("Length");
     lvwAudioFiles.Columns.Add("File");
     lvwAudioFiles.Items.Clear();
     for (int i = 0; i < AudioCdWriter.FileCount; ++i) {
         var item = new ListViewDataItem();
         var s = (short)i;
         item.SubItems.Add((i + 1).ToString());
         item.SubItems.Add(AudioCdWriter.TrackLength(s).ToString() + " sec(s)"); // Length
         item.SubItems.Add(AudioCdWriter.file[s]);
         lvwAudioFiles.Items.Add(item);
         lvwAudioFiles.Refresh();
         this.Refresh();
         Application.DoEvents();
     }
     lblStatus.Text = "";
     lblStatus.Refresh();
     this.Refresh();
     Application.DoEvents();
 }
Пример #35
0
 public static ListViewDataItem[] getscore(Font font)
 {
     ListViewDataItem[] ret = new ListViewDataItem[255];
     int cur = 0;
     for (int i = 0; i < TmpSet.count; i++)
     {
         if (Core.Scores.ContainsKey(TmpSet.Diffs[i].GetHash()))
         {
             foreach (Score tmp in Core.Scores[TmpSet.Diffs[i].GetHash()])
             {
                 ListViewDataItem tmpl = new ListViewDataItem();
                 tmpl.Image = Core.getrank(tmp);
                 tmpl.Text = String.Format(
                     "<html>Player:{0},Date:{1},Score: {2}<br>Diff:{3},Mods:{4},Mode:{5}<br>300:{6},100:{7},50:{8},Miss:{9},Maxcombo:{10}</html>",
                     tmp.player, tmp.time.ToString(), tmp.score, TmpSet.Diffs[i].Version,
                     tmp.mod, tmp.mode.ToString(),
                     tmp.hit300, tmp.hit100, tmp.hit50, tmp.miss, tmp.maxCombo);
                 tmpl.Font = font;
                 ret[cur] = tmpl;
                 cur++;
             }
         }
     }
     return ret;
 }
Пример #36
0
        private void cmbService_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            if (cmbService.SelectedItem == null)
                return;

            Service service = cmbService.SelectedItem.DataBoundItem as Service;
            VisitService visitService = srcService.DataSource as VisitService;

            Visit visit = srcItem.DataSource as Visit;

            if (visitService != null && service != null && visit != null && visit.Patient != null)
            {
                visitService.Service = service;

                if (_canUpdateInsurance)
                {
                    VisitServiceInsurance[] visitServiceInsurances = visitService.VisitServiceInsurances.ToArray();
                    for (int i = 0; i < visitServiceInsurances.Length; i++)
                    {
                        if (visitServiceInsurances[i].EntityState == System.Data.EntityState.Added)
                            DataLayer.Detach(visitServiceInsurances[i]);
                        else
                            DataLayer.Remove(visitServiceInsurances[i]);
                    }
                    visitService.VisitServiceInsurances.Clear();
                }

                lsvInsurances.Items.Clear();

                InsuranceDef[] insuranceDefs = DataLayer.GetInsuranceDefs(visit.Patient, service);

                for (int i = 0; i < insuranceDefs.Length; i++)
                {
                    ListViewDataItem item = new ListViewDataItem();
                    item.SubItems.Add(insuranceDefs[i].Insurance.Title);
                    item.SubItems.Add(string.Format("{0:0,0 ریال}", insuranceDefs[i].Fee));
                    item.Tag = insuranceDefs[i];
                    lsvInsurances.Items.Add(item);
                    if (_canUpdateInsurance)
                        item.CheckState = ToggleState.On;
                }
            }
        }
Пример #37
0
        /// <summary>
        /// Does the update list view.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        private void DoUpdateListView(object parameters)
        {
            IProgressCallback progressCallback = (IProgressCallback)parameters;

            progressCallback.Begin();
            progressCallback.StepTo(0);
            progressCallback.SetComment("Getting parts list...");

            List<IVfPartModel> parts = VfApplication.CurrentContext.GetParts(DocumentId);
            progressCallback.SetRange(0, parts.Count);

            parts.ForEach((item) => {

                ListViewDataItem lvItem = new ListViewDataItem();
                lvItem.Key = item.Id;
                lvItem.Text = String.Format("Item-{0:00000}", item.Id);
                lvItem.Tag = item;
                lvItem.SubItems.Add(item.Text);

                Invoke(new AddListViewItemsInvoker(lvParts.Items.Add), new object[] { lvItem });

                if (progressCallback.IsAborting)
                {
                    return;
                }
                progressCallback.SetComment(item.Text);
                progressCallback.Increment(1);
            });

            progressCallback.End();
        }
Пример #38
0
 public static IEnumerable<ListViewDataItem> getscore(Font font)
 {
     var ret = new ListViewDataItem[255];
     int cur = 0;
     for (int i = 0; i < TmpSet.count; i++)
     {
         if (Core.Scores.ContainsKey(TmpSet.Diffs[i].GetHash()))
         {
             foreach (var tmp in Core.Scores[TmpSet.Diffs[i].GetHash()])
             {
                 ret[cur] = new ListViewDataItem
                 {
                     Image = Core.Getrank(tmp),
                     Text = String.Format(
                         "<html>Player:{0},Date:{1},Score: {2}<br>Diff:{3},Mods:{4},Mode:{5}<br>300:{6},100:{7},50:{8},Miss:{9},Maxcombo:{10}</html>",
                         tmp.Player, tmp.Time.ToString(), tmp.Score, TmpSet.Diffs[i].Version,
                         tmp.Mod, tmp.Mode.ToString(),
                         tmp.Hit300, tmp.Hit100, tmp.Hit50, tmp.Miss, tmp.MaxCombo),
                     Font = font
                 }; ;
                 cur++;
             }
         }
     }
     return ret;
 }