Example #1
1
 protected void repLabelContent_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     B_LabelContent bll = new B_LabelContent();
     if(e.CommandName=="Delete")
     {
         Label lblLabelCategoryId = e.Item.FindControl("lblLabelCategoryId") as Label;
         bll.Delete(lblLabelCategoryId.Text.ToString());
     }
     if (e.CommandName == "DeleteAll")
     {
         string strLabelCategoryId = string.Empty;
         foreach (RepeaterItem rowview in repLabelContent.Items)
         {
             CheckBox _cb = rowview.FindControl("CheckBox1") as CheckBox;
             bool isChecked = _cb.Checked;
             Label lblid = rowview.FindControl("lblLabelCategoryId") as Label;
             if (isChecked)
             {
                 strLabelCategoryId +=  lblid.Text+ ",";
             }
         }
         if (strLabelCategoryId.EndsWith(","))
         {
             strLabelCategoryId = strLabelCategoryId.Substring(0, strLabelCategoryId.Length - 1);
         }
         if (strLabelCategoryId == string.Empty || strLabelCategoryId.Trim().Length == 0)
         {
             Function.ShowSysMsg(0, "<li>请选择要删除标签所对应的复选框</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
         }
         else
             bll.Delete(strLabelCategoryId.ToString());
     }
     StyleBind();
 }
Example #2
1
 protected void repStyleCategory_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     HiddenField hidden = (HiddenField)e.Item.FindControl("StyleCategoryId");
     B_StyleCategory bll = new B_StyleCategory();
     bll.Delete(int.Parse(hidden.Value.ToString()));
     StyleCategory(0);
 }
Example #3
1
    protected void insertFeedback(object sender, RepeaterCommandEventArgs e)
    {
        //finding all the textbox and radiobuttonlist control inside the repeater
        TextBox fname = (TextBox)e.Item.FindControl("txt_fname");
        TextBox lname = (TextBox)e.Item.FindControl("txt_lname");
        TextBox email = (TextBox)e.Item.FindControl("txt_email");
        TextBox phone = (TextBox)e.Item.FindControl("txt_phone");
        TextBox city = (TextBox)e.Item.FindControl("txt_city");
        TextBox state = (TextBox)e.Item.FindControl("txt_state");
        TextBox feedback = (TextBox)e.Item.FindControl("txt_feedback");
        RadioButtonList rblpatient = (RadioButtonList)e.Item.FindControl("r_isPatient");
        RadioButtonList rblgender = (RadioButtonList)e.Item.FindControl("r_gender");
        Label message = (Label)e.Item.FindControl("lbl_message");



        switch (e.CommandName)
        {
                //if commandname is insert,insert data intp feedback table and send email to person who submitted feedback
            case "Insert":
                _strMessage(obj.commitInsert(fname.Text, lname.Text, rblpatient.SelectedItem.Text, rblgender.SelectedItem.Text, city.Text, state.Text, phone.Text, email.Text, feedback.Text), "Thank you for the feedback");
                objSendMail.sendEMail(email.Text, "<div><br />" + "<br />Thank you for yor Feedback! <br/>"
                   + "' <br />We will reply as soon as possible", "(Blind River District Health Centre)", true);
                _subRebind();
                break;
            case "Cancel":
                _subRebind();
                break;
        }
    }
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if(e.CommandName=="View")
        {
            Response.Redirect("ViewVirtualMachineDetails.aspx?VmId=" + e.CommandArgument.ToString());
        }

        if (e.CommandName == "Start")
        {
            string VmId = e.CommandArgument.ToString();
            dataset = new DataSet();
            dataset = b_getdetailsby.GetPerticularVmDetailsByVmId(VmId);

            int Minit = Convert.ToInt32(dataset.Tables[0].Rows[0][9].ToString());
            if (Minit >= 1)
            {
                Response.Redirect("VirtualMachineActions.aspx?VmId=" + e.CommandArgument.ToString());
            }
            else
            {
                Response.Write("<script> alert('Buy More Credits To Start Virtual Machine'); </script>");
            }
        }

        if (e.CommandName == "Buy")
        {
            Response.Redirect("BuyCredits.aspx?VmId=" + e.CommandArgument.ToString());
        }

        if (e.CommandName == "Delete")
        {
            b_actions.DeleteVirtualMachine(Convert.ToInt32(e.CommandArgument.ToString()));
            LoadRepeater();
        }
    }
Example #5
0
 protected void conditionTable_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Show")
     {            
         //show data in reference table
         using (SqlConnection conn = new SqlConnection(connectionString))
         {
             string queryString = "SELECT * FROM [PAK.PAKRT_2D] WHERE DOC_SET_NUMBER='" + e.CommandArgument.ToString() + "'";
             queryString += " AND ISNULL(XSL_TEMPLATE_NAME,'')!=''";
             using (SqlDataAdapter adapter = new SqlDataAdapter(queryString, conn))
             {
                 conn.Open();
                 DataSet referenceSet = new DataSet();
                 adapter.Fill(referenceSet);
                 referenceTable.DataSource = referenceSet;
                 referenceTable.DataBind();
                 referenceTable.Visible = true;
                 btnPrintPDF.Visible = false;
                 btnViewPdf.Visible = false;
                 lblDocNum.Text = e.CommandArgument.ToString();
                 conn.Close();
                 Session.Clear();
             }
         }
     }
 }
    protected void rpNews_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        Label lblID = (Label)e.Item.FindControl("lblID");

        string strCommand = e.CommandName;
        int nID =ConvertData.ConvertToInt(lblID.Text);
        News objNews = new News();
        int nStatus = 0;
        switch (strCommand)
        {
            case "Delete":
                objNews.LoadById(nID);
                Support.DeleteFile("image", objNews.Data.Image);
                int nDelete = objNews.DeleteById(nID);

                BindDataToRepeater(1);
                break;

            case "Edit":
                 string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_NEWS_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
                Response.Redirect(sEdit);
                break;

            case "Active":
                nStatus = objNews.UpdateStatus(nID, Constants.STATUS_INACTIVE);

                BindDataToRepeater(1);
                break;
            case "Inactive":
                nStatus = objNews.UpdateStatus(nID, Constants.STATUS_ACTIVE);

                BindDataToRepeater(1);
                break;
        }
    }
    protected void RepCustomFormField_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());
            MCustomFormField = BCustomFormField.GetModel(FieldId);

            MCustomForm = BCustomForm.GetModel(CustomFormId);

            BCustomFormField.Del(FieldId);
            BModelField.DelField(MCustomForm.TableName, MCustomFormField.Name);

            DataList();
        }

        if (e.CommandName == "UpMove")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());

            BCustomFormField.MoveField(CustomFormId, FieldId, "UpMove");

            DataList();
        }

        if (e.CommandName == "DownMove")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());

            BCustomFormField.MoveField(CustomFormId, FieldId, "DownMove");

            DataList();
        }
    }
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         try
         {
             PageFacade facade = PageHelper.GetPageFacade(this.Page);
             string listId = e.CommandArgument.ToString();
             IList<HtmlItemInfo> listItem = facade.GetHtmlItemsByParent(listId);
             if (listItem.Count > 0)
             {
                 JavascriptAlert("此列表包含有子页面,请先删除列表下的全部子页面。");
                 return;
             }
             facade.DeleteList(listId);
             JavascriptAlertAndRedirect("删除列表成功!", "ListManagement.aspx");
         }
         catch (FacadeException ex)
         {
             JavascriptAlert(ex.Message);
         }
         catch
         {
             JavascriptAlert(@"删除列表发生未知错误,请联系系统配置人员!");
         }
     }
 }
Example #9
0
    protected void repCatalog_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int Id = int.Parse(e.CommandArgument.ToString());
        CatalogsEntity cat = CatalogsManager.CreateInstant().SelectOne(Id);
        switch (e.CommandName)
        {
            case "visiblehome":
                if (cat != null)
                {
                    cat.IsVisibleHome = !cat.IsVisibleHome;
                    CatalogsManager.CreateInstant().Update(cat);
                }
                break;
            case "order":
                TextBox txt = (TextBox)e.Item.FindControl("txtOrder");
                int order = 0;
                if (cat != null && txt != null && int.TryParse(txt.Text.Trim(), out order))
                {
                    CatalogsManager.CreateInstant().OrderInHome(cat.Id, order, cat.OrderIndex);
                }
                break;
        }

        Response.Redirect(Request.RawUrl);
    }
Example #10
0
    protected void rptSearchScenics_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "addscenic")
        {

            int scenicId = Convert.ToInt32(e.CommandArgument);
            //为联票创建一张门票
            DJ_TourEnterprise ent = bllEnt.GetOne(scenicId);
            //如果该拥有者已经有一张门票属于该套票 则不做任何操作
            if (CurrentTicket.TicketList.Where(x => x.Scenic.Id == scenicId).Count() > 0)
            {
                CommonLibrary.Notification.Show(this, "", "该套票已经包含此景区的门票,不需要创建", "");
            }
            else
            {
                TicketNormal t = new TicketNormal();
                t.BeginDate = DateTime.Today;
                t.EndDate = DateTime.MaxValue;
                t.IsMain = false;
                t.Lock = true;
                t.Name = CurrentTicket.Name + "-" + ent.Name;
                t.Scenic = ent;
                //获得主票的原价信息,赋值给自动创建的门票
                decimal originalPrice = 0;
                if (ent.Tickets.Count > 0)
                {

                    if (ent.Tickets.Where(x => x.IsMain).Count() > 0)
                    {
                        originalPrice = ent.Tickets.Where(x => x.IsMain).ToList()[0].GetPrice(PriceType.Normal);
                    }
                    else
                    {
                        originalPrice = ent.Tickets[0].GetPrice(PriceType.Normal);
                    }
                }
                IList<TicketPrice> tpList = new List<TicketPrice>();
                TicketPrice tp1 = new TicketPrice();
                tp1.Price = 0;
                tp1.PriceType = PriceType.PayOnline;

                TicketPrice tp2 = new TicketPrice();
                tp2.Price = 0;
                tp2.PriceType = PriceType.PreOrder;

                TicketPrice tp3 = new TicketPrice();
                tp3.Price = originalPrice;
                tp3.PriceType = PriceType.Normal;

                tpList.Add(tp1);
                tpList.Add(tp2);
                tpList.Add(tp3);
                t.TicketPrice = tpList;
                t.TicketUnion = CurrentTicket;
                bllTicket.SaveOrUpdateTicket(t);
            }

            BindTickets();
        }
    }
Example #11
0
    protected void subUpDel(object sender, RepeaterCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "Update":
                DropDownList ddl = (DropDownList)e.Item.FindControl("ddl_subjectU");

                TextBox txtSubjectID = (TextBox)e.Item.FindControl("txt_subjectidU");
                TextBox txtMenuName = (TextBox)e.Item.FindControl("txt_menunameU");
                TextBox txtTitle = (TextBox)e.Item.FindControl("txt_titleU");
                TextBox txtPageContent = (TextBox)e.Item.FindControl("txt_pagecontentU");
                HiddenField hdfID = (HiddenField)e.Item.FindControl("hdf_id");
                int pageID = int.Parse(hdfID.Value.ToString());

                string selected = ddl.SelectedValue.ToString();

                int selectedid = int.Parse(selected);

                _strMessage(objPage.commitUpdate(pageID, selectedid, txtMenuName.Text, txtTitle.Text, txtPageContent.Text), "update");

               // ddl.SelectedValue = pageID.ToString();
               // _strMessage(objPage.commitUpdate(pageID, int.Parse(txtSubjectID.Text.ToString()), txtMenuName.Text, txtTitle.Text, txtPageContent.Text), "update");
                _subRebind();
                break;
            case "Delete":
                int _id = int.Parse(((HiddenField)e.Item.FindControl("hdf_id")).Value);
                _strMessage(objPage.commitDelete(_id),"delete");
                    _subRebind();
                break;
            case "Cancel":
                _subRebind();
                break;
        }
    }
Example #12
0
 protected void subUpDel(object sender, RepeaterCommandEventArgs e)
 {
     switch (e.CommandName)
     {
         case "Update":
             TextBox txtTo = (TextBox)e.Item.FindControl("txtToU");
             TextBox txtFrom = (TextBox)e.Item.FindControl("txtFromU");
             TextBox txtBg = (TextBox)e.Item.FindControl("txtBgU");
             TextBox txtFont = (TextBox)e.Item.FindControl("txtFontU");
             TextBox txtFontS = (TextBox)e.Item.FindControl("txtFontSU");
             TextBox txtMsg = (TextBox)e.Item.FindControl("txtMsgU");
             HiddenField hdfID = (HiddenField)e.Item.FindControl("hdf_idU");
             int ecardID = int.Parse(hdfID.Value.ToString());
             _strMessage(objEcard.commitUpdate(ecardID, txtTo.Text, txtFrom.Text, txtBg.Text, txtFont.Text, txtFontS.Text, txtMsg.Text), "update");
             _subRebind();
             break;
         case "Delete":
             int _id = int.Parse(((HiddenField)e.Item.FindControl("hdf_idD")).Value);
             _strMessage(objEcard.commitDelete(_id), "delete");
             _subRebind();
             break;
         case "Cancel":
             _subRebind();
             break;
     }
 }
    protected void RpBanner_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int nID = ConvertData.ConvertToInt(e.CommandArgument);
        Banners objBanner = new Banners();
        switch (strCommand)
        {
            case "Delete":
                objBanner.LoadById(nID);
                Support.DeleteFile("banner", objBanner.Data.Images);
                int nDelete = objBanner.DeleteById(nID);
                BindDataToGrid(1);
                break;

            case "Edit":
                string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_BANNER_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
                Response.Redirect(sEdit);
                break;

            case "Active":
                int nActive = objBanner.UpdateStatus(nID, EnumeType.INACTIVE);

                BindDataToGrid(1);
                break;

            case "Inactive":
                int nInactive = objBanner.UpdateStatus(nID, EnumeType.ACTIVE);

                BindDataToGrid(1);
                break;

        }
    }
    protected void subdelete(RepeaterCommandEventArgs e)
    {
        Label lbl_idE = (Label)e.Item.FindControl("lbl_idE");
        sds_main.DeleteParameters["MenuId"].DefaultValue = lbl_idE.Text;
        sds_main.Delete();

    }
    protected void rptAsignList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "save")
        {
            Guid qzTaId = Guid.Parse((e.Item.FindControl("hfTaId") as HiddenField).Value);
            QZTicketAsign qzTa = bllqz.GetOne(qzTaId);
            Repeater rptPartnerList = e.Item.FindControl("rptPartnerList") as Repeater;
            int Amount = 0;
            foreach (RepeaterItem item in rptPartnerList.Items)
            {
                TextBox tbxAsignAmount = item.FindControl("tbxAsignAmount") as TextBox;
                if (tbxAsignAmount.Text == "")
                    tbxAsignAmount.Text = "0";

                DateTime dateTime = DateTime.Parse(Request.QueryString["date"]);
                Guid partnerId = Guid.Parse((item.FindControl("hfPartnerId") as HiddenField).Value);
                int ticketId = qzTa.Ticket.Id;
                QZPartnerTicketAsign qzpartnerTa = bllqzPartnerTa.GetOneByDateAndPartnerIdAndTicketId(dateTime, partnerId, ticketId);
                if (qzpartnerTa == null)
                    qzpartnerTa = new QZPartnerTicketAsign();
                qzpartnerTa.Partner = bllqzPartner.GetOne(partnerId);
                qzpartnerTa.AsignedAmount = int.Parse(tbxAsignAmount.Text);
                qzpartnerTa.QZTicketAsign = qzTa;
                bllqzPartnerTa.SaveOrUpdate(qzpartnerTa);
                Amount += int.Parse(tbxAsignAmount.Text);
            }

            qzTa.Amount = Amount;
            bllqz.SaveOrUpdate(qzTa);
            //这里需要征询袁飞
            ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "window.location=window.location", true);
        }
    }
    protected void GamesPlatform_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "detail")
        {
            Response.Redirect("~/Details.aspx?gid=" + (string)e.CommandArgument);
        }
         if (e.CommandName == "wish")
        {
          //  Response.Redirect("~/Wishlist.aspx?gid=" + (string)e.CommandArgument);
            if (Session["userid"] != null)
                wish.Add_To_Wishlist(Convert.ToInt16(Session["userid"]), Convert.ToInt16((string)e.CommandArgument));
            else
                Response.Redirect("~/Login.aspx");

        }

         if (e.CommandName == "cart")
         {

             if (Session["userid"] != null)
                 cart.Add_To_Cart(Convert.ToInt16(Session["userid"]), Convert.ToInt16((string)e.CommandArgument));
             else
                 Response.Redirect("~/Login.aspx");

             Response.Redirect("~/Cart.aspx");
         }
    }
Example #17
0
    protected void repPhotos_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        Guid Id = new Guid(e.CommandArgument.ToString());
        ProductPhotosEntity photo = ProductPhotosManager.CreateInstant().SelectOne(Id);
        if (photo != null)
        {
            switch (e.CommandName)
            {
                case "isvisible":
                    photo.IsVisible = !photo.IsVisible;
                    ProductPhotosManager.CreateInstant().Update(photo);
                    Refresh();
                    break;
                case "edit":
                    hidStatus.Value = "edit";
                    txtPhotoName.Text = photo.PhotoName;

                    btnAddPhoto.Visible = false;
                    btnEditPhoto.Visible = true;
                    btnCancel.Visible = true;
                    reqPhoto.Enabled = false;

                    hidId.Value = Id.ToString();
                    break;
                case "del":
                    ProductPhotosManager.CreateInstant().Delete(Id);
                    Refresh();
                    break;
            }
        }
    }
Example #18
0
    /// <summary>
    /// 删除单一记录
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            int id = int.Parse(e.CommandArgument.ToString());
            BSinglePage.Delete(id);

            DataBaseList();
        }

        if (e.CommandName == "Create")
        {
            B_Create bcreatebll = new B_Create();
            int id = int.Parse(e.CommandArgument.ToString());

            if (bcreatebll.CreateSinglePage(id))
            {
                Response.Redirect("../Msg.aspx?Flag=1&Code=" + Function.UrlEncode("<li>生成单页信息成功!</li><li><a href='info/SinglePageList.aspx'>返回单页列表</a></li>") + "");
                Response.End();
            }
            else
            {
                Response.Redirect("../Msg.aspx?Flag=0&Code=" + Function.UrlEncode("<li>生成单页信息失败!</li><li><a href='info/SinglePageList.aspx'>返回单页列表</a></li>") + "");
                Response.End();
            }
        }
    }
Example #19
0
    /// <summary>
    /// Når man klikker på en hest i topbaren
    /// </summary>
    /// <param name="source">topbar repeateren</param>
    /// <param name="e">Alt muligt info om eventet.
    /// Bl.a. e.CommandArgument, hvor vi har ID'et på hesten brugeren trykkede på.</param>
    protected void RepeaterTopBar_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        // asert Heste
        // TODO hvad hvis ikke heste? Men Ryttere eller ejere...

        // den hest der er klikket på
        int hesteId = Convert.ToInt32(e.CommandArgument);
        using (var ctx = new RideklubbenContext())
        {
            // hent den hest der er klikket på
            Hest hesten = ctx.Heste.Single(heste => heste.HesteId == hesteId);

            // Udskriv info om hesten (der er kun en, så jeg gider ikke en repeater).
            CenterImageNavn.Text = hesten.Navn;
            // udregn alder i år
            CenterImageAlder.Text = Math.Floor(((DateTime.Now - hesten.FødeDato).TotalDays / 365)).ToString() + " år";
            CenterIamgeOprindelse.Text = hesten.Fødestald;
            CenterImageImg.ImageUrl = hesten.BilledeSti;

            // HER BLIR DET SMART!
            // vi binder alle hestens ryttere til repeateren i venstre side.
            RepeaterLeftColumn.DataSource = hesten.Ryttere;
            RepeaterLeftColumn.DataBind();

        }
    }
Example #20
0
 protected void rptScenicAdmin_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "make")
     {
         int scid = int.Parse(e.CommandArgument.ToString());
         ScenicAdmin sa = new ScenicAdmin();
         sa.AdminType = ScenicAdminType.景区资料员 | ScenicAdminType.检票员 | ScenicAdminType.景区财务;
         sa.Scenic = bllScenic.GetScenicById(scid);
         if (!string.IsNullOrEmpty(sa.Scenic.SeoName))
         {
             string loginname = new MakeAccount().automakeaccount(sa.Scenic.SeoName);
             new BLL.BLLMembership().CreateUser("", "", "", "", loginname, "123456","");
             TourMembership tour = new BLL.BLLMembership().GetMember(loginname);
             sa.Membership = tour;
             bllscenicadmin.SaveOrUpdate(sa);
         }
     }
     if (e.CommandName == "reset")
     {
         int scid = int.Parse(e.CommandArgument.ToString());
         ScenicAdmin sa = bllscenicadmin.GetScenicAdminByScidandtype(scid, 7);
         sa.Membership.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5");
         bllscenicadmin.SaveOrUpdate(sa);
     }
     BindUsers();
 }
    public void Delete_Friend(Object sender, RepeaterCommandEventArgs e)
    {
        int ID;
        string UserName;
        string Email;

        if ((e.CommandName == "Declined"))
        {
            string[] commandArgsDelete = e.CommandArgument.ToString().Split(new char[] { ',' });
            ID = int.Parse(commandArgsDelete[0].ToString());
            UserName = commandArgsDelete[1].ToString();
            Email = commandArgsDelete[2].ToString();

            Blogic.DeleteUnApprovedFriends(UserIdentity.UserID, ID);

            SendEmailApprovedOrDeclinedNotification(Email, UserName, false);

            Response.Redirect("confirmfrienddelete.aspx?un=" + Server.HtmlEncode(UserName));
        }

        if ((e.CommandName == "Approved"))
        {
            string[] commandArgsApproved = e.CommandArgument.ToString().Split(new char[] { ',' });
            ID = int.Parse(commandArgsApproved[0].ToString());
            Email = commandArgsApproved[1].ToString();
            UserName = commandArgsApproved[2].ToString();

            Blogic.ApprovedAFriend(UserIdentity.UserID, ID);

            SendEmailApprovedOrDeclinedNotification(Email, UserName, true);

            Response.Redirect("myfriendslist.aspx");
        }
    }
    protected void RpStaticPage_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int IntpageID = ConvertData.ConvertToInt(e.CommandArgument);

        StaticPages objPage = new StaticPages();
        int nStatus = 0;
        switch (strCommand)
        {
            case "Edit":
                string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_STATICPAGE_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + IntpageID;
                Response.Redirect(sEdit);
                break;

            case "Delete":
                objPage.LoadById(IntpageID);
                string sDelImage = Support.DeleteFile("staticpage", ConvertData.ConvertToString(objPage.Data.Images));
                nStatus = objPage.DeleteById(IntpageID);

                BindData(1);
                break;

            case "Active":
                nStatus = objPage.UpdateStatus(IntpageID, Constants.STATUS_INACTIVE);

                BindData(1);
                break;
            case "Inactive":
                nStatus = objPage.UpdateStatus(IntpageID, Constants.STATUS_ACTIVE);

                BindData(1);
                break;
        }
    }
Example #23
0
 protected void rptTime_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "fp")
     {
         Guid actId = Guid.Parse(Request.QueryString["actId"]);
         TourActivity ta = bllTa.GetOne(actId);
         DateTime dt= DateTime.Parse(e.CommandArgument.ToString());
         foreach (var ticket in ta.Tickets)
         {
             foreach (var pa in ta.Partners)
             {
                 if (ta.GetActivityAssignForPartnerTicketDate(pa.PartnerCode, ticket.ProductCode, dt)==null)
                 {
                     ActivityTicketAssign ata = new ActivityTicketAssign();
                     ata.DateAssign = dt;
                     ata.Partner = pa;
                     ata.Ticket = ticket;
                     ata.TourActivity = ta;
                     bllAta.Save(ata);
                 }
             }
         }
         Response.Redirect("/manager/touractivity/ticketDetailAssign.aspx?actId=" + Request.QueryString["actId"]+"&dateTime="+dt);
     }
 }
Example #24
0
    //===============================================================
    // Function: imagesRepeater_ItemCommand
    //===============================================================
    protected void imagesRepeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        int eventID = int.Parse(Request.QueryString["EID"]);
        int eventPictureID = int.Parse(e.CommandArgument.ToString());

        if (e.CommandName == "deleteButton")
        {
            SedogoEvent sedogoEvent = new SedogoEvent((string)Session["loggedInUserFullName"], eventID);
            sedogoEvent.Update();

            SedogoEventPicture eventPic = new SedogoEventPicture((string)Application["connectionString"], eventPictureID);

            eventPic.Delete();

            Response.Redirect("editEventPics.aspx?EID=" + eventID.ToString());
        }
        if (e.CommandName == "saveButton")
        {
            SedogoEvent sedogoEvent = new SedogoEvent((string)Session["loggedInUserFullName"], eventID);
            sedogoEvent.Update();

            SedogoEventPicture eventPic = new SedogoEventPicture((string)Application["connectionString"], eventPictureID);

            TextBox imageCaptionTextBox = e.Item.FindControl("imageCaptionTextBox") as TextBox;
            eventPic.caption = imageCaptionTextBox.Text;
            eventPic.Update();

            Response.Redirect("editEventPics.aspx?EID=" + eventID.ToString());
        }
    }
Example #25
0
        protected void TEST_PAGINATE_Command(object sender, RepeaterCommandEventArgs e)
        {
            if (e == null) return;
            if (e.CommandName == null) return;
            if (!e.CommandName.Equals("PAGINATE")) return;
            if (e.CommandArgument == null) return;
            int n;
            if (!((Int32.TryParse((string)e.CommandArgument, out n)) || (e.CommandArgument.Equals("NEXT")) || (e.CommandArgument.Equals("FORM")) || (e.CommandArgument.Equals("FIRST")) || (e.CommandArgument.Equals("LAST")))) return;

            try
            {
                SCYS_REQUEST req = new SCYS_REQUEST();

                req.Fill("EXEC", "GET_PRESTATIONS_UNITE_SPEC");
                req.Fill("TYPE", "DB.PRESTATIONS_UNITE");
                req.Fill("RECORDS", 3);
                req.Fill("PAGE", e.CommandArgument);

                TEST_PAGINATE.DataSource = req;
                TEST_PAGINATE.DataBind<PRESTATIONS_UNITE, SCYS_PRESTClient>(SCYS_PREST);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Empty, ex);
            }
        }
Example #26
0
    protected void gv_RowCommand(object sender, RepeaterCommandEventArgs e)
    {
        string[] keys = e.CommandArgument.ToString().Split('|');
        int key = int.Parse(keys[0]);

        if (e.CommandName == "Del")
        {
            spclBll.DeleteComplete(key);
            BindData();
        }
        if (e.CommandName == "Restore")
        {
            int parentId = int.Parse(keys[1]);
            if (parentId != 0)
            {
                B_Special sBll = new B_Special();
                M_Special sModel = sBll.GetSpecial(parentId);
                if (sModel != null && sModel.IsDeleted)
                {
                    Function.ShowSysMsg(0, "<li>父专题尚未还原,请先还原父专题(ID=" + parentId + ").</li><li><a href='javascript:window.history.back(-1);'>返回上一步</a></li>");
                }
            }
            Bll.RestoreRecycle("", 3, key);
            BindData();
        }
    }
 protected void rDistanceLimits_Delete(object source, RepeaterCommandEventArgs e)
 {
     var d = DistanceLimits.OrderBy(x => x.Amount).ToList();
     d.RemoveAt(e.CommandArgument.ToString().TryParseInt());
     DistanceLimits = d;
     BindRepeater();
 }
Example #28
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "delete")
        {
            using (var db = new ItshowEntities2())
            {
                string workName = e.CommandArgument.ToString();
                var workRm = db.Display__works.SingleOrDefault(a => a.Name == workName);
                if (workRm == null)
                {
                    Response.Redirect("~/Backstage/Addadmin.aspx");
                }
                else
                {
                    db.Display__works.Remove(workRm);
                    int Vf = db.SaveChanges();
                    db.SaveChanges();
                    if (Vf == 1)
                    {

                        Response.Write("<script>alert('删除成功');</script>");
                        Response.Write("<script>location.reload()</script>");

                    }
                    else
                    {
                        Response.Write("<script>alert('删除失败');</script>");
                    }

                }
            }

        }
    }
Example #29
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "del")
        {
            using (var db = new CstwebEntities())
            {
                int id = Convert.ToInt32(e.CommandArgument);
                var le1 = db.lesrelation.Where(a => a.lesson == id).ToList();
                try
                {
                    db.lesrelation.Remove(le1[0]);
                    db.SaveChanges();
                }
                catch { }
                try
                {
                    db.lesrelation.Remove(le1[1]);
                    db.SaveChanges();
                }
                catch { }
                try
                {
                    db.lesrelation.Remove(le1[2]);
                    db.SaveChanges();
                }
                catch { }
                lesson les = db.lesson.FirstOrDefault(a => a.id == id);

                db.lesson.Remove(les);
                db.SaveChanges();
                Response.Write("<script>alert('删除成功');window.location = 'lessons.aspx';</script>");
            }
        }
    }
Example #30
0
    protected void RptFAQ_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int nID = ConvertData.ConvertToInt(e.CommandArgument);
        FAQs objFAQ = new FAQs();
        switch (strCommand)
        {
            case "Delete":
                int nDelete = objFAQ.DeleteById(nID);
                BindDataToGrid(1);
                break;

            case "Edit":
                string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_FAQ_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
                Response.Redirect(sEdit);
                break;

            case "Active":
                int nActive = objFAQ.UpdateStatus(nID, EnumeType.INACTIVE);

                BindDataToGrid(1);
                break;

            case "Inactive":
                int nInactive = objFAQ.UpdateStatus(nID, EnumeType.ACTIVE);

                BindDataToGrid(1);
                break;
        }
    }
Example #31
0
 /// <summary>
 /// The item command method for albums repeater. Redirects to the album page.
 /// </summary>
 /// <param name="source">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
 protected void Albums_ItemCommand([NotNull] object source, [NotNull] RepeaterCommandEventArgs e)
 {
     BuildLink.Redirect(ForumPages.EditAlbumImages, "a={0}", e.CommandArgument);
 }
Example #32
0
// <Snippet1>
    void R1_ItemCommand(Object Sender, RepeaterCommandEventArgs e)
    {
        Label2.Text = "The " + ((Button)e.CommandSource).Text + " button has just been clicked; <br>";
    }
Example #33
0
    protected void RPT_AdsList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "De")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            uasDal.DelteUserAds(id);
            Response.Redirect("UserAdsList.aspx");
        }
        if (e.CommandName == "Insert")
        {
            Guid        id   = new Guid(e.CommandArgument.ToString());
            UserAdsInfo info = uasDal.SelectUserAdsById(id);
            string      nick = "";
            if (Request.Cookies["nick"] != null)
            {
                nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
            }
            else
            {
                nick = Session["snick"].ToString();
            }
            IList <BuyInfo> buyList = CacheCollection.GetAllBuyInfo().Where(o => o.Nick == nick).ToList();
            bool            noads   = true;
            //投放的广告
            IList <UserAdsInfo> useradsList = uasDal.SelectAllUserAds(nick);

            //购买类型
            foreach (BuyInfo binfo in buyList)
            {
                //未过期的
                if (!binfo.IsExpied)
                {
                    //收费类型
                    FeeInfo feeInfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == binfo.FeeId).ToList()[0];

                    if (feeInfo.AdsCount > 0)
                    {
                        //已经投放了的该收费类型的广告集合
                        IList <UserAdsInfo> myUseradsList = useradsList.Where(o => o.FeeId == feeInfo.FeeId && o.UserAdsState == 1).ToList();

                        //真正可以添加的广告数量
                        int realcount = feeInfo.AdsCount - myUseradsList.Count;

                        if (realcount > 0)
                        {
                            if (feeInfo.AdsType == 5)
                            {
                                //这里需要查询空闲的广告(或者说是可以用的广告位)
                                IList <UserAdsInfo> usedadsList = uasDal.SelectAllUsedAds();
                                IList <AdsInfo>     allads      = CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 5).ToList();
                                if (allads.Count > usedadsList.Count)
                                {
                                    //得到没有使用的广告位
                                    IList <AdsInfo> hasads = new List <AdsInfo>();
                                    foreach (AdsInfo ainfo in allads)
                                    {
                                        if (usedadsList.Where(o => o.AdsId == ainfo.AdsId).ToList().Count == 0)
                                        {
                                            hasads.Add(ainfo);
                                        }
                                    }

                                    info.AddTime = DateTime.Now;
                                    info.AdsId   = GetRand(hasads);
                                    //不需要旺旺
                                    info.AliWang           = ""; //nick;
                                    info.FeeId             = binfo.FeeId;
                                    info.AdsShowStartTime  = DateTime.Now;
                                    info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                                    info.Nick         = nick;
                                    info.UserAdsState = 1;
                                    //不需要分类
                                    //string taoId = info.CateIds;
                                    info.CateIds = "";  // GetTaoBaoCId(taoId, ref taoId);
                                }
                                else
                                {
                                    Page.RegisterStartupScript("通知", "<script>alert('请联系我们的客服人员为您添加广告');</script>");
                                }
                                continue;
                            }

                            info.AddTime           = DateTime.Now;
                            info.AdsId             = info.AdsId == Guid.Empty ? GetRand(CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 1).ToList()) : info.AdsId;
                            info.AliWang           = nick;
                            info.FeeId             = binfo.FeeId;
                            info.AdsShowStartTime  = DateTime.Now;
                            info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                            info.Nick         = nick;
                            info.UserAdsState = 1;
                            string taoId = info.CateIds;
                            info.CateIds = GetTaoBaoCId(taoId, ref taoId);

                            info.Id = id;
                            uasDal.UpdateUserAdsState(info);
                            //
                            noads = false;

                            break;
                        }
                    }
                }
            }

            if (noads)
            {
                Response.Redirect("/Better.aspx");
            }
            else
            {
                Response.Redirect("UserAdsList.aspx?istou=1");
            }
        }
        if (e.CommandName == "Result")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            Response.Redirect("ShowClick.aspx?id=" + id);
        }
        if (e.CommandName == "See")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            Response.Redirect("ShowAds.aspx?adsid=" + id);
        }
        if (e.CommandName == "Stop")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            uasDal.StopUserAds(2, id);
            Response.Redirect("UserAdsList.aspx");
        }
        if (e.CommandName == "UpSite")
        {
            Guid            id     = new Guid(e.CommandArgument.ToString());
            IList <AdsInfo> allads = CacheCollection.GetAllAdsInfo();

            IList <AdsInfo> newlist = new List <AdsInfo>(allads);
            int             index   = 0;
            for (int i = 0; i < newlist.Count; i++)
            {
                if (newlist[i].AdsId == id)
                {
                    index = i;
                    break;
                }
            }
            newlist.RemoveAt(index);
            Guid adsId = GetRand(newlist);
            uasDal.UpdateAdsSite(id, adsId);
            Response.Redirect("UserAdsList.aspx?istou=1");
        }
    }
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel("articleinfo", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.article   bll   = new BLL.article();
            Model.article model = bll.GetModel(id);
            switch (e.CommandName)
            {
            case "lbtnIsMsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateField(id, "is_msg=1");
                }
                break;

            case "lbtnIsTop":
                if (model.is_top == 1)
                {
                    bll.UpdateField(id, "is_top=0");
                }
                else
                {
                    bll.UpdateField(id, "is_top=1");
                }
                break;

            case "lbtnIsRed":
                if (model.is_red == 1)
                {
                    bll.UpdateField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateField(id, "is_red=1");
                }
                break;

            case "lbtnIsHot":
                if (model.is_hot == 1)
                {
                    bll.UpdateField(id, "is_hot=0");
                }
                else
                {
                    bll.UpdateField(id, "is_hot=1");
                }
                break;

            case "lbtnIsSlide":
                if (model.is_slide == 1)
                {
                    bll.UpdateField(id, "is_slide=0");
                }
                else
                {
                    bll.UpdateField(id, "is_slide=1");
                }
                break;
            }
            this.RptBind(this.channel_id, this.category_id, "id>0" + CombSqlTxt(this.keywords, this.property), "sort_id asc,add_time desc,id desc");
        }
Example #35
0
    protected void rpFixamount_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "FixAmount")
        {
            if ((e.Item.ItemType == ListItemType.Item) || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label   lblfixamount = (Label)e.Item.FindControl("lblFixamount");
                TextBox txtamount    = (TextBox)e.Item.FindControl("txtAmounts");
                if (txtamount.Text == "")
                {
                    lblMessage.ForeColor = Color.Red;
                    lblMessage.Text      = "Enter the new value of add amout.";
                    return;
                }
                Label   lblwalletamount = (Label)e.Item.FindControl("lblWalletamt");
                decimal walletblce      = 0;
                if (lblwalletamount.Text != "0")
                {
                    walletblce = Convert.ToDecimal(lblwalletamount.Text);
                }
                decimal fixamount = 0;
                if (lblfixamount.Text != "")
                {
                    fixamount = Convert.ToDecimal(lblfixamount.Text);
                }
                decimal addedamount   = Convert.ToDecimal(txtamount.Text);
                decimal fixamounts    = fixamount + addedamount;
                string  useridetifyno = GetUserIdentifyNo(Convert.ToString(Session["userid"]));
                Int32   userid        = Convert.ToInt32(Session["userid"]);
                decimal percent       = getPercetage();
                int     result        = 0;

                if (walletblce != 0)
                {
                    try
                    {
                        if (local_wallet.IsFixExists(userid) == "T")
                        {
                            result = local_wallet.AddNewFixAmount(fixamounts, addedamount, useridetifyno, userid, percent);
                            local_wallet.UpdateCustomerWalletFundtransfer(addedamount, userid);
                            if (result != 0)
                            {
                                string user = Convert.ToString(Session["userid"]);
                                BindFixAmountDetail(user);
                                BindToFixAmount(user);
                                mpe.Show();
                                lblpopup.Text = "Your amount added to fixed amount.";
                                //lblMessage.ForeColor = Color.Green;
                                //lblMessage.Text = "Your amount added to fixed amount.";
                            }
                        }
                        else
                        {
                            string monthcount = "Month Begin";
                            result = local_wallet.AddNewFixAmountFirst(fixamounts, addedamount, useridetifyno, monthcount, userid, percent);
                            local_wallet.UpdateCustomerWalletFundtransfer(addedamount, userid);
                            if (result != 0)
                            {
                                string user = Convert.ToString(Session["userid"]);
                                BindFixAmountDetail(user);
                                BindToFixAmount(user);
                                mpe.Show();
                                lblpopup.Text = "Your amount added to fixed amount.";
                                //lblMessage.ForeColor = Color.Green;
                                //lblMessage.Text = "Your amount added to fixed amount.";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        lblMessage.ForeColor = Color.Red;
                        lblMessage.Text      = ex.Message;
                    }
                }
                else
                {
                    mpe.Show();
                    lblpopup.Text = "You haven't enough wallet balance to fix amount.";
                    //lblMessage.ForeColor = Color.Red;
                    //lblMessage.Text = "You haven't enough wallet balance to fix amount.";
                }
            }
        }

        if (e.CommandName == "DetachAmount")
        {
            if ((e.Item.ItemType == ListItemType.Item) || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label   lblfixamount    = (Label)e.Item.FindControl("lblFixamount");
                TextBox txtamount       = (TextBox)e.Item.FindControl("txtAmounts");
                Label   lblwalletamount = (Label)e.Item.FindControl("lblWalletamt");
                if (txtamount.Text == "")
                {
                    lblMessage.ForeColor = Color.Red;
                    lblMessage.Text      = "Enter the new value of deduct amount.";
                    return;
                }
                decimal walletblce = 0;
                if (lblwalletamount.Text != "0.00")
                {
                    walletblce = Convert.ToDecimal(lblwalletamount.Text);
                }
                decimal fixamount = 0;
                if (lblfixamount.Text != "")
                {
                    fixamount = Convert.ToDecimal(lblfixamount.Text);
                }
                decimal deductamount = Convert.ToDecimal(txtamount.Text);

                string  useridetifyno = GetUserIdentifyNo(Convert.ToString(Session["userid"]));
                Int32   userid        = Convert.ToInt32(Session["userid"]);
                decimal percent       = getPercetage();

                int result = 0;
                try
                {
                    if (local_wallet.IsFixExists(userid) == "T")
                    {
                        if (fixamount >= deductamount)
                        {
                            fixamount = fixamount - deductamount;

                            result = local_wallet.DeductNewFixAmount(fixamount, deductamount, useridetifyno, userid, percent);
                            local_wallet.UpdateCustomerWalletDeductAdd(deductamount, userid);
                            if (result != 0)
                            {
                                string user = Convert.ToString(Session["userid"]);
                                BindFixAmountDetail(user);
                                BindToFixAmount(user);
                                mpe.Show();
                                lblpopup.Text = "Amount detached from fixed amount.";
                                //lblMessage.ForeColor = Color.Green;
                                //lblMessage.Text = "Amount detached from fixed amount.";
                            }
                        }
                        else
                        {
                            mpe.Show();
                            lblpopup.Text = "You have not enough fixed amount to deduct.";
                            //lblMessage.ForeColor = Color.Red;
                            //lblMessage.Text = "You have not enough fixed amount to deduct.";
                        }
                    }
                    else
                    {
                        mpe.Show();
                        lblpopup.Text = "You haven't fixed amount to detach.";
                        //lblMessage.ForeColor = Color.Red;
                        //lblMessage.Text = "You haven't fixed amount to detach.";
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.ForeColor = Color.Red;
                    lblMessage.Text      = ex.Message;
                }
            }
        }
    }
Example #36
0
 private void rp_promogift_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     this.ItemCommand(source, e);
 }
Example #37
0
    protected void news_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "reply")
        {
            Repeater RptReply  = (Repeater)e.Item.FindControl("reply2");
            Button   btnPost   = (Button)e.Item.FindControl("btnPost");
            TextBox  replyText = (TextBox)e.Item.FindControl("replyText");
            string   id        = Convert.ToString(e.CommandArgument.ToString());

            string type  = user.operate(0, 0, "select type from news where id=?", id);
            string which = user.operate(0, 0, "select which from news where id =?", id);
            RptReply.DataSource = user.getData("select * from replyView where type='" + type + "' and towhich=" + which);
            RptReply.DataBind();
            RptReply.Visible  = !RptReply.Visible;
            btnPost.Visible   = !btnPost.Visible;
            replyText.Visible = !replyText.Visible;
        }
        else if (e.CommandName == "btnPost")
        {
            TextBox reply = (TextBox)e.Item.FindControl("replyText");
            if (reply.Text != "")
            {
                string id        = Convert.ToString(e.CommandArgument.ToString());
                string type      = user.operate(0, 0, "select type from news where id=?", id);
                string which     = user.operate(0, 0, "select which from news where id =?", id);
                string time      = DateTime.Now.ToString();
                string userLogin = Convert.ToString(Session["name"]);
                user.operate(-1, 0, "insert into reply (type,time,whose,text,towhich) values(?,?,?,?,?)", type, time, userLogin, Server.HtmlEncode(reply.Text), which);
                Response.Write("<script language=javascript>alert('评论成功');window.location = 'homePage.aspx?id='" + Convert.ToString(Session["name"]) + ";</script>");
            }
            else
            {
                Response.Write("<script>alert('评论内容不能为空!')</script>");
            }
        }
        else if (e.CommandName == "nickname")
        {
            string type   = user.operate(0, 0, "select type from news where id=?", e.CommandArgument.ToString());
            string userid = user.operate(0, 0, "Select whose from news where id=?", e.CommandArgument.ToString());
            Response.Redirect(type + "Page.aspx?id=" + userid);
        }
        else if (e.CommandName == "watch")
        {
            string type   = user.operate(0, 0, "select type from news where id=?", e.CommandArgument.ToString());
            string userid = user.operate(0, 0, "Select whose from news where id=?", e.CommandArgument.ToString());
            Response.Redirect(type + "Page.aspx?id=" + userid + "&which=" + user.operate(0, 0, "select which from news where id =?", e.CommandArgument.ToString()));
        }
        else if (e.CommandName == "good")
        {
            string userLogin = Convert.ToString(Session["name"]);
            string id        = e.CommandArgument.ToString();
            string which     = user.operate(0, 0, "select which from news where id =?", id);
            string type      = user.operate(0, 0, "select type from news where id = ?", id);
            int    num       = Convert.ToInt32(user.operate(0, 0, "select num from thumbsup where which=? and type=?", which, type));
            string whoid     = user.operate(0, 0, "select whoid from thumbsup where which=? and type=?", which, type);
            string whoname   = user.operate(0, 0, "select whonickname from thumbsup where which=? and type=?", which, type);
            num++;
            whoid   = whoid + "," + userLogin + ",";
            whoname = whoname + " " + user.operate(0, 0, "select nickname from users where id = ?", userLogin) + " ";
            user.operate(-1, 0, "update thumbsup set num=?,whoid=?,whonickname=? where which = ? and type=?", num, whoid, whoname, which, type);
            Response.Redirect(Request.RawUrl);
        }
        else if (e.CommandName == "nogood")
        {
            string userLogin = Convert.ToString(Session["name"]);
            string id        = e.CommandArgument.ToString();
            string which     = user.operate(0, 0, "select which from news where id =?", id);
            string type      = user.operate(0, 0, "select type from news where id = ?", id);
            int    num       = Convert.ToInt32(user.operate(0, 0, "select num from thumbsup where which=? and type=?", which, type));
            string whoid     = user.operate(0, 0, "select whoid from thumbsup where which=? and type=?", which, type);
            string whoname   = user.operate(0, 0, "select whonickname from thumbsup where which=? and type=?", which, type);
            num--;
            whoid   = System.Text.RegularExpressions.Regex.Replace(whoid, "," + userLogin + ",", "");
            whoname = System.Text.RegularExpressions.Regex.Replace(whoname, " " + user.operate(0, 0, "select nickname from users where id = ?", userLogin) + " ", "");
            user.operate(-1, 0, "update thumbsup set num=?,whoid=?,whonickname=? where which = ? and type=?", num, whoid, whoname, which, type);
            Response.Redirect(Request.RawUrl);
        }
    }
 protected void rptQuangCao_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
 }
Example #39
0
        /// <summary>
        /// Handles the ItemCommand event of the rptNcoaResults control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterCommandEventArgs"/> instance containing the event data.</param>
        protected void rptNcoaResults_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            var ncoaHistoryId = e.CommandArgument.ToStringSafe().AsIntegerOrNull();

            if (!ncoaHistoryId.HasValue)
            {
                return;
            }

            if (e.CommandName == "MarkAddressAsPrevious")
            {
                using (var rockContext = new RockContext())
                {
                    var ncoaHistory = new NcoaHistoryService(rockContext).Get(ncoaHistoryId.Value);
                    if (ncoaHistory != null)
                    {
                        var groupService         = new GroupService(rockContext);
                        var groupLocationService = new GroupLocationService(rockContext);

                        var changes = new History.HistoryChangeList();

                        Ncoa ncoa                  = new Ncoa();
                        var  previousValue         = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_PREVIOUS.AsGuid());
                        int? previousValueId       = previousValue == null ? ( int? )null : previousValue.Id;
                        var  previousGroupLocation = ncoa.MarkAsPreviousLocation(ncoaHistory, groupLocationService, previousValueId, changes);
                        if (previousGroupLocation != null)
                        {
                            ncoaHistory.Processed = Processed.Complete;

                            // If there were any changes, write to history
                            if (changes.Any())
                            {
                                var family = groupService.Get(ncoaHistory.FamilyId);
                                if (family != null)
                                {
                                    foreach (var fm in family.Members)
                                    {
                                        HistoryService.SaveChanges(
                                            rockContext,
                                            typeof(Person),
                                            Rock.SystemGuid.Category.HISTORY_PERSON_FAMILY_CHANGES.AsGuid(),
                                            fm.PersonId,
                                            changes,
                                            family.Name,
                                            typeof(Group),
                                            family.Id,
                                            false);
                                    }
                                }
                            }
                        }
                    }

                    rockContext.SaveChanges();
                }
            }
            else if (e.CommandName == "MarkProcessed")
            {
                using (RockContext rockContext = new RockContext())
                {
                    var ncoa = (new NcoaHistoryService(rockContext)).Get(ncoaHistoryId.Value);
                    ncoa.Processed = Processed.Complete;
                    rockContext.SaveChanges();
                }
            }

            NcoaResults_BlockUpdated(null, null);
        }
Example #40
0
 protected void ModeratorList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //AddLoadMessage("TODO: Fix this");
     //TODO: Show moderators
 }
Example #41
0
        protected void rptr_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (Page.IsValid)
            {
                if (e.CommandName == "save")
                {
                    var      p = Patron.FetchObject(((Patron)Session["Patron"]).PID);
                    DateTime _d;

                    var DOB = e.Item.FindControl("DOB") as TextBox;
                    if (DOB != null && !string.IsNullOrEmpty(DOB.Text))
                    {
                        if (DateTime.TryParse(DOB.Text, out _d))
                        {
                            p.DOB = _d;
                        }
                    }

                    p.Age = FormatHelper.SafeToInt(((TextBox)(e.Item).FindControl("Age")).Text);
                    //p.Custom2 = (((TextBox)(e.Item).FindControl("Custom2")).Text);

                    p.SchoolGrade    = ((TextBox)(e.Item).FindControl("SchoolGrade")).Text;
                    p.FirstName      = ((TextBox)(e.Item).FindControl("FirstName")).Text;
                    p.MiddleName     = ((TextBox)(e.Item).FindControl("MiddleName")).Text;
                    p.LastName       = ((TextBox)(e.Item).FindControl("LastName")).Text;
                    p.Gender         = ((DropDownList)(e.Item).FindControl("Gender")).SelectedValue;
                    p.EmailAddress   = ((TextBox)(e.Item).FindControl("EmailAddress")).Text;
                    p.PhoneNumber    = ((TextBox)(e.Item).FindControl("PhoneNumber")).Text;
                    p.PhoneNumber    = FormatHelper.FormatPhoneNumber(p.PhoneNumber);
                    p.StreetAddress1 = ((TextBox)(e.Item).FindControl("StreetAddress1")).Text;
                    p.StreetAddress2 = ((TextBox)(e.Item).FindControl("StreetAddress2")).Text;
                    p.City           = ((TextBox)(e.Item).FindControl("City")).Text;
                    p.State          = ((TextBox)(e.Item).FindControl("State")).Text;
                    p.ZipCode        = ((TextBox)(e.Item).FindControl("ZipCode")).Text;
                    p.ZipCode        = FormatHelper.FormatZipCode(p.ZipCode);

                    p.Country = ((TextBox)(e.Item).FindControl("Country")).Text;
                    p.County  = ((TextBox)(e.Item).FindControl("County")).Text;
                    p.ParentGuardianFirstName  = ((TextBox)(e.Item).FindControl("ParentGuardianFirstName")).Text;
                    p.ParentGuardianLastName   = ((TextBox)(e.Item).FindControl("ParentGuardianLastName")).Text;
                    p.ParentGuardianMiddleName = ((TextBox)(e.Item).FindControl("ParentGuardianMiddleName")).Text;
                    p.LibraryCard = ((TextBox)(e.Item).FindControl("LibraryCard")).Text;

                    //p.PrimaryLibrary = FormatHelper.SafeToInt(((DropDownList)(e.Item).FindControl("PrimaryLibrary")).SelectedValue);
                    //p.SchoolName = ((DropDownList)(e.Item).FindControl("SchoolName")).SelectedValue;
                    //p.SchoolType = FormatHelper.SafeToInt(((DropDownList)(e.Item).FindControl("SchoolType")).SelectedValue);

                    //p.District = ((DropDownList)(e.Item).FindControl("District")).SelectedValue;
                    //p.SDistrict = ((DropDownList)(e.Item).FindControl("SDistrict")).SelectedValue.SafeToInt();

                    p.PrimaryLibrary = FormatHelper.SafeToInt(((DropDownList)(e.Item).FindControl("PrimaryLibrary")).SelectedValue);
                    p.SchoolName     = ((DropDownList)(e.Item).FindControl("SchoolName")).SelectedValue;
                    p.SchoolType     = FormatHelper.SafeToInt(((DropDownList)(e.Item).FindControl("SchoolType")).SelectedValue);

                    var lc = LibraryCrosswalk.FetchObjectByLibraryID(p.PrimaryLibrary);
                    if (lc != null)
                    {
                        p.District = lc.DistrictID == 0 ? ((DropDownList)(e.Item).FindControl("District")).SelectedValue : lc.DistrictID.ToString();
                    }
                    else
                    {
                        p.District = ((DropDownList)(e.Item).FindControl("District")).SelectedValue;
                    }
                    var sc = SchoolCrosswalk.FetchObjectBySchoolID(p.SchoolName.SafeToInt());
                    if (sc != null)
                    {
                        p.SDistrict  = sc.DistrictID == 0 ? ((DropDownList)(e.Item).FindControl("SDistrict")).SelectedValue.SafeToInt() : sc.DistrictID;
                        p.SchoolType = sc.SchTypeID == 0 ? FormatHelper.SafeToInt(((DropDownList)(e.Item).FindControl("SchoolType")).SelectedValue) : sc.SchTypeID;
                    }
                    else
                    {
                        p.SDistrict = ((DropDownList)(e.Item).FindControl("SDistrict")).SelectedValue.SafeToInt();
                    }


                    p.Teacher        = ((TextBox)(e.Item).FindControl("Teacher")).Text;
                    p.GroupTeamName  = ((TextBox)(e.Item).FindControl("GroupTeamName")).Text;
                    p.LiteracyLevel1 = FormatHelper.SafeToInt(((TextBox)(e.Item).FindControl("LiteracyLevel1")).Text);
                    p.LiteracyLevel2 = FormatHelper.SafeToInt(((TextBox)(e.Item).FindControl("LiteracyLevel2")).Text);

                    p.Custom1 = string.IsNullOrEmpty(this.CustomFields.DDValues1)
                        ? ((TextBox)(e.Item).FindControl("Custom1")).Text
                        : ((DropDownList)(e.Item).FindControl("Custom1DD")).SelectedValue;
                    p.Custom2 = string.IsNullOrEmpty(this.CustomFields.DDValues2)
                        ? ((TextBox)(e.Item).FindControl("Custom2")).Text
                        : ((DropDownList)(e.Item).FindControl("Custom2DD")).SelectedValue;
                    p.Custom3 = string.IsNullOrEmpty(this.CustomFields.DDValues3)
                        ? ((TextBox)(e.Item).FindControl("Custom3")).Text
                        : ((DropDownList)(e.Item).FindControl("Custom3DD")).SelectedValue;
                    p.Custom4 = string.IsNullOrEmpty(this.CustomFields.DDValues4)
                        ? ((TextBox)(e.Item).FindControl("Custom4")).Text
                        : ((DropDownList)(e.Item).FindControl("Custom4DD")).SelectedValue;
                    p.Custom5 = string.IsNullOrEmpty(this.CustomFields.DDValues5)
                        ? ((TextBox)(e.Item).FindControl("Custom5")).Text
                        : ((DropDownList)(e.Item).FindControl("Custom5DD")).SelectedValue;

                    //p.AvatarID = FormatHelper.SafeToInt(((DropDownList)(e.Item).FindControl("AvatarID")).SelectedValue);
                    p.AvatarID = FormatHelper.SafeToInt(((System.Web.UI.HtmlControls.HtmlInputText)e.Item.FindControl("AvatarID")).Value);
                    // do the save
                    p.Update();
                    Session["Patron"] = p;

                    rptr.DataSource = Patron.GetPatronForEdit(p.PID);
                    rptr.DataBind();

                    ((BaseSRPPage)Page).TranslateStrings(rptr);

                    Session[SessionKey.PatronMessage]          = "Your account information has been updated!";
                    Session[SessionKey.PatronMessageGlyphicon] = "check";
                }
            }
        }
Example #42
0
 protected void rptPaging_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
     fillData();
 }
Example #43
0
 protected void rp_mn_users_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
 }
Example #44
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();
                        info2.NoteId   = Globals.GetGenerateId();
                        info2.OrderId  = e.CommandArgument.ToString();
                        info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                        info2.Remark   = "后台" + info2.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo, wid);
                            foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                            {
                                if (info4.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, info4.SkuId, 5);
                                }
                            }
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = DateTime.Today;
                            }
                            this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                            this.myNotifier.UpdateDB();
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Example #45
0
 protected void reply2_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
 }
 protected void RepPopPost_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     HiddenField hdnCommentID = (HiddenField)e.Item.FindControl("hdnCommentID");
 }
    //删除按钮
    protected void List_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        using (TransactionScope ts = new TransactionScope())
        {
            CardInfo card = new CardInfo();
            UserInfo user = user_bll.GetUserByUserId(userId);

            int     zzId     = Convert.ToInt32(e.CommandArgument);
            decimal newMoney = Convert.ToDecimal(((HiddenField)e.Item.FindControl("ZhangMoneyHid")).Value);
            int     toCardId = Convert.ToInt32(((HiddenField)e.Item.FindControl("ZhangFromHid")).Value);
            int     cardId   = Convert.ToInt32(((HiddenField)e.Item.FindControl("ZhangToHid")).Value);

            if (cardId == 0)
            {
                if (user.IsUpdate == 1)
                {
                    user.MoneyStart = user.MoneyStart - newMoney;
                }
                else
                {
                    user.UserMoney = user.UserMoney - newMoney;
                }
                user.ModifyDate  = DateTime.Now;
                user.Synchronize = 1;

                user_bll.UpdateUser(user);
            }
            else
            {
                card = card_bll.GetCardByCardId(userId, cardId);
                if (user.IsUpdate == 1)
                {
                    card.MoneyStart = card.MoneyStart - newMoney;
                }
                else
                {
                    card.CardMoney = card.CardMoney - newMoney;
                }
                card.ModifyDate  = DateTime.Now;
                card.Synchronize = 1;

                card_bll.UpdateCard(card);
            }

            if (toCardId == 0)
            {
                if (user.IsUpdate == 1)
                {
                    user.MoneyStart = user.MoneyStart + newMoney;
                }
                else
                {
                    user.UserMoney = user.UserMoney + newMoney;
                }
                user.ModifyDate  = DateTime.Now;
                user.Synchronize = 1;

                user_bll.UpdateUser(user);
            }
            else
            {
                card = card_bll.GetCardByCardId(userId, toCardId);
                if (user.IsUpdate == 1)
                {
                    card.MoneyStart = card.MoneyStart + newMoney;
                }
                else
                {
                    card.CardMoney = card.CardMoney + newMoney;
                }
                card.ModifyDate  = DateTime.Now;
                card.Synchronize = 1;

                card_bll.UpdateCard(card);
            }

            ZhuanZhangInfo zzInfo = bll.GetZhuanZhangByZZID(userId, zzId);
            zzInfo.Synchronize    = 1;
            zzInfo.ZhuanZhangLive = 0;
            zzInfo.ModifyDate     = DateTime.Now;

            bool success = bll.UpdateZhuanZhang(zzInfo);
            if (!success)
            {
                Utility.Alert(this, "转账删除失败!");
            }

            ts.Complete();
        }

        Response.Redirect("UserZhuanZhangDetail.aspx");
    }
        //public void rptOrderDetailsBind(Guid OrderID)
        //{

        //    using (MashadCarpetEntities db = new MashadCarpetEntities())
        //    {



        //        var m = (from u in db.OrderDetails
        //                 join i in db.Rel_Product_Color_Size
        //                     on u.fk_Rel_Product_Color_size_ID equals i.Rel_Product_Color_Size_ID
        //                 join p in db.Products on i.fk_ProductID equals p.ProductID
        //                 join c in db.Colors on i.fk_ColorID equals c.ColorID
        //                 join s in db.SIzes on i.fk_SizeID equals s.SizeID
        //                 where u.fk_OrderID == OrderID && i.IsDelete == false && u.IsDelete == false && p.IsDelete == false
        //                 select new
        //                 {
        //                     p.ProductTitle,
        //                     i.ProductImage,
        //                     u.Count,
        //                     i.ProductPrice,
        //                     p.ProductID,
        //                     u.OrderDetailID,
        //                     c.ColorTitle,
        //                     s.SizeTitle,
        //                     p.ProductName
        //                 }).ToList();

        //        rptOrderDetails.DataSource = m;
        //        rptOrderDetails.DataBind();



        //    }
        //    if (pnlOrderDetails.Visible == false)
        //        pnlOrderDetails.Visible = true;
        //    else
        //        pnlOrderDetails.Visible = false;
        //}

        protected void rptOrders_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "factorDetail")
            {
                Guid OrderID = new Guid(e.CommandArgument.ToString());

                //HtmlTableRow tr = (HtmlTableRow)e.Item.FindControl("row");
                //tr.Attributes.Add("style", "background-color:#999999;color:#FFFFFF;");

                Panel    pnlOrderDetails = e.Item.FindControl("pnlOrderDetails") as Panel;
                Repeater rptOrderDetails = e.Item.FindControl("rptOrderDetails") as Repeater;

                using (MashadCarpetEntities db = new MashadCarpetEntities())
                {
                    var m = (from u in db.OrderDetails
                             join i in db.ProductColorSizes
                             on u.fk_ProductColorSizeID equals i.ProductColorSizeID
                             join aa in db.ProductColors on i.fk_ProductColorID equals aa.ProductColorID
                             join p in db.Products on aa.fk_ProductID equals p.ProductID
                             join c in db.Colors on aa.fk_ColorID equals c.ColorID
                             join s in db.SIzes on i.fk_SizeID equals s.SizeID
                             join pg in db.ProductGroup
                             on p.fk_ProductGroupID equals pg.ProductGroupID

                             where u.fk_OrderID == OrderID && i.IsDelete == false && u.IsDelete == false && p.IsDelete == false
                             select new
                    {
                        p.ProductTitle,
                        aa.ProductImage,
                        u.Count,
                        pg.ProductGroupName,
                        aa.ProductColorID,
                        i.ProductPrice,
                        p.ProductID,
                        u.OrderDetailID,
                        c.ColorTitle,
                        s.SizeTitle,
                        p.ProductName
                    }).ToList();

                    rptOrderDetails.DataSource = m;
                    rptOrderDetails.DataBind();
                }
                if (pnlOrderDetails.Visible == false)
                {
                    pnlOrderDetails.Visible = true;
                }
                else
                {
                    pnlOrderDetails.Visible = false;
                }

                HtmlTableRow newRow = e.Item.FindControl("row") as HtmlTableRow;
                if (newRow.BgColor == "#BAB49B")
                {
                    newRow.BgColor = "#FBFAF4";
                }
                else
                {
                    newRow.BgColor = "#BAB49B";
                }
                //rptOrderDetailsBind(OrderID);
            }
            else if (e.CommandName == "factorDL")
            {
                Guid OrderID = new Guid(e.CommandArgument.ToString());
                Response.Redirect("/GeneratePDFPage.aspx?orderId=" + OrderID);
                //Guid OrderID = new Guid(e.CommandArgument.ToString());

                //using (MashadCarpetEntities db = new MashadCarpetEntities())
                //{
                //    var n = (from a in db.Orders
                //             where a.OrderID == OrderID
                //             select a).FirstOrDefault();

                //    string FilePath = Server.MapPath("~/Uploads/Factors/" + n.CustomerOrderID + ".pdf");
                //    if (File.Exists(FilePath))
                //    {
                //      //  Response.Redirect(FilePath);


                //        string path = (FilePath); //get physical file path from server
                //        string name = Path.GetFileName(path); //get file name


                //         string type = "Application/pdf";
                //        Response.AppendHeader("content-disposition", "attachment; filename=" + name);

                //        if (type != "")
                //            Response.ContentType = type;
                //        Response.WriteFile(path);

                //        Response.End(); //give POP to user for file downlaod
                //    }
                //}
            }
        }
 protected void OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     InitForm(_tipService.GetById(e.CommandArgument.ToString()).ToList());
 }
Example #50
0
        protected void Repeater3_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            //Verifica se o comando é "Editar"
            if (e.CommandName.ToString() == "Baixar")
            {
                string id;

                string[] arg = new string[2];
                arg = e.CommandArgument.ToString().Split(';');

                id = arg[0];
                string theFileName = arg[1];

                DAL.DALTutorial arquivo = new DAL.DALTutorial();

                byte[] data   = arquivo.SelectDownload(id).arquivo;
                byte[] buffer = null;
                using (Stream st = new MemoryStream(data))
                {
                    buffer = new byte[st.Length];
                    long dataLengthToRead = st.Length;
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("Content-Disposition", "attachment; filename=\"" + theFileName + ".pdf\"");
                    while (dataLengthToRead > 0 && Response.IsClientConnected)
                    {
                        Int32 lengthRead = st.Read(buffer, 0, data.Length);
                        Response.OutputStream.Write(buffer, 0, lengthRead);
                        Response.Flush();
                        dataLengthToRead = dataLengthToRead - lengthRead;
                    }
                    Response.Flush();
                    Response.Close();
                }
                Response.End();
            }
            if (e.CommandName == "Deletar")
            {
                string id;
                //int index = Convert.ToInt32(e.CommandArgument);
                string[] arg = new string[2];
                arg = e.CommandArgument.ToString().Split(';');

                id            = arg[0];
                Session["id"] = id;
                DAL.DALTutorial arquivo = new DAL.DALTutorial();

                Modelo.Tutorial mtutorial;

                mtutorial = arquivo.Select(id);

                arquivo.Delete(mtutorial);

                Response.Redirect("~//2-Servidor/WebFormCRUDTutorial.aspx");
            }
            //Verifica se o comando é "Editar"
            if (e.CommandName.ToString() == "ABRIR")
            {
                string id, idAssunto;
                //int index = Convert.ToInt32(e.CommandArgument);
                string[] arg = new string[2];
                arg = e.CommandArgument.ToString().Split(';');

                id = arg[0];
                Session["idtutorial"] = id;
                idAssunto             = arg[1];
                Session["idAssunto"]  = idAssunto;

                // Chama a tela de edição
                Response.Redirect("~//2-Servidor/WebFormViewTutorial.aspx");
            }
        }
Example #51
0
 protected void rptItinerario_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     cRefere.setItinerarioIda(this, source, e);
 }
Example #52
0
        /// <summary>
        /// 审核分页申请记录
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            long   ID       = Convert.ToInt64(e.CommandArgument); //ID
            string filename = "";

            lgk.Model.tb_takeMoney cModel = takeBLL.GetModel(ID);
            lgk.BLL.tb_systemMoney sy     = new lgk.BLL.tb_systemMoney();
            //lgk.BLL.tb_rechargeable dotx = new lgk.BLL.tb_rechargeable();
            lgk.Model.tb_systemMoney system = sy.GetModel(1);
            if (cModel == null)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已删除,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true);
            }
            else
            {
                if (cModel.Flag == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已审核,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true);
                }
                else
                {
                    lgk.Model.tb_user user = userBLL.GetModel(Convert.ToInt32(cModel.UserID));
                    if (e.CommandName.Equals("Open"))//确认
                    {
                        cModel.Flag    = 1;
                        cModel.Take006 = DateTime.Now;
                        if (takeBLL.Update(cModel) && UpdateSystemAccount("MoneyAccount", Convert.ToDecimal(cModel.RealityMoney), 0) > 0)
                        {
                            if (cModel.Take001 == 6)
                            {
                                user.Batch = 0;
                                userBLL.Update(user);
                            }

                            //发送短信通知
                            string content = GetLanguage("MessageTakeMoneyOK").Replace("{username}", user.UserCode).Replace("{time}", Convert.ToDateTime(cModel.TakeTime).ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", Convert.ToDateTime(cModel.TakeTime).ToString("yyyy/MM/dd HH:mm"));
                            SendMessage(Convert.ToInt32(cModel.UserID), user.PhoneNum, content);
                            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');", true);//window.location.href='TakeMoney.aspx';
                            BindData();
                        }
                    }
                    if (e.CommandName.Equals("Remove"))//删除
                    {
                        //加入流水账表
                        lgk.Model.tb_journal model = new lgk.Model.tb_journal();
                        lgk.Model.tb_user    users = userBLL.GetModel(cModel.UserID);
                        model.UserID    = cModel.UserID;
                        model.Remark    = "取消提现";
                        model.InAmount  = cModel.TakeMoney;
                        model.OutAmount = 0;
                        if (cModel.Take001 == 1)
                        {
                            model.BalanceAmount = user.Emoney + cModel.TakeMoney;
                            filename            = "emoney";
                            // model.Journal02 = 2;//奖励分
                            model.JournalType = 1;
                        }
                        if (cModel.Take001 == 2)
                        {
                            model.BalanceAmount = user.BonusAccount + cModel.TakeMoney;
                            filename            = "BonusAccount";
                            //  users.Emoney = users.Emoney + cModel.RealityMoney + cModel.TakePoundage;
                            //   users.StockMoney = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                            //  model.Journal02 = 4; //原始积分
                            model.JournalType = 2;
                        }
                        //if (cModel.Take001 == 3)
                        //{
                        //    model.BalanceAmount = user.StockMoney + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "StockMoney";
                        //    //users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        //if (cModel.Take001 == 4)
                        //{
                        //    model.BalanceAmount = user.ShopAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "ShopAccount";
                        //    users.Emoney = users.Emoney + cModel.RealityMoney;
                        //    users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        //if (cModel.Take001 == 5)
                        //{
                        //    model.BalanceAmount = user.GLmoney + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "GLmoney";
                        //    users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        //if (cModel.Take001 == 6)
                        //{
                        //    model.BalanceAmount = user.RegMoney + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "RegMoney";
                        //    users.Batch = 0;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        model.JournalDate = DateTime.Now;

                        model.Journal01 = cModel.UserID;
                        if (journalBLL.Add(model) > 0 && userBLL.Update(users) && UpdateAccount(filename, user.UserID, cModel.TakeMoney, 1) > 0 && takeBLL.Delete(ID))
                        {
                            MessageBox.MyShow(this, "取消成功");
                            BindData();
                        }
                        else
                        {
                            MessageBox.MyShow(this, "取消失败");
                        }
                    }
                }
            }
        }
Example #53
0
 //设置操作
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     // int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
 }
Example #54
0
        protected void rptauditjobflow_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "audit":
                string[] str = e.CommandArgument.ToString().Split('-');
                string   rs  = ReviewerStatus(str[0], ((EtNet_Models.LoginInfo)Session["login"]).Id);
                if (rs == "")
                {
                    //工作流已删除或审核人员已更改
                    LoadRptjobflowData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "faudit", "<script>alert('不能进入审批界面,原因可能是该申请已修改或删除!')</script>", false);
                    return;
                }
                else if (rs == "F")
                {
                    LoadRptjobflowData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "faudit", "<script>alert('不能进入审批界面,原因可能是审批受限制!')</script>", false);
                }
                else if (rs == "T")
                {
                    string strstatus = JobFlowAuditStatus(int.Parse(str[0]));
                    if (strstatus == "03" || strstatus == "04")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "auditR", "<script>alert('该工作流已由他人审批,无需再审!')</script>", false);
                    }
                    else
                    {
                        if (str[1] == "01")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("ReimbursedForm/AuditReimbursedForm.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("ReimbursedForm/AuditReimbursedForm.aspx?jobflowid=" + str[0]);
                            }
                        }

                        else if (str[1] == "02")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../Order/AuditOrder.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../Order/AuditOrder.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else if (str[1] == "03")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../CusInfo/AuditCus.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../CusInfo/AuditCus.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else if (str[1] == "04")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../Announcement/AnnouncementAuditFirm.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../Announcement/AnnouncementAuditFirm.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else if (str[1] == "05")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../Financial/AuditPayment.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../Financial/AuditPayment.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else
                        {
                        }
                    }
                }
                else if (rs == "P")
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "auditP", "<script>alert('不能重复审批!')</script>", false);
                }
                else
                {
                }
                break;

            case "search":
                string[] str2  = e.CommandArgument.ToString().Split('-');
                int      jfid2 = int.Parse(str2[0]);
                if (str2[1] == "01")     //报销审核的查看
                {
                    SearchReimbursement(jfid2);
                }
                else if (str2[1] == "02")     //定审核的查看
                {
                    SearchOrder(jfid2);
                }
                else if (str2[1] == "03")     //客户审批查看
                {
                    SearchCus(jfid2);
                }
                else if (str2[1] == "04")     //公告审核查看
                {
                    SearchAnnoun(jfid2);
                }
                else if (str2[1] == "05")     //付款申请单查看
                {
                    SearchPayment(jfid2);
                }
                break;

            case "refresh":
                string[]             str3     = e.CommandArgument.ToString().Split('-');
                int                  jfid3    = int.Parse(str3[0]);                                        //工作流id
                EtNet_Models.JobFlow model    = EtNet_BLL.JobFlowManager.GetModel(jfid3);                  //得到工作流实例
                string               strfresh = " jobflowid = " + jfid3;
                EtNet_BLL.AuditJobFlowManager.Delete(strfresh);                                            //删除审核数据,将审核状态改为初始状态
                model.savestatus  = "草稿";
                model.auditstatus = "01";                                                                  //审核状态改为未开始状态
                model.txt         = "";                                                                    //审核意见置空
                if (model.sort == "01")                                                                    //报销审核
                {
                    string id = EtNet_BLL.AusRottenInfoManager.GetList(strfresh).Rows[0]["id"].ToString(); //根据工作流id得到报销单的id值
                    EtNet_Models.AusRottenInfo rotten = EtNet_BLL.AusRottenInfoManager.GetModel(int.Parse(id));
                    if (rotten != null)
                    {
                        rotten.txt = "";    //清空审批人员的审批意见
                        EtNet_BLL.AusRottenInfoManager.Update(rotten);
                    }
                }
                else if (model.sort == "02")     //订单审核
                {
                }
                else if (model.sort == "03")     //客户审核
                {
                    string                sqlcus = " jobflowid = " + jfid3;
                    DataTable             tblcus = EtNet_BLL.CustomerManager.GetList(1, sqlcus, "id");
                    EtNet_Models.Customer cus    = EtNet_BLL.CustomerManager.getCustomerById(int.Parse(tblcus.Rows[0]["id"].ToString()));
                    if (cus != null)
                    {
                        cus.Txt = "";
                        EtNet_BLL.CustomerManager.updateCustomer(cus);
                    }
                }
                else if (model.sort == "04")     //公告审批
                {
                    string    sqlano = " jobflowid = " + jfid3;
                    DataTable tblano = EtNet_BLL.AnnouncementInfoManager.GetList(1, sqlano, "id");
                    EtNet_Models.AnnouncementInfo ano = EtNet_BLL.AnnouncementInfoManager.GetModel(int.Parse(tblano.Rows[0]["id"].ToString()));
                    if (ano != null)
                    {
                        ano.txt = "";
                        EtNet_BLL.AnnouncementInfoManager.Update(ano);
                    }
                }
                else if (model.sort == "05")     //付款审核
                {
                }

                if (EtNet_BLL.JobFlowManager.Update(model))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "success", "<script>alert('撤销成功')</script>", false);
                }
                break;
            }
        }
Example #55
0
        protected void rpRemit_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string s  = "\r\n" + "\r\n" + "\r\n" + "\r\n" + "记录时间" + DateTime.Now.ToString() + "\r\n";
            string ip = Page.Request.UserHostAddress;

            try
            {
                long id = Convert.ToInt64(e.CommandArgument);
                lgk.Model.tb_remit remit = remitBLL.GetModel(id);
                if (remit == null)
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已删除,无法再进行此操作!');window.location.href='RemitManage.aspx';", true);
                }
                else
                {
                    if (remit.State == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已审核,无法再进行此操作!');window.location.href='RemitManage.aspx';", true);
                    }
                    if (remit.State == -1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已撤销,无法再进行此操作!');window.location.href='RemitManage.aspx';", true);
                    }
                    else
                    {
                        if (e.CommandName.Equals("verify"))//确认
                        {
                            remit.State    = 1;
                            remit.PassDate = DateTime.Now;

                            lgk.Model.tb_user user = userBLL.GetModel(remit.UserID);
                            user.StockAccount = user.StockAccount + remit.RemitMoney;
                            //加入流水账表

                            lgk.Model.tb_journal jmodelEmoney = new lgk.Model.tb_journal();
                            jmodelEmoney.UserID        = remit.UserID;
                            jmodelEmoney.Remark        = "报单积分汇款充值";
                            jmodelEmoney.InAmount      = remit.RemitMoney;
                            jmodelEmoney.OutAmount     = 0;
                            jmodelEmoney.BalanceAmount = user.StockAccount;
                            jmodelEmoney.JournalDate   = DateTime.Now;
                            jmodelEmoney.JournalType   = 5;
                            jmodelEmoney.Journal02     = 0;
                            jmodelEmoney.Journal01     = 0;

                            if (remitBLL.Update(remit) && userBLL.Update(user) && UpdateSystemAccount("MoneyAccount", remit.RemitMoney, 1) > 0 && journalBLL.Add(jmodelEmoney) > 0)
                            {
                                add_userRecord(user.UserCode, DateTime.Now, remit.RemitMoney, 3);
                                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('确认成功!');", true);
                                bind();
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('确认失败!');", true);
                            }
                        }
                    }
                    if (e.CommandName.Equals("Remove"))//撤销
                    {
                        string type = "";
                        string res  = "撤销失败";

                        if (remitBLL.Cancel(id))
                        {
                            res = "撤销成功";
                            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('撤销成功!');", true);
                            bind();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('撤销失败!');", true);
                        }

                        s = s + "操作人IP::" + ip + ",操作人ID:" + getLoginID() + ",操作类型:撤销数据,撤销类型:" + type + ",撤销会员ID:" + remit.UserID + ",撤销结果:" + res + "\r\n";
                    }
                    if (e.CommandName.Equals("Query"))//查看凭证
                    {
                        Response.Redirect("RemitVoucher.aspx?ID=" + id);
                    }
                }
            }
            catch (Exception ex)
            {
                s = s + "操作人IP::" + ip + ",操作人ID:" + getLoginID() + ",程序异常:" + ex.Message + "\r\n";
            }
            LogHelper.SaveLog(s, "ManageRemit");
        }
Example #56
0
        protected void rpItems_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            MachItemDAL dal = new MachItemDAL();

            if (e.CommandName == "Add")
            {
                MachItem item          = new MachItem();
                TextBox  txtIntroAdd   = e.Item.FindControl("txtIntroAdd") as TextBox;
                TextBox  txtProductAdd = e.Item.FindControl("txtProductAdd") as TextBox;
                TextBox  txtCodeAdd    = e.Item.FindControl("txtCodeAdd") as TextBox;
                TextBox  txtLongAdd    = e.Item.FindControl("txtLongAdd") as TextBox;
                TextBox  txtWidthAdd   = e.Item.FindControl("txtWidthAdd") as TextBox;
                TextBox  txtDeepAdd    = e.Item.FindControl("txtDeepAdd") as TextBox;
                TextBox  txtQtyAdd     = e.Item.FindControl("txtQtyAdd") as TextBox;
                TextBox  txtRemarkAdd  = e.Item.FindControl("txtRemarkAdd") as TextBox;

                int longValue = !string.IsNullOrEmpty(txtLongAdd.Text) ? int.Parse(txtLongAdd.Text) : 0;
                int width     = !string.IsNullOrEmpty(txtWidthAdd.Text) ? int.Parse(txtWidthAdd.Text) : 0;
                int deepth    = !string.IsNullOrEmpty(txtDeepAdd.Text) ? int.Parse(txtDeepAdd.Text) : 0;
                int qty       = !string.IsNullOrEmpty(txtQtyAdd.Text) ? int.Parse(txtQtyAdd.Text) : 0;

                item.Mach_Id      = MachId;
                item.Intro        = txtIntroAdd.Text;
                item.Product_Code = txtProductAdd.Text;
                item.Code         = txtCodeAdd.Text;
                item.Long         = longValue;
                item.Width        = width;
                item.Deepth       = deepth;
                item.Quantity     = qty;
                item.Square       = ((double)(longValue * width * qty)) / (1000 * 1000);
                item.MachIntro    = txtRemarkAdd.Text;

                dal.AddMachItem(item);
                dal.Save();
            }
            if (e.CommandName == "Save")
            {
                HiddenField hdId       = e.Item.FindControl("hdId") as HiddenField;
                var         item       = dal.GetMachItemById(int.Parse(hdId.Value));
                TextBox     txtIntro   = e.Item.FindControl("txtIntro") as TextBox;
                TextBox     txtProduct = e.Item.FindControl("txtProduct") as TextBox;
                TextBox     txtCode    = e.Item.FindControl("txtCode") as TextBox;
                TextBox     txtLong    = e.Item.FindControl("txtLong") as TextBox;
                TextBox     txtWidth   = e.Item.FindControl("txtWidth") as TextBox;
                TextBox     txtDeep    = e.Item.FindControl("txtDeep") as TextBox;
                TextBox     txtQty     = e.Item.FindControl("txtQty") as TextBox;
                TextBox     txtRemark  = e.Item.FindControl("txtRemark") as TextBox;

                int longValue = !string.IsNullOrEmpty(txtLong.Text) ? int.Parse(txtLong.Text) : 0;
                int width     = !string.IsNullOrEmpty(txtWidth.Text) ? int.Parse(txtWidth.Text) : 0;
                int deepth    = !string.IsNullOrEmpty(txtDeep.Text) ? int.Parse(txtDeep.Text) : 0;
                int qty       = !string.IsNullOrEmpty(txtQty.Text) ? int.Parse(txtQty.Text) : 0;

                item.Mach_Id      = MachId;
                item.Intro        = txtIntro.Text;
                item.Product_Code = txtProduct.Text;
                item.Code         = txtCode.Text;
                item.Long         = longValue;
                item.Width        = width;
                item.Deepth       = deepth;
                item.Quantity     = qty;
                item.Square       = ((double)(longValue * width * qty)) / (1000 * 1000);
                item.MachIntro    = txtRemark.Text;
                dal.Save();
            }
            if (e.CommandName == "Delete")
            {
                HiddenField hdId = e.Item.FindControl("hdId") as HiddenField;
                dal.DeleteMachItem(int.Parse(hdId.Value));
            }

            BindControl();
            SetFocus(btnExport);
        }
Example #57
0
 /// <summary>
 /// 选择某一个微信公众帐号,并且将其保存到session里
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
 }
 protected void rRanges_Delete(object sender, RepeaterCommandEventArgs e)
 {
     Ranges.RemoveAll(item => item.OrderPrice == e.CommandArgument.ToString().TryParseFloat());
     BindRepeater();
 }
Example #59
0
 protected void managelist_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "viewprofile")
     {
         Response.Redirect("~/Views/profile/index.aspx");
     }
     if (e.CommandName == "edit")
     {
         Response.Redirect("~/Views/service/edit.aspx?id=" + e.CommandArgument.ToString());
     }
     if (e.CommandName == "delete")
     {
         int result = new BL.service.Service().Delete(e.CommandArgument.ToString());
         if (result == 1)
         {
             Toast.success(this, "Service deleted successfully");
         }
         else
         {
             Toast.error(this, "An error occured while deleting service");
         }
         List <BL.service.Service> services = new BL.service.Service().SelectByUid(LblUid.Text);
         managelist.DataSource = services;
         managelist.DataBind();
     }
     if (e.CommandName == "view")
     {
         Response.Redirect("~/Views/service/index.aspx?id=" + e.CommandArgument.ToString());
     }
     if (e.CommandName == "favourite")
     {
         string serviceId = e.CommandArgument.ToString();
         List <BL.service.Service> service  = new BL.service.Service().SelectById(serviceId);
         BL.service.Service        curr     = new BL.service.Service();
         List <string>             userfavs = new Fav().SelectUserFavs(LblUid.Text);
         if (!userfavs.Contains(serviceId))
         {
             int servres = curr.Favourite(serviceId, service[0].favs + 1);
             Fav fav     = new Fav(int.Parse(LblUid.Text), int.Parse(serviceId));
             int favres  = fav.Add();
             if (favres == 1 && servres == 1)
             {
                 Toast.success(this, "Service favourited");
             }
             else
             {
                 Toast.error(this, "An error occured while favouriting the service");
             }
         }
         else
         {
             int servres = curr.Favourite(serviceId, service[0].favs - 1);
             Fav fav     = new Fav();
             int favres  = fav.Remove(int.Parse(LblUid.Text), int.Parse(serviceId));
             if (favres == 1 && servres == 1)
             {
                 Toast.success(this, "Service unfavourited");
             }
             else
             {
                 Toast.error(this, "An error occured while unfavouriting the service");
             }
         }
         List <BL.service.Service> services = new BL.service.Service().SelectByUid(LblUid.Text);
         managelist.DataSource = services;
         managelist.DataBind();
     }
 }
Example #60
0
        /// <summary>
        /// The list_ item command.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
        protected void List_ItemCommand([NotNull] object sender, [NotNull] RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "add":
                this.EditDialog.BindData(null);

                this.PageContext.PageElements.RegisterJsBlockStartup(
                    "openModalJs",
                    JavaScriptBlocks.OpenModalJs("EditDialog"));
                break;

            case "edit":
                this.EditDialog.BindData(e.CommandArgument.ToType <int>());

                this.PageContext.PageElements.RegisterJsBlockStartup(
                    "openModalJs",
                    JavaScriptBlocks.OpenModalJs("EditDialog"));
                break;

            case "export":
            {
                var bannedNames = this.GetRepository <Types.Models.BannedName>().Get(x => x.BoardID == this.PageContext.PageBoardID);

                this.Get <HttpResponseBase>().Clear();
                this.Get <HttpResponseBase>().ClearContent();
                this.Get <HttpResponseBase>().ClearHeaders();

                this.Get <HttpResponseBase>().ContentType = "application/vnd.text";
                this.Get <HttpResponseBase>()
                .AppendHeader("content-disposition", "attachment; filename=BannedEmailsExport.txt");

                var streamWriter = new StreamWriter(this.Get <HttpResponseBase>().OutputStream);

                bannedNames.ForEach(
                    name =>
                    {
                        streamWriter.Write(name.Mask);
                        streamWriter.Write(streamWriter.NewLine);
                    });

                streamWriter.Close();

                this.Get <HttpResponseBase>().End();
            }

            break;

            case "delete":
            {
                this.GetRepository <Types.Models.BannedName>().DeleteById(e.CommandArgument.ToType <int>());

                this.PageContext.AddLoadMessage(
                    this.GetText("ADMIN_BANNEDNAME", "MSG_REMOVEBAN_NAME"),
                    MessageTypes.success);

                this.BindData();
            }

            break;
            }
        }