Exemplo n.º 1
0
 protected void BtnUpdate_Click(object sender, EventArgs e)
 {
     //判断session
     if (Session["User"] == null || Session["User"].ToString().Length < 1)
     {
         Response.Redirect(Request.RawUrl);
     }
     try
     {
         //if (ValiEdit())
         //{
         DBLL.clsContact    Contact = new DBLL.clsContact();
         DBLL.OptionSysDBLL option  = new DBLL.OptionSysDBLL();
         bool _Result = Contact.update_tb_ContactBynContactID(int.Parse(hfContactListUpdateID.Value), txtsTitle.Text, txtsName.Text, txtsCompanyName.Text, txtsAddress.Text, txtsEmail.Text, txtsFax.Text, txtsPhone.Text, txtsContents.Text, Session["user"].ToString(), DateTime.Now, true, 0, true);
         if (_Result == true)
         {
             ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess");
             ShowMsg1.Show();
             MultiView1.ActiveViewIndex = 0;
             ReBindPageList();
         }
         else
         {
             //失败就一条
             ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail");
             ShowMsg1.Show();
         }
         //}
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int nID = 0;
         if (Request.QueryString["nID"] != null && int.TryParse(Request.QueryString["nID"].ToString(), out nID) && nID > 0)
         {
             lblBigtitle.Text = "留言明细";
             DBLL.clsContact clContact = new DBLL.clsContact();
             DataTable       dt        = clContact.Select_tb_ContactBynContactID(nID);
             if (dt != null && dt.Rows.Count > 0)
             {
                 hfID.Value           = dt.Rows[0]["nContactID"].ToString();
                 txtsName.Text        = dt.Rows[0]["sName"].ToString();
                 txtsCompanyName.Text = dt.Rows[0]["sCompanyName"].ToString();
                 txtsPhone.Text       = dt.Rows[0]["sPhone"].ToString();
                 txtsPositon.Text     = dt.Rows[0]["sPositon"].ToString();
                 txtsEmail.Text       = dt.Rows[0]["sEmail"].ToString();
                 txtsWeb.Text         = dt.Rows[0]["sWeb"].ToString();
                 txtsContent.Text     = dt.Rows[0]["sContents"].ToString();
                 //绑定数据
             }
             try
             {
                 bool _Result = clContact.update_tb_ContactBynContactID(nID, true);
             }
             catch (Exception)
             {
                 throw;
             }
         }
     }
 }
Exemplo n.º 3
0
    public void ReBindPageList()
    {
        DBLL.clsContact Contact = new DBLL.clsContact();
        DataTable       dt      = new DataTable();

        dt = Contact.sp_selectNormalTableOfAllByContact(false);
        if (dt != null)
        {
            ContactList.Merge(dt);
            lvContactList.DataSource = ContactList;
            lvContactList.DataBind();
        }
        else
        {
            lvContactList.DataSource = null;
            lvContactList.DataBind();
        }
    }
Exemplo n.º 4
0
    //protected void lvContactList_ItemDeleting(object sender, ListViewDeleteEventArgs e)
    //{
    //    DBLL.DBcommon dbcom = new DBLL.DBcommon();
    //    Label lblnID = (Label)lvContactList.Items[e.ItemIndex].FindControl("lblnLinkID");
    //    int _nID = 0;
    //    if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0)
    //    {
    //        hfContactUpdateID.Value = _nID.ToString();
    //    }
    //    dbcom.sp_DeleteNormalTableByID(int.Parse(hfContactUpdateID.Value), "tb_Link");
    //    ReBindPageList();
    //}
    protected void lvContactListt_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
    {
        Label lblnID = (Label)lvContactList.Items[e.NewSelectedIndex].FindControl("lblnContactID");
        int   _nID   = 0;

        DBLL.clsContact Contact = new DBLL.clsContact();
        if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0)
        {
            MultiView1.ActiveViewIndex = 1;
            DataTable dt = Contact.Select_tb_ContactBynContactID(_nID);
            txtsTitle.Text              = dt.Rows[0]["sTitle"].ToString();
            txtsName.Text               = dt.Rows[0]["sName"].ToString();
            txtsCompanyName.Text        = dt.Rows[0]["sCompanyName"].ToString();
            txtsAddress.Text            = dt.Rows[0]["sAddress"].ToString();
            txtsEmail.Text              = dt.Rows[0]["sEmail"].ToString();
            txtsFax.Text                = dt.Rows[0]["sFax"].ToString();
            txtsPhone.Text              = dt.Rows[0]["sPhone"].ToString();
            txtsContents.Text           = dt.Rows[0]["sContents"].ToString();
            hfContactListUpdateID.Value = _nID.ToString();
        }
    }
Exemplo n.º 5
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            DBLL.clsContact clscon = new DBLL.clsContact();
            int             result = clscon.insert_tb_Contact("", txtsName.Text, txtsCompanyName.Text, "", txtsEmail.Text, "", txtsPhone.Text, txtsContent.Text, "", DateTime.Now, "", DateTime.Now, true, 0,
                                                              false, txtsWeb.Text, txtsJob.Text);

            if (txtsVali.Text == base.strValidate)
            {
                if (result > 0)
                {
                    string xmlfilepath = ConfigurationManager.AppSettings["xmlfilepath"].ToString();
                    if (Session["languageGlobal"] != null)
                    {
                        xmlfilepath = xmlfilepath.Replace("[filename]", Session["languageGlobal"].ToString());
                    }
                    else
                    {
                        xmlfilepath = xmlfilepath.Replace("[filename]", "cn");
                    }
                    clslang langxml = new clslang(xmlfilepath);
                    langxml.XmlLoad();
                    ShowMsg1.InnerContent = langxml.getString("leaveMsg", "ShowMsg", "ShowMsgContent");

                    ShowMsg1.Show();
                    Clear();
                }
                else
                {
                    string xmlfilepath = ConfigurationManager.AppSettings["xmlfilepath"].ToString();
                    if (Session["languageGlobal"] != null)
                    {
                        xmlfilepath = xmlfilepath.Replace("[filename]", Session["languageGlobal"].ToString());
                    }
                    else
                    {
                        xmlfilepath = xmlfilepath.Replace("[filename]", "cn");
                    }
                    clslang langxml = new clslang(xmlfilepath);
                    langxml.XmlLoad();
                    ShowMsg1.InnerContent = langxml.getString("leaveMsg", "ShowMsg", "ShowMsgFAILContent");
                    ShowMsg1.Show();
                    Clear();
                }
            }
            else
            {
                string xmlfilepath = ConfigurationManager.AppSettings["xmlfilepath"].ToString();
                if (Session["languageGlobal"] != null)
                {
                    xmlfilepath = xmlfilepath.Replace("[filename]", Session["languageGlobal"].ToString());
                }
                else
                {
                    xmlfilepath = xmlfilepath.Replace("[filename]", "cn");
                }
                clslang langxml = new clslang(xmlfilepath);
                langxml.XmlLoad();
                ShowMsg1.InnerContent = langxml.getString("leaveMsg", "ShowMsg", "ShowMsgFAILVali");
                ShowMsg1.Show();
                Clear();
            }
        }
        catch (Exception)
        {
            throw;
        }
    }