예제 #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DBLL.clsPartners   clPartners = new DBLL.clsPartners();
        DBLL.OptionSysDBLL option     = new DBLL.OptionSysDBLL();
        bool _Result = clPartners.update_tb_PartnersBynPartnersID(int.Parse(hfID.Value), txtsImageNameCN.Text, "", "", txtsImageNameEN.Text, "", Session["user"].ToString(), DateTime.Now, true, int.Parse(txtnSorting.Text));

        if (_Result)
        {
            string sSaveFolderFullPath = Server.MapPath(Image3.ImageUrl);
            if (File.Exists(sSaveFolderFullPath))
            {
                //如果存在则删除
                File.Delete(sSaveFolderFullPath);

                System.IO.DirectoryInfo dir  = new System.IO.DirectoryInfo(sSaveFolderFullPath.Substring(0, sSaveFolderFullPath.LastIndexOf("\\")).ToString());
                System.IO.FileInfo[]    dirs = dir.GetFiles();
                if (dirs.Length > 0)
                {
                    //有子文件夹
                }
                else
                {
                    Directory.Delete(sSaveFolderFullPath.Substring(0, sSaveFolderFullPath.LastIndexOf("\\")).ToString());
                }
            }
            lblsImagePath.Visible = true;
            Label2.Visible        = false;
            Button1.Visible       = false;
            Image3.Visible        = false;
        }
    }
예제 #2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //判断session
        if (Session["User"] == null || Session["User"].ToString().Length < 1)
        {
            Response.Redirect(Request.RawUrl);
        }
        try
        {
            int nID = 0;
            if (int.TryParse(hfID.Value.ToString(), out nID) && nID > 0)
            {
                //更新
                if (ValiAdd())
                {
                    DBLL.clsPartners   clPartners = new DBLL.clsPartners();
                    DBLL.OptionSysDBLL option     = new DBLL.OptionSysDBLL();
                    bool _Result = false;
                    MutileUploaderUserControlPartners.sNewName = txtsImageNameCN.Text;
                    MutileUploaderUserControlPartners.SavePath();
                    if (MutileUploaderUserControlPartners.filepathlist.Count > 0)
                    {
                        for (int i = 0; i < MutileUploaderUserControlPartners.filepathlist.Count; i++)
                        {
                            _Result = clPartners.update_tb_PartnersBynPartnersID(nID, txtsImageNameCN.Text, "", "", txtsImageNameEN.Text, MutileUploaderUserControlPartners.filepathlist[i].ToString(), Session["user"].ToString(), DateTime.Now, true, int.Parse(txtnSorting.Text));
                        }
                    }

                    if (_Result == true)
                    {
                        ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess");
                        ShowMsg1.Show();
                    }
                    else
                    {
                        //失败就一条
                        ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail");
                        ShowMsg1.Show();
                    }
                }
                else
                {
                    ShowMsg1.Show();
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }