protected void dl1_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        DataListItem item = e.Item;


        Label lbGiaMoi = (Label)item.FindControl("GiaBanMoiLabel");

        Label lbGiaBan = (Label)item.FindControl("GiaBanLabel");

        lbGiaBan.Text = "Giá:  " + HienThiGia(Convert.ToDouble(lbGiaBan.Text));

        LinkButton linkbutton = (LinkButton)item.FindControl("lbtTenSP");
        SanPhams   sanpham    = db.SanPhams.SingleOrDefault(p => p.TenSP == linkbutton.Text);

        Label             tenkhuyenmai     = (Label)item.FindControl("TenKhuyenMai");
        SanPham_KhuyenMai sanphamkhuyenmai = db.SanPham_KhuyenMais.SingleOrDefault(p => p.MaSanPham == sanpham.MaSanPham);

        if (sanphamkhuyenmai != null)
        {
            KhuyenMai khuyenmai = db.KhuyenMais.SingleOrDefault(p => p.MaKhuyenMai == sanphamkhuyenmai.MaKhuyenMai);
            tenkhuyenmai.Text = khuyenmai.NoiDungKhuyenMai;
            if (khuyenmai.NoiDungKhuyenMai.ToString().Length > 30)
            {
                tenkhuyenmai.Text = khuyenmai.NoiDungKhuyenMai.Substring(0, 30) + "...";
            }
            lbGiaBan.Font.Strikeout = true;
            lbGiaMoi.ForeColor      = System.Drawing.Color.Red;
            lbGiaMoi.Text           = "Giá bán:  " + HienThiGia(Convert.ToDouble(TinhGiamGia(khuyenmai.GiaCanGiam, sanpham.GiaBan).ToString()));
        }
        else
        {
            lbGiaBan.Font.Size = 11;
            lbGiaBan.Font.Bold = true;
        }
    }
Exemple #2
0
        protected void ReplyCommentAnonymous_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DataListItem Item  = (DataListItem)(((Control)sender).NamingContainer);
                int          index = Item.ItemIndex;
                if (((TextBox)AllMyNewComment_DataList.Items[index].FindControl("Reply_TextBox")).Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(Page, GetType(), "nocontent", "alert('请输入内容!');", true);
                    //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('请输入内容!');location.href='" + Request.Url.AbsoluteUri + "'</script>");
                }
                else
                {
                    MessageInfo replycomment = new MessageInfo();
                    replycomment.Anonymous     = 1;
                    replycomment.MessageID     = int.Parse(e.CommandArgument.ToString());
                    replycomment.UserID        = user.UserID;
                    replycomment.TargetUserID  = int.Parse(TargetUserID_TextBox.Text);
                    replycomment.TargetReplyID = int.Parse(TargetReplyID_TextBox.Text);
                    replycomment.Content       = ((TextBox)AllMyNewComment_DataList.Items[index].FindControl("Reply_TextBox")).Text;
                    replycomment.AddCommentReply();

                    mynewcomment                        = user.GetNewComment();
                    AspNetPager.RecordCount             = mynewcomment.Tables["NewComment"].Rows.Count;
                    AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                    AllMyNewComment_DataList.DataBind();
                    //Response.Redirect(Request.Url.AbsoluteUri);
                }
            }
        }
    protected void myclick(object sender, EventArgs e)
    {
        DataListItem dl = ((Button)sender).NamingContainer as DataListItem;
        string       aa = ((Label)dl.FindControl("Label1")).Text;

        Response.Redirect("Recipe_details.aspx?respid=" + aa.ToString());
    }
Exemple #4
0
    protected void DataListFullPG_PreRender(object sender, EventArgs e)
    {
        try
        {
            /*Retrieving Owner name*/
            DataListItem dli        = DataListFullPG.Items[0] as DataListItem;
            Label        lblOwnerID = dli.FindControl("lblOwner") as Label;
            Label        lblID      = dli.FindControl("lblID") as Label;

            String        ownerName = "";
            String        myConn    = ConfigurationManager.ConnectionStrings["StayHubDBConnection"].ConnectionString;
            SqlConnection con       = new SqlConnection(myConn);
            String        getOwner  = "SELECT Name FROM Users where ID = (select @ownerid from PG where ID = @original_ID) ";
            SqlCommand    cmd1      = new SqlCommand(getOwner, con);
            cmd1.Parameters.AddWithValue("ownerid", lblOwnerID.Text);
            cmd1.Parameters.AddWithValue("original_ID", lblID.Text);
            con.Open();
            SqlDataReader reader1 = cmd1.ExecuteReader();
            while (reader1.Read())
            {
                ownerName = reader1[0].ToString();
            }
            con.Close();

            Label lblOwnerName = dli.FindControl("lblOwnerName") as Label;
            lblOwnerName.Text = ownerName;
        }
        catch (Exception exc)
        {
            Response.Redirect("ErrorPage.aspx");
        }
    }
Exemple #5
0
        protected void DataList3_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataListItem            i = e.Item;
                System.Data.DataRowView r = ((System.Data.DataRowView)e.Item.DataItem); // 'r' represents the next row in the table that has been passed here via the 'bind' function.

                // Find the label controls that are associated with this data item.

                Label UsersID_LBL       = (Label)e.Item.FindControl("UsersID_Label");       // Find the ID Label.
                Label Usersname_LBL     = (Label)e.Item.FindControl("Usersname_Label");     // Find the real name Label.
                Label UsersUsername_LBL = (Label)e.Item.FindControl("UsersUsername_Label"); // Find the username Label.
                Label UsersPassword_LBL = (Label)e.Item.FindControl("UsersPassword_Label"); // Find the password Label.
                Label UsersUsertype_LBL = (Label)e.Item.FindControl("UsersUserType_Label"); // Find the password Label.



                UsersID_LBL.Text       = r["ID"].ToString();       // ID
                Usersname_LBL.Text     = r["Name"].ToString();     // real name
                UsersUsername_LBL.Text = r["Username"].ToString(); // username
                UsersPassword_LBL.Text = r["Password"].ToString(); // username
                UsersUsertype_LBL.Text = r["UserType"].ToString(); // user type



                /* Button ViewButton = (Button)e.Item.FindControl("ViewButton");   // Find the button in this row.
                 * ViewButton.CommandArgument = i.ItemIndex.ToString();    // Allocate the row number to the 'command argument' property of the button, so we can identify which button was pressed later.
                 * ViewButton.CommandName = "View"; */
            }
        }
Exemple #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Button       mua     = (Button)sender;
            string       mahang  = mua.CommandArgument.ToString();
            DataListItem item    = (DataListItem)mua.Parent;
            string       soluong = ((TextBox)item.FindControl("TextBox1")).Text;

            if (Request.Cookies["TenDN"] == null)
            {
                return;
            }
            string        ten = Request.Cookies["TenDN"].Value;
            SqlConnection con = new SqlConnection(conn);

            con.Open();
            string        query   = "SELECT * FROM donhang WHERE TenDN='" + ten + "' and MaSP='" + mahang + "'";
            SqlCommand    command = new SqlCommand(query, con);
            SqlDataReader reader  = command.ExecuteReader();

            if (reader.Read())
            {
                query = "UPDATE donhang SET soluong=soluong+" + soluong + " WHERE TenDN='" + ten + "' and MaSP='" + mahang + "'";
            }
            else
            {
                query = "INSERT INTO donhang VALUES(" + mahang + ", '" + ten + "', " + soluong + ");";
            }
            reader.Close();
            command = new SqlCommand(query, con);
            command.ExecuteNonQuery();
            con.Close();
        }
Exemple #7
0
        protected void ShowReading(object sender, EventArgs e)
        {
            ddlExamQuestion.DataSource = "";

            DataListItem gvr = (DataListItem)(((Control)sender).NamingContainer);
            {
                Label      lblID      = (Label)gvr.FindControl("lblID");
                LinkButton lnkCounted = (LinkButton)gvr.FindControl("LinkButton3");
                DataTable  dt         = new DataTable();
                objML_ExamTransaction.ID       = lblID.Text != "" ? lblID.Text : null;
                objML_ExamTransaction.ExamName = Session["ExamName"].ToString();
                dt = objBL_ExamTransaction.BL_ShowReading(objML_ExamTransaction);
                if (dt.Rows.Count > 0)
                {
                    ddlExamQuestion.DataSource = dt;
                    ddlExamQuestion.DataBind();
                    SaveDiv.Visible           = true;
                    lblAllID.Text             = dt.Rows[0]["ComprehensionID"].ToString();
                    lblPaperID.Text           = dt.Rows[0]["PaperID"].ToString();
                    lnkCounted.BackColor      = System.Drawing.Color.Gray;
                    lnkCounted.ForeColor      = System.Drawing.Color.Black;
                    DlAudioSection.DataSource = "";
                    DlAudioSection.Visible    = false;
                    DLVideoSection.Visible    = false;
                    DLComprehension.Visible   = true;
                    pnQuestion.Height         = 300;
                    DLReading.Visible         = true;
                    ddlExamQuestion.Visible   = true;
                    ThankuSubmit.Visible      = false;
                    BindExamComprehension(lblID.Text);
                }
            }
        }
Exemple #8
0
        private void saveUserAccount(DataListItem dli)
        {
            HiddenField       hdnAccountId = dli.FindControl("hdnAccountId") as HiddenField;
            int               acctId       = Convert.ToInt32(hdnAccountId.Value);
            AccountEntity     acct         = new AccountEntity(acctId);
            UserAccountEntity uae          = new UserAccountEntity();

            if (_userAccounts.Where(x => x.AccountId == acct.AccountId).Count() > 0)
            {
                uae = _userAccounts.Where(x => x.AccountId == acct.AccountId).First();
            }

            CheckBox chkAccount = dli.FindControl("chkAccount") as CheckBox;

            if (chkAccount.Checked)
            {
                if (uae.IsNew)
                {
                    uae.UserId    = _user.UserId;
                    uae.AccountId = acct.AccountId;
                    uae.Save();
                }
            }
            else
            {
                if (!uae.IsNew)
                {
                    _userAccounts.Remove(uae);
                    uae.Delete();
                }
            }
        }
Exemple #9
0
        protected void ddlday_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl  = sender as DropDownList;
            DataListItem item = ddl.NamingContainer as DataListItem;

            insp.day_id = int.Parse(ddl.SelectedValue);
        }
Exemple #10
0
        protected void Button1_Click(object sender, DataListCommandEventArgs e)
        {
            if (e.CommandName == "call")
            {
                DataListItem item = (DataListItem)(((Button)(e.CommandSource)).NamingContainer);
                string       text = ((Label)item.FindControl("TextBox1")).Text;



                DeleteImage.WebService1 S1 = new DeleteImage.WebService1();
                S1.Credentials = System.Net.CredentialCache.DefaultCredentials;

                String a;

                a = S1.deleteTable(text);

                if (a.Equals("Success insert"))
                {
                    Response.Write("Upload Successful");
                }
                else
                {
                    Response.Write("Upload not Successful");
                }
            }
        }
Exemple #11
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Button b = sender as Button;

        if (b != null)
        {
            string       a      = b.CommandArgument;
            DataTable    dtCart = (DataTable)Session["Cart"];
            DataListItem row    = (DataListItem)b.NamingContainer;
            if (row != null)
            {
                int quantity = Convert.ToInt32(((TextBox)(row.FindControl("ddlQuantity"))).Text);
                if (quantity != 1)
                {
                    quantity--;
                }
                int index = Convert.ToInt32(a);
                int price = Convert.ToInt32(dtCart.Rows[row.ItemIndex]["SalePrice"]);
                dtCart.Rows[row.ItemIndex].SetField("quantity", (quantity));
                dtCart.Rows[row.ItemIndex].SetField("total", (quantity * price));
                DataList1.DataSource = dtCart;
                DataList1.DataBind();
                Session["Cart"] = dtCart;
            }
        }
        Response.Redirect("Cart.aspx");
    }
Exemple #12
0
        public void BindSpan(Object sender, EventArgs e)
        {
            HtmlGenericControl spn = ( HtmlGenericControl )sender;

            String       strText;
            DataListItem container = ( DataListItem )spn.NamingContainer;

            if (true == blnDate)
            {
                strText = (( DataRowView )container.DataItem)["PriceDate"].ToString( );

                String strYear  = strText.Substring(2, 2);
                String strMonth = strText.Substring(4, 2);
                String strDay   = strText.Substring(6, 2);

                // converting gets rid of leading zero 09, 03, etc
                strText = Convert.ToInt32(strMonth).ToString( ) +
                          "." + Convert.ToInt32(strDay).ToString( ) +
                          "." + strYear;
            }
            else
            {
                strText = (( DataRowView )container.DataItem)["Price"].ToString( );
            }

            spn.InnerHtml = strText;
        }
Exemple #13
0
    protected void lnkAuto_Click(object s, CommandEventArgs e)
    {
        string       Autodate  = null;
        LinkButton   btn       = (LinkButton)s;
        DataListItem item      = (DataListItem)btn.NamingContainer;
        LinkButton   lnkAuto   = (LinkButton)item.FindControl("lnkAuto");
        ImageButton  ImgUpdate = (ImageButton)item.FindControl("ImgUpdate");

        string[] arg          = e.CommandArgument.ToString().Split(',');
        int      Port_call_ID = UDFLib.ConvertToInteger(arg[0]);
        int      Vessel_ID    = UDFLib.ConvertToInteger(arg[1]);

        if (lnkAuto.Text == "Auto Date is Off")
        {
            ImgUpdate.Visible = false;
            lnkAuto.Text      = "Auto Date is On";
            Autodate          = "NO";
        }
        else
        {
            ImgUpdate.Visible = true;
            lnkAuto.Text      = "Auto Date is Off";
            Autodate          = "YES";
        }
        objPortCall.Update_PortCall_Details_AutoDate(Convert.ToInt32(Port_call_ID), Vessel_ID, Autodate, Convert.ToInt32(Session["USERID"].ToString()));
        string tabid    = TabSCM.ActiveTab.ID;
        string tabindex = TabSCM.ActiveTab.TabIndex.ToString();

        BindPortCall();
        Load_PortList();
        //BindPortCall();
        BindTab();
    }
    public void SwapLabels()
    {
        try
        {
            DataListItem dli = this.DataListFullPG.Controls[this.DataListFullPG.Controls.Count - 1] as DataListItem;

            Label   l1 = dli.FindControl("lblName") as Label;
            TextBox t1 = dli.FindControl("txtName") as TextBox;

            Label   l2 = dli.FindControl("lblAddr") as Label;
            TextBox t2 = dli.FindControl("txtAddr") as TextBox;

            Label   l3 = dli.FindControl("lblOcc") as Label;
            TextBox t3 = dli.FindControl("txtOcc") as TextBox;

            Label   l4 = dli.FindControl("lblRent") as Label;
            TextBox t4 = dli.FindControl("txtRent") as TextBox;


            l1.Visible = true;
            t1.Visible = false;
            l2.Visible = true;
            t2.Visible = false;
            l3.Visible = true;
            t3.Visible = false;
            l4.Visible = true;
            t4.Visible = false;
        }
        catch (Exception exc)
        {
            Response.Redirect("ErrorPage.aspx");
        }
    }
        private void OnDataListBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
        {
            DataRowView drv = (DataRowView)e.Item.DataItem;

            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                string mm = string.Format("{0:dd MMMM yyyy}", Convert.ToDateTime(drv.Row["OccupDateValue"].ToString()));
                string tt = mm.Substring(2, (mm.LastIndexOf(" ") - 2));
                if (temp != string.Empty)
                {
                    if (temp != tt)
                    {
                        DataListItem lItem = new DataListItem(e.Item.ItemIndex + 1, ListItemType.Item);
                        //LiteralControl newLine = new LiteralControl("<tr style='background-color:black'></tr>");
                        //DataList1.Controls.Add(newLine);
                        DataList1.Controls.Add(lItem);
                        temp = string.Empty;
                    }
                }
                if (temp == string.Empty)
                {
                    temp = tt;
                }
            }
        }
    protected void breplay_click(object sender, EventArgs e)
    {
        Button       BuyNowButton = (Button)sender;
        DataListItem item         = (DataListItem)BuyNowButton.NamingContainer;
        TextBox      treplay      = (TextBox)item.FindControl("treplay");
        Label        success      = (Label)item.FindControl("success");
        Label        success1     = (Label)item.FindControl("Label1");

        MailMessage mm = new MailMessage();

        mm.To.Add(success1.Text);
        mm.From       = new MailAddress("*****@*****.**");
        mm.Subject    = "Smart City:Feedback Replay";
        mm.Body       = treplay.Text;
        mm.IsBodyHtml = false;
        SmtpClient smtp = new SmtpClient();

        smtp.Host      = "smtp.gmail.com";
        smtp.EnableSsl = true;
        NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "8688028066");

        smtp.UseDefaultCredentials = true;
        smtp.Credentials           = NetworkCred;
        smtp.Port = 587;
        smtp.Send(mm);

        success.Text = "Successfully sent";
    }
    private void GenerateDepartment(DataListItem item, string departmentID)
    {
        Repeater list = (Repeater)item.FindControl("uxDepartmentItemRepeater");

        list.DataSource = DataAccessContext.ProductRepository.GetByDepartmentID(StoreContext.Culture, departmentID, "Name", BoolFilter.ShowTrue, new StoreRetriever().GetCurrentStoreID());
        list.DataBind();
    }
Exemple #18
0
        protected void Rating1_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
        {
            rating = e.Value.ToString();
            if (rating == null)
            {
                rating = "1";
            }
            AjaxControlToolkit.Rating _rating = (AjaxControlToolkit.Rating)sender;
            DataListItem item = (DataListItem)_rating.NamingContainer;

            if (item != null)
            {
                idd = (string)DataList1.DataKeys[item.ItemIndex];
            }
            SqlConnection scon = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

            scon.Open();
            String     chkpas = "******" + idd + "'";
            SqlCommand com2   = new SqlCommand(chkpas, scon);

            pname = com2.ExecuteScalar().ToString();
            String     query = "insert into [Table3](Id,Product_name,Rating) values('" + idd + "','" + pname + "'," + Convert.ToInt16(rating.ToString()) + ")";
            SqlCommand cmd   = new SqlCommand();

            cmd.CommandText = query;
            cmd.Connection  = scon;
            cmd.ExecuteNonQuery();
            System.Diagnostics.Debug.WriteLine(idd);
            scon.Close();
        }
Exemple #19
0
        protected void ReplyAdviceAnonymous_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DataListItem Item  = (DataListItem)(((Control)sender).NamingContainer);
                int          index = Item.ItemIndex;
                if (((TextBox)AllMyAdvice_DataList.Items[index].FindControl("Reply_TextBox")).Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(Page, GetType(), "nocontent", "alert('请输入内容!');", true);
                    //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('请输入内容!');location.href='" + Request.Url.AbsoluteUri + "'</script>");
                }
                else
                {
                    MessageInfo replyadvice = new MessageInfo();
                    replyadvice.Anonymous    = 1;
                    replyadvice.MessageID    = int.Parse(e.CommandArgument.ToString());
                    replyadvice.UserID       = user.UserID;
                    replyadvice.TargetUserID = int.Parse(TargetUserID_TextBox.Text);
                    replyadvice.Content      = ((TextBox)AllMyAdvice_DataList.Items[index].FindControl("Reply_TextBox")).Text;
                    replyadvice.AddAdviceReply();

                    AllDataBind();
                    //Response.Redirect(Request.Url.AbsoluteUri);
                }
            }
        }
    //Click add to cart menu
    protected void btn_Goclick(object sender, EventArgs e)
    {
        Button       btn         = (Button)sender;
        DataListItem item        = (DataListItem)btn.NamingContainer;
        Label        lblId       = (Label)item.FindControl("LblID");
        Label        LblCode     = (Label)item.FindControl("LblCode");
        Label        LblItemName = (Label)item.FindControl("LblItemName");
        Label        LblQty      = (Label)item.FindControl("LblQty");
        Label        LblPrice    = (Label)item.FindControl("LblPrice");
        Label        LblDisc     = (Label)item.FindControl("LblDisc");
        Label        LblTotal    = (Label)item.FindControl("LblTotal");
        TextBox      txtqty      = (TextBox)item.FindControl("txtqty");

        string  ID       = lblId.Text;
        string  Code     = LblCode.Text;
        string  ItemName = LblItemName.Text;
        string  Qty      = txtqty.Text; // LblQty.Text;
        decimal QtyStock = Convert.ToDecimal(LblQty.Text);
        string  Price    = LblPrice.Text;
        string  Disc     = LblDisc.Text;

        decimal Total = Math.Round((Convert.ToDecimal(Price) - (Convert.ToDecimal(Price) * Convert.ToDecimal(Disc) / 100)) * Convert.ToDecimal(Qty), 2);


        DataTable dt = (DataTable)Session["valuereturn"];

        dt.Rows.Add(Code, ItemName, Qty, Price, Disc, Total);
        grdSelectedItem.DataSource = dt;
        grdSelectedItem.DataBind();
    }
        protected void btnRemoveIngredient_Click(object sender, EventArgs e)
        {
            LinkButton btn = sender as LinkButton;

            if (btn != null)
            {
                DataListItem item = btn.Parent.Parent as DataListItem;

                List <SRL_Ingredient> list = Ingredients;
                if (item != null)
                {
                    list.RemoveAt(item.ItemIndex);
                }
                Ingredients = list;
            }

            dlistIngredients.DataSource = Ingredients.ToArray();
            dlistIngredients.DataBind();


            txtFoodName.Text = "";
            txtQuantity.Text = "";
            //ddlFractions.SelectedIndex = 0;
            ddlMeasurementUnits.SelectedIndex = 0;
            btnAddIngerdient.CommandArgument  = MyGlobalResources.Add;

            UpdatePanel2.Update();
            UpdatePanel3.Update();
            UpdatePanel4.Update();
        }
Exemple #22
0
        IList <IDataListItem> ConvertToIDataListItem(IScalar scalar)
        {
            IList <IDataListItem> result = new List <IDataListItem>();
            var item = scalar;

            if (item != null)
            {
                IDataListItem singleRes = new DataListItem();
                singleRes.IsRecordset  = false;
                singleRes.Field        = item.Name;
                singleRes.DisplayValue = item.Name;
                try
                {
                    singleRes.Value = item.Value;
                }
                catch (Exception)
                {
                    singleRes.Value = null;
                }
                var desc = item.Description;
                singleRes.Description = string.IsNullOrWhiteSpace(desc) ? null : desc;
                result.Add(singleRes);
            }
            return(result);
        }
Exemple #23
0
        protected void txtProductQuantity_TextChanged(object sender, EventArgs e)
        {
            TextBox      txtQuantity       = (sender as TextBox);
            DataListItem currentItem       = (sender as TextBox).NamingContainer as DataListItem;
            HiddenField  ProductID         = currentItem.FindControl("lblProductID") as HiddenField;
            Label        lblAvailableStock = currentItem.FindControl("lblAvailableStock") as Label;

            if (txtQuantity.Text == string.Empty || txtQuantity.Text == "0" || txtQuantity.Text == "1")
            {
                txtQuantity.Text = "1";
            }
            else
            {
                if (Session["MyCart"] != null)
                {
                    if (Convert.ToInt32(txtQuantity.Text) <= Convert.ToInt32(lblAvailableStock.Text))
                    {
                        DataTable dt  = (DataTable)Session["MyCart"];
                        DataRow[] row = dt.Select("ProductID = '" + ProductID.Value + "'");

                        int index = dt.Rows.IndexOf(row[0]);
                        dt.Rows[index]["ProductQuantity"] = txtQuantity.Text;
                        Session["MyCart"] = dt;
                    }
                    else
                    {
                        lblAvailableStockAlert.Text = "Alert : Product buyout should not be more than AvailableStock !!";
                        txtQuantity.Text            = "1";
                    }
                }
            }
            UpdateTotalBill();
        }
Exemple #24
0
    protected void DataList1_PreRender(object sender, EventArgs e)
    {
        try
        {
            int c = DataList1.Items.Count;
            for (int i = 0; i < c; i++)
            {
                DataListItem dli       = DataList1.Controls[i] as DataListItem;
                Label        lblStatus = dli.FindControl("lblStatus") as Label;
                String       status    = lblStatus.Text;

                if (status == "Inactive")
                {
                    lblStatus.ForeColor = System.Drawing.Color.Red;
                }

                Label  lblExpiry = dli.FindControl("lblExpiry") as Label;
                String exp       = lblExpiry.Text;

                if (exp == "01-01-1900")
                {
                    lblExpiry.Text = "Unapproved";
                }
            }
        }
        catch (Exception exc)
        {
            Response.Redirect("ErrorPage.aspx");
        }
    }
    protected void imgBtn_Odberi_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton  imgBtnIzbrisiClicked = (ImageButton)sender;
        DataListItem SelectedItem         = (DataListItem)imgBtnIzbrisiClicked.NamingContainer;
        Label        Slika_Id             = (Label)SelectedItem.FindControl("lbl_Slika_Id");

        SqlConnection connection = new SqlConnection();

        connection.ConnectionString = ConfigurationManager.ConnectionStrings["Konekcija"].ConnectionString;
        SqlCommand komanda = new SqlCommand();

        komanda.Connection  = connection;
        komanda.CommandText = @"UPDATE Pozadina SET Aktivna = 0 ; UPDATE Pozadina SET Aktivna = 1 WHERE Pozadina_Id = " + Slika_Id.Text;

        try
        {
            connection.Open();
            komanda.ExecuteNonQuery();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "AlertPopup", "alert('Успешна промена!');", true);
        }
        finally
        { connection.Close(); }

        DS_SiteSliki.SelectCommand = "SELECT * FROM Pozadina";
        DS_SiteSliki.DataBind();
        DataList6.DataBind();
    }
    protected void B_guardar_Click(object sender, EventArgs e)
    {
        UuserReservas       dato   = new UuserReservas();
        UPreserva           datos  = new UPreserva();
        LUser               doc    = new LUser();
        L_Persistencia      dac    = new L_Persistencia();
        ClientScriptManager cm     = this.ClientScript;
        string              nombre = Session["usuario"].ToString();

        System.Data.DataTable validez1 = doc.obteberidres(nombre); //duda aca con doc
        Int32        id_reserva        = int.Parse(validez1.Rows[0]["id_reserva"].ToString());
        Button       btn     = (Button)sender;
        DataListItem item    = (DataListItem)btn.NamingContainer;
        TextBox      guardar = (TextBox)item.FindControl("TB_insertarPedido");

        datos.Cantidad = int.Parse(guardar.Text);
        Label lblid = (Label)item.FindControl("LB_idPlatos");

        datos.Id_plato      = int.Parse(lblid.Text);
        datos.Id_reserva    = id_reserva;
        datos.Fecha_ingreso = DateTime.Now;
        //datos.Fecha_despacho = DateTime.Parse(null);

        dac.insertarPlatoR(datos);
        // doc.insertarplares(dato);
        String mens = Session["men"].ToString();

        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('" + mens.ToString() + "');</script>");
    }
 protected void btndeselectall_Click(object sender, EventArgs e)
 {
     try
     {
         if (radiophoto.Checked == true)
         {
             for (int i = 0; i < grdimagegallery.Items.Count; i++)
             {
                 DataGridItem item = grdimagegallery.Items[i];
                 DataList     dl   = (DataList)item.FindControl("dlimage");
                 for (int j = 0; j < dl.Items.Count; j++)
                 {
                     DataListItem ditem = dl.Items[j];
                     CheckBox     chk   = (CheckBox)ditem.FindControl("checkimage");
                     chk.Checked = false;
                 }
             }
         }
         else
         {
             for (int i = 0; i < grdvideogallery.Items.Count; i++)
             {
                 DataGridItem item = grdvideogallery.Items[i];
                 DataList     dl   = (DataList)item.FindControl("dlimage");
                 for (int j = 0; j < dl.Items.Count; j++)
                 {
                     DataListItem ditem = dl.Items[j];
                     CheckBox     chk   = (CheckBox)ditem.FindControl("checkimage");
                     chk.Checked = false;
                 }
             }
         }
     }
     catch { }
 }
        public void SetDataListItemMode(DataListItem item, bool isEdit)
        {
            Label lblImageDescription = item.FindControl("lblImageDescription") as Label;
            Label lblImageTitle       = item.FindControl("lblImageTitle") as Label;

            TextBox txtImageTitle      = item.FindControl("txtImageTitle") as TextBox;
            Control ckImageDescription = item.FindControl("txtImageDescription") as Control;

            //LinkButton lnkDeleteImage = item.FindControl("lnkDeleteImage") as LinkButton;
            LinkButton  lnkMainImage = item.FindControl("lnkMainImage") as LinkButton;
            HiddenField hdnMainImage = item.FindControl("hdnMainImage") as HiddenField;

            if (Convert.ToBoolean(hdnMainImage.Value))
            {
                lnkMainImage.Visible = false;
            }
            //
            //    lnkMainImage.Visible = isEdit;

            lblImageDescription.Visible = !isEdit;
            lblImageTitle.Visible       = !isEdit;

            txtImageTitle.Visible      = isEdit;
            ckImageDescription.Visible = isEdit;

            //lnkDeleteImage.Visible = isEdit;

            lnkCancel.Visible = isEdit;
            lnkEdit.Visible   = !isEdit;
            lnkSave.Visible   = isEdit;
        }
Exemple #29
0
    protected void aaut_Click(object sender, EventArgs e)
    {
        DataListItem dat  = (DataListItem)((LinkButton)sender).NamingContainer;
        string       name = ((LinkButton)(dat.FindControl("aaut"))).Text;

        Response.Redirect("Author-" + name);
    }
Exemple #30
0
    protected void B_guardar_Click(object sender, EventArgs e)
    {
        UuserPedido  dato  = new UuserPedido();
        UPedidoplato datos = new UPedidoplato();
        //UuserPedido pe = new UuserPedido();
        ClientScriptManager cm = this.ClientScript;
        LUser          doc     = new LUser();
        L_Persistencia dac     = new L_Persistencia();

        dato.Id_usuario = int.Parse(Session["user_id"].ToString());
        //DataTable validez1 = doc.obtenerpe(dato.Id_usuario);
        //DataTable validez1 = dac.obtenPedido(dato.Id_usuario);
        DataTable validez1 = dac.ToDataTable(dac.obtenPedido(dato));

        datos.Id_pedido     = int.Parse(validez1.Rows[0]["id_pedido"].ToString());
        datos.Fecha_ingreso = DateTime.Now;
        Button       btn     = (Button)sender;
        DataListItem item    = (DataListItem)btn.NamingContainer;
        TextBox      guardar = (TextBox)item.FindControl("TB_insertarPedido");

        datos.Cantidad = int.Parse(guardar.Text);
        Label lblid = (Label)item.FindControl("LB_Codigop");

        datos.Id_plato = int.Parse(lblid.Text);

        dac.insertarPedido(datos);
        //doc.guardarPedido(dato);
        String mens = Session["men"].ToString();

        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('" + mens.ToString() + "');</script>");
    }
		public DataListCommandEventArgs (
			DataListItem item,
			object source,
			CommandEventArgs args)
			: base (args)
		{
			this.item = item;
			this.source = source;
		}
Exemple #32
0
 public static DataListItem[] GetDataNodesList()
 {
     if (DataClasses == null) { return null; }
     DataListItem[] templist;
     templist = new DataListItem[DataClasses.GetUpperBound(0) + 1];
     for (Int32 i = 0;i <= DataClasses.GetUpperBound(0); i++)
     {
         templist[i].Name = DataClasses[i].DataName;
         templist[i].DataNodeName = DataClasses[i].DataLabels;
     }
     return templist;
 }
 private Label GetShrinkControl(DataListItem flightItem)
 {
     return (Label)flightItem.FindControl("lb_hideSamePrice");
 }
Exemple #34
0
 private void Bind_Delivery_Time(DataListItem item, Label lbldishtype)
 {
     //SqlParameter[] p2 = new SqlParameter[1];
     //string dishtype = lbldishtype.Text;
     //p2[0] = new SqlParameter("@DishType", dishtype);
     //DataList DataListdeliverytime = (DataList)item.FindControl("DataListdeliverytime");
     //DataListdeliverytime.DataSource = con1.Select("SP_TimeSlotMaster_View", p2);
     //DataListdeliverytime.DataBind();
 }
Exemple #35
0
 private void Bind_Dish_Item(DataListItem item, DataList DataListdishitem)
 {
     //Label lblcartid = (Label)item.FindControl("lblcartid");
     //string cartid = lblcartid.Text;
     //SqlParameter[] p = new SqlParameter[1];
     //p[0] = new SqlParameter("@CartId", int.Parse(cartid));
     //DataListdishitem.DataSource = con1.Select("SP_ConsumerCartDishList_View", p);
     //DataListdishitem.DataBind();
 }
    private void CollapseFlightOfSameAirlinePrice(DataListItem currentItem)
    {
        AirMaterial preFlight = null;
        AirMaterial currentFlight = null;

        IList flightDataSource = (IList)(((PagedDataSource)dlAvailableFlight.DataSource).DataSource);

        //��ΪDataSource��һ����¼ʱ
        if (currentItem.ItemIndex == 0)
        {
            m_firstGroupIndex = currentItem.ItemIndex;

            //���õ�һ����ʽ
            //SetFirstGroupItemStyle(currentItem);
        }

        if (currentItem.ItemIndex > 0)
        {
            //ȡ�õ�ǰflight��֮ǰ��Flight
            currentFlight = (AirMaterial)flightDataSource[currentItem.ItemIndex];
            preFlight = (AirMaterial)flightDataSource[currentItem.ItemIndex - 1];

            //ѭ��,������չ�˾�ͼ۸�һ������Ҫ�����۵�����֮����ʾ��
            if (IsNeedCollapse(currentFlight, preFlight))
            {
                //�������ڷǵ�һ��֮��ʽ
                SetGroupItemStyleAfterFirst(currentItem);

            }

                //����һ��
            else
            {
                m_lastGroupIndex = currentItem.ItemIndex - 1;

                //������һ�����һ����ʽ����һ����ʽ
                SetGroupStyleAtGroupLastItem(currentItem);

                m_firstGroupIndex = currentItem.ItemIndex;

                //���õ�һ����ʽ
                //SetFirstGroupItemStyle(currentItem);
            }
        }

        //��ΪDataSource���һ����¼ʱ�����õ�ǰ����ʽ
        if (currentItem.ItemIndex == flightDataSource.Count - 1)
        {
            m_lastGroupIndex = currentItem.ItemIndex;

            //������һ�����һ����ʽ����һ����ʽ
            SetGroupStyleAtGroupLastItem(currentItem);
        }
    }
	// Constructors
	public DataListCommandEventArgs(DataListItem item, object commandSource, CommandEventArgs originalArgs) {}
    private void EditTaxTotalStyle(DataListItem dataListItem, AirMaterial flight)
    {
        //TaxTotal
        Label lblAdultTaxTotal = (Label)dataListItem.FindControl("lblAdultTaxTotal");
        Label lblChildTaxTotal = (Label)dataListItem.FindControl("lblChildTaxTotal");

        if (flight.AdultTax == 0)
        {
            lblAdultTaxTotal.Visible = false;
            lblChildTaxTotal.Visible = false;
        }
    }
    private void EditItemToSelectContactStyle(DataListItem dataListItem)
    {
        //DisplayMoney
        Label lblDisplayMoney = (Label)dataListItem.FindControl("lblDisplayMoney");
        lblDisplayMoney.Visible = false;

        //PerPerson
        Label lblPerPerson = (Label)dataListItem.FindControl("lblPerPerson");
        lblPerPerson.Visible = false;

        //TaxTotal
        Label lblAdultTaxTotal = (Label)dataListItem.FindControl("lblAdultTaxTotal");
        lblAdultTaxTotal.Visible = false;
        Label lblChildTaxTotal = (Label)dataListItem.FindControl("lblChildTaxTotal");
        lblChildTaxTotal.Visible = false;

        //imgAirline
        System.Web.UI.WebControls.Image AirImgRtn1 = (System.Web.UI.WebControls.Image)dataListItem.FindControl("AirImgRtn1");
        AirImgRtn1.Visible = false;
        System.Web.UI.WebControls.Image imgAirlineSelect = (System.Web.UI.WebControls.Image)dataListItem.FindControl("imgAirlineSelect");
        imgAirlineSelect.Visible = true;
        Label lblAirlineSpace = (Label)dataListItem.FindControl("lblAirlineSpace");
        lblAirlineSpace.Visible = true;
    }
    private DataListItem GetLowestSelectFareItem(DataListItem lastdataListItem)
    {
        System.Web.UI.WebControls.Label currentLblLowFareSelect = null;
        System.Web.UI.WebControls.Label lowestLblLowFareSelect = null;
        IList airMatrixDataSource = null;

        DataListItem lowestSelectFareItem = null;
        DataListItem currentItem = null;
        //AirMatrixFlightMeta currentAirMatrix = null;
        //AirMatrixFlightMeta lowestAirMatrix = null;
        decimal currentFare = 0;
        decimal lowestFare = 0;
        //System.Web.UI.WebControls.Label lblLowFareSelect = (System.Web.UI.WebControls.Label)e.Item.FindControl("lblLowFareSelect");

        lowestSelectFareItem = lastdataListItem;

        for (int itemIndex = 0; itemIndex < dlAirlineMatrics.Items.Count; itemIndex++)
        {
            currentItem = dlAirlineMatrics.Items[itemIndex];
            //currentAirMatrix = AirMatrixList[itemIndex];
            currentLblLowFareSelect = (System.Web.UI.WebControls.Label)currentItem.FindControl("lblLowFareSelect");

            if (lowestSelectFareItem == null)
            {
                lowestSelectFareItem = currentItem;
                //lowestAirMatrix = currentAirMatrix;
                lowestLblLowFareSelect = (System.Web.UI.WebControls.Label)lowestSelectFareItem.FindControl("lblLowFareSelect");
            }
            else
            {
                airMatrixDataSource = (IList)(((PagedDataSource)dlAirlineMatrics.DataSource).DataSource);

                if (((AirMatrixFlightMeta)(airMatrixDataSource)[currentItem.ItemIndex]).LowFareSelectPrice.BaseFare != 0)
                {
                    currentFare = ((AirMatrixFlightMeta)(airMatrixDataSource)[currentItem.ItemIndex]).LowFareSelectPrice.BaseFare;
                }
                if (((AirMatrixFlightMeta)(airMatrixDataSource)[lowestSelectFareItem.ItemIndex]).LowFareSelectPrice.BaseFare != 0)
                {
                    lowestFare = ((AirMatrixFlightMeta)(airMatrixDataSource)[lowestSelectFareItem.ItemIndex]).LowFareSelectPrice.BaseFare;
                }

                if (lowestFare == 0)
                {
                    lowestSelectFareItem = currentItem;
                }
                else
                {
                    if (currentFare > 0 && currentFare < lowestFare)
                    {
                        lowestSelectFareItem = currentItem;
                    }
                }
            }
        }

        return lowestSelectFareItem;
    }
 private Label GetExpansionControl(DataListItem flightItem)
 {
     return (Label)flightItem.FindControl("lb_showSamePrice");
 }
    private void SetFirstGroupItemStyle(DataListItem firstGroupItem)
    {
        Label btnExpansion = GetExpansionControl(firstGroupItem);
        Label btnShrink = GetShrinkControl(firstGroupItem);
        int groupCount = m_lastGroupIndex - m_firstGroupIndex;

        // register the new airline client click event for + (first Row)
        btnExpansion.Attributes.Add("onclick",
                 "ShowHidePart(" + m_firstGroupIndex
            + "," + groupCount + ",this)");

        //// register the new airline client click event for - (first Row)
        //btnShrink.Attributes.Add("onclick",
        //    "HidePart(" + 0
        //    + "," + fareAyList.Count
        //    + ",'" + airlineName + "')");

        btnExpansion.Style["display"] = "block";
        btnShrink.Style["display"] = "none";

        btnExpansion.Text = String.Format(btnExpansion.Text, groupCount);
    }
	// Constructors
	public DataListItemEventArgs(DataListItem item) {}
    private void SetFirstGroupItemStyleWhenJustOneRecordInGroup(DataListItem firstGroupItem)
    {
        //����Show��Hide����
        Label btnExpansion = GetExpansionControl(firstGroupItem);
        Label btnShrink = GetShrinkControl(firstGroupItem);

        btnExpansion.Style["display"] = "none";
        btnShrink.Style["display"] = "none";
    }
    private void SetGroupItemStyleAfterFirst(DataListItem currentItem)
    {
        //����Show��Hide����
        Label btnExpansion = GetExpansionControl(currentItem);
        Label btnShrink = GetShrinkControl(currentItem);
        Panel pnlWholeFlightItem = GetWholeFlightItemControl(currentItem);

        btnExpansion.Style["display"] = "none";
        btnShrink.Style["display"] = "block";

        pnlWholeFlightItem.Style["display"] = "none";
    }
    private void SetGroupStyleAtGroupLastItem(DataListItem currentItem)
    {
        //�������ֻ��һ����¼���õ�һ������ʽ
        if (m_lastGroupIndex == m_firstGroupIndex)
        {
            if (m_lastGroupIndex == currentItem.ItemIndex)
            {
                SetFirstGroupItemStyleWhenJustOneRecordInGroup(currentItem);
            }
            else
            {
                SetFirstGroupItemStyleWhenJustOneRecordInGroup(dlAvailableFlight.Items[m_firstGroupIndex]);
            }
        }
        else
        {
            //�������ڵ�һ����ʽ
            if (currentItem.ItemIndex == m_firstGroupIndex)
            {
                SetFirstGroupItemStyle(currentItem);
            }
            else
            {
                SetFirstGroupItemStyle(dlAvailableFlight.Items[m_firstGroupIndex]);
            }

            //�����������һ����ʽ
            if (currentItem.ItemIndex == m_lastGroupIndex)
            {
                SetLastGroupItemStyle(currentItem);
            }
            else
            {
                SetLastGroupItemStyle(dlAvailableFlight.Items[m_lastGroupIndex]);
            }
        }
    }
    private void SetLastGroupItemStyle(DataListItem lastGroupItem)
    {
        Label btnExpansion = GetExpansionControl(lastGroupItem);
        Label btnShrink = GetShrinkControl(lastGroupItem);
        Panel pnlWholeFlightItem = GetWholeFlightItemControl(lastGroupItem);
        int groupCount = m_lastGroupIndex - m_firstGroupIndex;

        btnShrink.Attributes.Add("onclick",
                "HidePart(" + m_firstGroupIndex
                + "," + groupCount + ",this)");
        // register the new airline client click event for - (first Row)

        for (int itemIndex = m_lastGroupIndex - groupCount + 1; itemIndex < m_lastGroupIndex; itemIndex++)
        {
            btnShrink = GetShrinkControl(dlAvailableFlight.Items[itemIndex]);

            btnShrink.Attributes.Add("onclick",
                "HidePart(" + m_firstGroupIndex
                + "," + groupCount + ",this)");
        }

        btnExpansion.Style["display"] = "none";
        btnShrink.Style["display"] = "block";

        pnlWholeFlightItem.Style["display"] = "none";
    }
    private void SetTotalDurationAndDistance(AirMaterial flight, DataListItem dataListItem)
    {
        System.Web.UI.WebControls.Label lblTotalDistance = (System.Web.UI.WebControls.Label)dataListItem.FindControl("lblTotalDistance");
        lblTotalDistance.Text = GetDistance(flight);

        System.Web.UI.WebControls.Label lblTotalDuration = (System.Web.UI.WebControls.Label)dataListItem.FindControl("lblTotalDuration");
        lblTotalDuration.Text = GetDuration(flight);

        System.Web.UI.WebControls.Label lblTotalDistanceMsg = (System.Web.UI.WebControls.Label)dataListItem.FindControl("lblTotalDistanceMsg");
        if (lblTotalDuration.Text.Trim() == string.Empty)
        {
            lblTotalDistanceMsg.Visible = false;
        }
    }
 private Panel GetWholeFlightItemControl(DataListItem flightItem)
 {
     return (Panel)flightItem.FindControl("pnlWholeFlightItem");
 }
Exemple #50
0
		public DataListItemEventArgs (DataListItem item)
		{
			this.item = item;
		}