Exemple #1
0
    public void MyBind()
    {
        B_Author bauthor = new B_Author();

        GridView1.DataSource = bauthor.GetSourceAll();// GetAuthorPage(0, 0, 10);
        GridView1.DataBind();
    }
Exemple #2
0
    private void DeleteSource(string SId)
    {
        B_Author bauthor = new B_Author();

        if (bauthor.DeleteByID(SId))
        {
            HttpContext.Current.Response.Write("<script language=javascript> alert('删除成功!');window.document.location.href='AuthorManage.aspx';</script>");
        }
    }
        public void MyBind(string key = "")
        {
            B_Author bauthor = new B_Author();

            if (string.IsNullOrEmpty(key))
            {
                EGV.DataSource = bauthor.GetSourceAll();
            }
            else
            {
                EGV.DataSource = bauthor.GetAuthorByName(key);
            }
            EGV.DataBind();
        }
Exemple #4
0
        private void B_info_Click(object sender, EventArgs e)
        {
            ViewList.Visible = false;
            B_del.Visible    = false;
            B_add.Visible    = false;
            Viewinfo.Visible = true;

            //delmessage
            B_Name.Visible    = B_Author.Visible = B_Pages.Visible = true;
            label1.Visible    = label2.Visible = label3.Visible = label4.Visible = true;
            B_Author.ReadOnly = B_Pages.ReadOnly = true;
            B_Binding.Visible = true;

            SetReadonlyControls(B_Binding.Controls);

            B_Author.Clear(); B_Pages.Clear();
        }
Exemple #5
0
 /// <summary>
 /// 作者绑定
 /// </summary>
 /// <param name="flag"></param>
 public void InitPage(string flag)
 {
     if ("author" == flag)
     {
         B_Author  bauthor = new B_Author();
         DataTable dt      = bauthor.GetSourceAll();//GetSourceAll()
         RepFiles.DataSource = dt;
         RepFiles.DataBind();
     }
     else if ("source" == flag)
     {
         MyBind();
     }
     else
     {
         BindKeyword();
     }
 }
Exemple #6
0
        private void Viewinfo_Click(object sender, EventArgs e)
        {
            Book tmp = new Book();

            //Book_Base.FirstOrDefault(q => q.ToString == B_Name.Text);

            foreach (Book current in Book_Base)
            {
                if (current.ToString() == B_Name.Text)
                {
                    tmp = current;
                }
            }

            AddMessage.Visible = true;

            if (tmp.ToString() != "default")
            {
                B_Author.Text = tmp.getAuthor();
                B_Pages.Text  = String.Concat(tmp.getNumberPages());

                SetNoReadonlyControls(B_Binding.Controls);
                if (tmp.getBinding())
                {
                    Hard_Buttom.PerformClick();
                }
                else
                {
                    Soft_button.PerformClick();
                }
                SetReadonlyControls(B_Binding.Controls);

                AddMessage.ForeColor = System.Drawing.Color.Green;
                AddMessage.Text      = "Ноутбук найден";
            }
            else
            {
                AddMessage.Visible   = true;
                AddMessage.ForeColor = System.Drawing.Color.Red;
                AddMessage.Text      = "Такого ноутбука нет!";
                B_Author.Clear(); B_Pages.Clear();
            }
        }
        private void InItModify(int Auid)
        {
            B_Author bauthor = new B_Author();
            M_Author mauthor = bauthor.GetAuthorByid(Auid);

            SFile_UP.FileUrl      = mauthor.AuthorPhoto;
            TxtName.Text          = mauthor.AuthorName;
            RadlSex.SelectedValue = mauthor.AuthorSex.ToString();
            TxtAddress.Text       = mauthor.AuthorAddress;
            TxtTel.Text           = mauthor.AuthorTel;
            TxtFax.Text           = mauthor.AuthorFax;
            TxtCompany.Text       = mauthor.AuthorCompany;
            TxtDepartment.Text    = mauthor.AuthorDepartment;
            TxtHomePage.Text      = mauthor.AuthorHomePage;
            TxtZipCode.Text       = mauthor.AuthorZipCode.ToString();
            TxtEmail.Text         = mauthor.AuthorEmail;
            TxtIm.Text            = mauthor.AuthorIm;
            SetAuthorType(mauthor.AuthorType);//设置作者类别
            tbUBday.Value = mauthor.AuthorBirthDay.ToShortDateString();
            if (mauthor.AuthorIsElite)
            {
                ChkElite.Checked = true;
            }
            else
            {
                ChkElite.Checked = false;
            }
            if (mauthor.AuthoronTop)
            {
                ChkOnTop.Checked = true;
            }
            else
            {
                ChkOnTop.Checked = false;
            }
            TxtIntro.Text = mauthor.AuthorIntro;
            if (mauthor.AuthorPassed)
            {
                ChkPass.Checked = true;
            }
            EBtnModify.Visible = true;
            EBtnSubmit.Visible = false;
        }
        protected void EBtnModify_Click(object sender, EventArgs e)
        {
            M_Author mauthor = new M_Author();
            B_Author bauthor = new B_Author();

            mauthor.ID          = Convert.ToInt32(Request.QueryString["AUId"].Trim());
            mauthor.AuthorID    = 0;
            mauthor.AuthorName  = TxtName.Text.ToString();
            mauthor.AuthorPhoto = UpPhontoFile();
            //mauthor. = TxtUserName.Text.ToString(); 会员名没存
            mauthor.AuthorSex         = Convert.ToInt32(RadlSex.SelectedValue);
            mauthor.AuthorLastUseTime = DateTime.Now;
            mauthor.AuthorAddress     = TxtAddress.Text.ToString();
            mauthor.AuthorTel         = TxtTel.Text.ToString();
            mauthor.AuthorFax         = TxtFax.Text.ToString();
            mauthor.AuthorCompany     = TxtCompany.Text.ToString();
            mauthor.AuthorDepartment  = TxtDepartment.Text.ToString();
            mauthor.AuthorHomePage    = TxtHomePage.Text.ToString();
            mauthor.AuthorZipCode     = DataConverter.CLng(TxtZipCode.Text.ToString());
            mauthor.AuthorEmail       = TxtEmail.Text.ToString();
            mauthor.AuthorMail        = TxtMail.Text.ToString();
            mauthor.AuthorIm          = TxtIm.Text.ToString();
            mauthor.AuthorType        = GetAuthorType(RadlAuthorType.SelectedIndex);
            mauthor.AuthorBirthDay    = DataConverter.CDate(tbUBday.Value);
            if (ChkElite.Checked)
            {
                mauthor.AuthorIsElite = true;
            }
            if (ChkOnTop.Checked)
            {
                mauthor.AuthoronTop = true;
            }
            mauthor.AuthorIntro = TxtIntro.Text.ToString();
            if (ChkPass.Checked)
            {
                mauthor.AuthorPassed = true;
            }
            if (bauthor.Update_Author_ByID(mauthor))
            {
                Response.Write("<script language=javascript> alert('修改成功!');window.document.location.href='AuthorManage.aspx';</script>");
            }
        }
Exemple #9
0
    protected void btndelete_Click(object sender, EventArgs e)
    {
        B_Author bauthor = new B_Author();
        int      i = 0, flag = 0; string sid = "";

        for (i = 0; i < GridView1.Rows.Count; i++)
        {
            if (((CheckBox)GridView1.Rows[i].Cells[0].FindControl("SelectCheckBox")).Checked)
            {
                sid = GridView1.DataKeys[GridView1.Rows[i].RowIndex].Value.ToString();
                if (bauthor.DeleteByID(sid))
                {
                    flag++;
                }
            }
        }
        // GridView1.DataKeys[GridView1.Rows[i].RowIndex]//而不是.DataItemIndex
        if (flag > 0)
        {
            Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='AuthorManage.aspx';</script>");
        }
    }
        protected void btndelete_Click(object sender, EventArgs e)
        {
            B_Author bauthor = new B_Author();
            int      flag = 0; string sid = "";

            string[] chkArr = GetChecked();
            if (chkArr != null)
            {
                for (int i = 0; i < chkArr.Length; i++)
                {
                    sid = chkArr[i];
                    if (bauthor.DeleteByID(sid))
                    {
                        flag++;
                    }
                }
            }
            if (flag > 0)
            {
                Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='AuthorManage.aspx';</script>");
            }
        }