コード例 #1
0
    protected void btnAddNew_Click(object sender, EventArgs e)
    {
        Cmn.uploadFile upF             = new Cmn.uploadFile();
        string[]       allowExtensions = { ".jpg", ".gif", ".png" };
        int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
        string         savePath        = Request.MapPath("~/upload/Article/");
        string         fileName        = myFileUpload.FileName;

        try
        {
            upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
        }
        catch (Exception exp)
        {
            Cmn.Js.ShowAlert(exp.Message);
            return;
        }

        DBEntity.Tab_Article ent = new DBEntity.Tab_Article();
        ent.Title          = this.Title.Text;
        ent.PreviewPicture = fileName;
        ent.Content        = this.fck.Text;
        ent.ReleaseDate    = DateTime.Parse(this.ReleaseDate.Text);
        ent.HomeShowsBool  = this.HomeShowsBool.SelectedValue;
        string idx = ent.AddNew(ent).ToString();

        if (this.HomeShowsBool.SelectedValue == "Yes")
        {
            string strSql = string.Format("update Tab_Article set HomeShowsBool='Yes' where Idx={0};update Tab_Article set HomeShowsBool='No' where Idx<>{0}", idx);
            SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);
        }

        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='ArticleSisleyManage.aspx'");
    }
コード例 #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string fileName = this.hiddenFileName.Value;

        if (myFileUpload.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/weiboHome/");
            fileName = myFileUpload.FileName;
            try
            {
                upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        DBEntity.Tab_HomeWeibo ent = new DBEntity.Tab_HomeWeibo();
        ent.Idx          = int.Parse(Request["Idx"]);
        ent.EditName     = this.EditName.Text;
        ent.WeiboContent = this.WeiboContent.Text;
        ent.HeaderImg    = fileName;
        ent.SortNo       = int.Parse(this.SortNo.Text);
        ent.HomeShowBool = this.HomeShowBool.SelectedValue;
        ent.DateCreated  = DateTime.Now;

        ent.Update(ent);
        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='weiboHomeManage.aspx'");
    }
コード例 #3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string fileName = this.HiddenField1.Value;

        if (myFileUpload.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/Activity/");
            fileName = Cmn.Rand.GetGuid().Replace("-", "") + "_" + myFileUpload.FileName;
            try
            {
                upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        //===========
        string fileName2 = this.HiddenField2.Value;

        if (myFileUpload2.HasFile)
        {
            Cmn.uploadFile upF2             = new Cmn.uploadFile();
            string[]       allowExtensions2 = { ".jpg", ".gif", ".png" };
            int            maxSize2         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath2        = Request.MapPath("~/upload/Activity/");
            fileName2 = Cmn.Rand.GetGuid().Replace("-", "") + "_" + myFileUpload2.FileName;
            try
            {
                upF2.Upload(this.myFileUpload2, allowExtensions2, maxSize2, savePath2, fileName2);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }
        //====================================
        DBEntity.Tab_Activity ent = new DBEntity.Tab_Activity();
        ent.Idx = int.Parse(Request["Idx"]);

        ent.ActiveTitle        = this.ActiveTitle.Text;
        ent.PreviewImg         = fileName;
        ent.ActivityStartDate  = DateTime.Parse(this.ActivityStartDate.Text);
        ent.ActivityEndDate    = DateTime.Parse(this.ActivityEndDate.Text);
        ent.Rules              = this.Rules.Text;
        ent.Platform           = this.Platform.Text;
        ent.Prizes             = this.Prizes.Text;
        ent.DisplayHomeBool    = this.DisplayHomeBool.SelectedValue;
        ent.DisplayHomePreview = fileName2;

        ent.Update(ent);
        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='ActivityManage.aspx'");
    }
コード例 #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string fileName = this.hiddenFileName.Value;

        if (myFileUpload.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/Advertisement/");
            fileName = myFileUpload.FileName;
            try
            {
                upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        DBEntity.Tab_Advertisement ent = new DBEntity.Tab_Advertisement();
        ent.Idx           = int.Parse(Request["Idx"]);
        ent.Links         = this.Links.Text;
        ent.AdPostion     = this.AdPostion.Text;
        ent.AdDescription = this.AdDescription.Text;
        ent.AdImg         = fileName;
        ent.OrderNumb     = int.Parse(this.OrderNumb.Text);
        ent.DateCreated   = DateTime.Now;

        ent.Update(ent);
        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='AdvertisementManage.aspx'");
    }
コード例 #5
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string fileName = this.hiddenFileName.Value;

        if (myFileUpload.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/Advertisement/");
            fileName = Cmn.Date.ToDateStr2(DateTime.Now) + "_" + Cmn.Rand.GetGuid() + "." + Cmn.Str.GetFileExtends(myFileUpload.FileName);
            try
            {
                upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        string idx = Request["Idx"];

        DBEntity.Tab_xw_FlashItem ent = new DBEntity.Tab_xw_FlashItem();
        ent.aTitle      = this.aTitle.Text;
        ent.aLink       = this.aLink.Text;
        ent.aImg        = fileName;
        ent.aOrderNumb  = Convert.ToInt32(this.aOrderNumb.Text);
        ent.aTypeName   = this.aTypeName.Text;
        ent.aCreatedate = DateTime.Now;

        if (string.IsNullOrEmpty(idx))
        {
            ent.AddNew(ent);
        }
        else
        {
            ent.Idx = Convert.ToInt32(idx);
            ent.Update(ent);
        }

        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='xwFlashItemManage.aspx'");
    }
コード例 #6
0
    protected void btnAddNew_Click(object sender, EventArgs e)
    {
        //string exts = ".jpg|.gif|.png|.bmp";
        //if (!Cmn.UploadNew.IsAllowedExtension(this.myFileUpload, exts))
        //{
        //    Cmn.Js.ShowAlert("文件格式不符,可以上传的文件格式为:" + exts);
        //    return;
        //}

        //decimal MaxSize = Convert.ToDecimal(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
        //if (!Cmn.UploadNew.IsAllowedMaxSize(this.myFileUpload, MaxSize)) ;
        //{
        //    Cmn.Js.ShowAlert(string.Format("只能上传小于{0}M的文件!", MaxSize));
        //    return;
        //}


        Cmn.uploadFile upF             = new Cmn.uploadFile();
        string[]       allowExtensions = { ".jpg", ".gif", ".png" };
        int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
        string         savePath        = Request.MapPath("~/upload/Advertisement/");
        string         fileName        = myFileUpload.FileName;

        try
        {
            upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
        }
        catch (Exception exp)
        {
            Cmn.Js.ShowAlert(exp.Message);
            return;
        }


        DBEntity.Tab_Advertisement ent = new DBEntity.Tab_Advertisement();
        ent.AdPostion     = this.AdPostion.Text;
        ent.AdImg         = fileName;
        ent.AdDescription = this.AdDescription.Text;
        ent.Links         = this.Links.Text;
        ent.OrderNumb     = Convert.ToInt32(this.OrderNumb.Text);

        ent.AddNew(ent);
        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='AdvertisementManage.aspx'");
    }
コード例 #7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string fileName = this.hiddenFileName.Value;

        if (myFileUpload.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/CourseMain/");
            fileName = myFileUpload.FileName;
            try
            {
                upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        DBEntity.Tab_CourseMain ent = new DBEntity.Tab_CourseMain();
        ent.Idx                  = int.Parse(Request["Idx"]);
        ent.Title                = this.Title.Text;
        ent.PreviewImg           = fileName;
        ent.CourseContent        = this.CourseContent.Text;
        ent.HomeShowBool         = this.HomeShowBool.SelectedValue;
        ent.SortNo               = Convert.ToInt32(this.SortNo.Text);
        ent.ReleaseDate          = DateTime.Parse(this.ReleaseDate.Text);
        ent.CourseMainTypeIdx_Fx = Convert.ToInt32(this.ddlCourseType.SelectedValue);

        ent.Update(ent);

        string strSql = "update Tab_CourseMain set ActivityDescption='{0}' ,ActivityUrl='{1}' where Idx='{2}'";

        strSql = string.Format(strSql, this.ActivityDescption.Text, this.ActivityUrl.Text, Request["Idx"]);
        SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);

        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='CourseMainManage.aspx'");
    }
コード例 #8
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Cmn.uploadFile upF             = new Cmn.uploadFile();
        string[]       allowExtensions = { ".jpg", ".gif", ".png" };
        int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
        string         savePath        = Request.MapPath("~/upload/Article/");
        string         fileName        = myFileUpload.FileName;

        try
        {
            upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
        }
        catch (Exception exp)
        {
            Cmn.Js.ShowAlert(exp.Message);
            return;
        }

        DBEntity.Tab_UserArticle ent = new DBEntity.Tab_UserArticle();
        ent.UserUId_Fx              = int.Parse(this.uId.Text);
        ent.ForProductBool          = this.rdType.SelectedValue;
        ent.ArticleTitle            = wenZhangTitle.Text;
        ent.ArticleContent          = articleContent.Text;
        ent.CreatedDate             = DateTime.Now;
        ent.PreviewAlternatePicture = fileName;

        if (this.rdType.SelectedValue == "产品测试")
        {
            ent.ProductScore      = this.RadioButtonList1.SelectedItem.Text;
            ent.ProductImpression = this.ProductImpression.SelectedItem.Text;
            ent.ProductTryIdx_Fx  = int.Parse(this.ProductTitle.SelectedValue);
        }

        ent.AddNew(ent);

        Cmn.Js.ShowAlert("操作成功!");
        Cmn.Js.ExeScript("location.href='UserArticle_Manage.aspx'");
    }
コード例 #9
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string fileName  = this.hiddenFileName.Value;
        string fileName2 = this.hiddenFileName2.Value;
        string fileName3 = this.hiddenFileName3.Value;
        string fileName4 = this.hiddenFileName4.Value;

        if (myFileUpload.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/ProductTry/");
            fileName = Cmn.Rand.GetGuid().Replace("-", "") + "_" + myFileUpload.FileName;
            try
            {
                upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        if (myFileUpload2.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/ProductTry/");
            fileName2 = Cmn.Rand.GetGuid().Replace("-", "") + "_" + myFileUpload2.FileName;
            try
            {
                upF.Upload(this.myFileUpload2, allowExtensions, maxSize, savePath, fileName2);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        if (myFileUpload3.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/ProductTry/");
            fileName3 = Cmn.Rand.GetGuid().Replace("-", "") + "_" + myFileUpload3.FileName;
            try
            {
                upF.Upload(this.myFileUpload3, allowExtensions, maxSize, savePath, fileName3);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        if (myFileUpload4.HasFile)
        {
            Cmn.uploadFile upF             = new Cmn.uploadFile();
            string[]       allowExtensions = { ".jpg", ".gif", ".png" };
            int            maxSize         = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload"));
            string         savePath        = Request.MapPath("~/upload/ProductTry/");
            fileName4 = Cmn.Rand.GetGuid().Replace("-", "") + "_" + myFileUpload4.FileName;
            try
            {
                upF.Upload(this.myFileUpload4, allowExtensions, maxSize, savePath, fileName4);
            }
            catch (Exception exp)
            {
                Cmn.Js.ShowAlert(exp.Message);
                return;
            }
        }

        if (string.IsNullOrEmpty(Request["Idx"]))
        {
            string strSql = @"INSERT INTO Tab_TryProduct (ProductTitle ,ProductPictures ,ProductDescription ,TotalCount ,LeftCount ,DateCreated,currentBool,ProductPictures2,ProductPictures3,ProductPictures4) 
                                            VALUES ('{0}' ,'{1}' , '{2}','{3}' ,'{4}',getdate(),'{5}' ,'{6}','{7}','{8}'); select @@identity";
            strSql = string.Format(strSql, ProductTitle.Text, fileName, ProductDescription.Text, TotalCount.Text, LeftCount.Text, this.currentBool.SelectedValue, fileName2, fileName3, fileName4);
            //Cmn.Log.Write(strSql);
            string idx = SqlHelper.ExecuteScalar(CommandType.Text, strSql).ToString();

            if (this.currentBool.SelectedValue == "yes")
            {//更新
                strSql = "update Tab_TryProduct set currentBool='no' where idx <>" + idx;
                SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);
            }
        }
        else
        {
            string strSql = @"update Tab_TryProduct set ProductTitle ='{0}' ,ProductPictures ='{1}',ProductDescription  ='{2}',TotalCount ='{3}' ,LeftCount  ='{4}',currentBool='{6}',ProductPictures2='{7}',ProductPictures3='{8}',ProductPictures4='{9}' where Idx='{5}'";
            strSql = string.Format(strSql, ProductTitle.Text, fileName, ProductDescription.Text, TotalCount.Text, LeftCount.Text, Request["Idx"], this.currentBool.SelectedItem.Value, fileName2, fileName3, fileName4);
            SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);

            if (this.currentBool.SelectedValue == "yes")
            {//更新
                strSql = "update Tab_TryProduct set currentBool='no' where idx <>" + Request["Idx"];
                SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);
            }
        }



        Cmn.Js.ShowAlert("操作成功");
        Cmn.Js.ExeScript("location.href='productTryManage.aspx'");
    }