예제 #1
0
    /// <summary>
    /// 确定提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strError = Validates();

        if (!string.IsNullOrEmpty(strError))
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>alert('" + strError + "');</script>");
            return;
        }
        model.CategoryId      = Convert.ToInt32(this.ddlType.SelectedValue);
        model.Title           = SafeRequest.GetFormString("txtTitle");
        model.SubHead         = SafeRequest.GetFormString("txtSubHead");
        model.PublicationUnit = SafeRequest.GetFormString("txtUnit");
        model.FromSource      = SafeRequest.GetFormString("txtFromSouce");
        // model.KeyWord = SafeRequest.GetFormString("txtKeyWord");
        model.ReleaseDate  = !string.IsNullOrEmpty(this.txtReleaseDate.Text.Trim()) ? Convert.ToDateTime(this.txtReleaseDate.Text.Trim()) : System.DateTime.Now;
        model.IsTop        = 0; //SafeRequest.GetFormInt("radioTopList", 0);
        model.IndexCommend = 0; //SafeRequest.GetFormInt("radioIndexCommentList", 0);
        model.HotPic       = SafeRequest.GetFormString("radioHotList");
        model.HotDays      = SafeRequest.GetFormInt("txtHotDays", 3);
        //model.ArticleType = SafeRequest.GetFormInt("radioArticleTypeList", 0);
        model.Body = this.fckBody.Text;

        //追加底部
        if (cbFooter.Checked)
        {
            if (model.Body.IndexOf("start_auto_footer") == -1 && model.Body.IndexOf("end_auto_footer") == -1)
            {
                string autoFooter = "<!--start_auto_footer-->" + this.fckBodyFooter.Text + "<!--end_auto_footer-->";
                model.Body = model.Body + autoFooter;
            }
            //写入缓存
            NG.CachHelper.Redis.RedisHelper redis = new NG.CachHelper.Redis.RedisHelper();
            redis.SetStringCash("News_Footer", this.fckBodyFooter.Text);
            redis.Close();
        }

        //   model.IsComment = 0;// SafeRequest.GetFormInt("radioIsComment", 0);
        model.Approved   = SafeRequest.GetFormInt("radioApproved", 0);
        model.Sort       = SafeRequest.GetFormInt("txtSort", 99);
        model.AddedDate  = System.DateTime.Now;
        model.ExpireDate = System.DateTime.Now;
        model.ViewCount  = 0;
        // model.IsScrool = 0;
        // model.AddedUserId = Convert.ToInt32(_userId);//默认登录进来人的编号
        model.AddedUserId = 1;
        //~/upload/News/
        #region 保存图片
        if (!this.picUpload.Value.Equals("") && this.picUpload.PostedFile.ContentLength > 10)
        {
            string FileTZM = this.picUpload.PostedFile.FileName.Substring(this.picUpload.PostedFile.FileName.LastIndexOf(".") + 1);//得到文件的扩展名

            if (!IsPic(FileTZM.ToLower()))
            {
                JSUtility.Alert("上传图片格式不正确!");
                return;
            }
            if (this.picUpload.PostedFile.ContentLength > 1048576)
            {
                JSUtility.Alert("上传图片过大!");
                return;
            }
            Random rnd            = new Random();
            string UpLoadFileTime = DateTime.Now.ToString("yyMMddHHmmss") + rnd.Next(9999).ToString("0000"); //生成一个新的数图片名称
            string fileName       = UpLoadFileTime + "." + FileTZM;                                          //产生上传图片的名称
            if (!Directory.Exists(Request.MapPath("~/upload/News/")))
            {
                Directory.CreateDirectory(Request.MapPath("~/upload/News/"));
            }
            string Url = Request.MapPath("~/upload/News/" + fileName);
            picUpload.PostedFile.SaveAs(Url);
            model.ImgLink = "/upload/News/" + fileName;
        }
        else
        {
            model.ImgLink = ViewState["ImgLink"].ToString();
        }
        #endregion


        if (_Pid != "")
        {
            model.NewsID = _Pid;
            if (bll.Update(model))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            model.NewsID = IdCreator.CreateId("T_News", "NewsId");
            if (bll.Add(model))
            {
                JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
            }
        }
    }
예제 #2
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        MenuTypeModel mod;

        if (this.id != "" && this.id != null)
        {
            mod = bll.GetModel(this.id);
        }
        else
        {
            mod = new MenuTypeModel();
        }
        string pPath = "";

        string[] codeList = this.cSelect.hfCode.Split('|');
        StarTech.DBUtility.AdoHelper adoHelper = StarTech.DBUtility.AdoHelper.CreateHelper("DB_Instance");



        if (codeList.Length < 1 || cSelect.hfCode == "")
        {
            mod.PCategoryId   = "";
            mod.CategoryLevel = 1;
            mod.CategoryPath  = mod.CategoryId;
        }
        else
        {
            //if(this.cSelect.categoryID)
            mod.PCategoryId = codeList[codeList.Length - 1];
            DataSet ds = adoHelper.ExecuteSqlDataset("select * from T_Menu_Category where categoryid='" + KillSqlIn.Form_ReplaceByString(mod.PCategoryId, 20) + "';");
            mod.CategoryLevel = Convert.ToInt32(ds.Tables[0].Rows[0]["CategoryLevel"].ToString()) + 1;
            pPath             = ds.Tables[0].Rows[0]["CategoryPath"].ToString();
        }

        if (pPath != "")
        {
            pPath += ",";
        }

        mod.CategoryName = this.txtMenuName.Text.Trim();
        //mod.CategoryPath=
        //mod.Remarks = this.txtRemarks.Text.Trim();
        int orderdy = 0;

        int.TryParse(this.txtSort.Text.Trim(), out orderdy);
        mod.Orderby      = orderdy;
        mod.CategoryFlag = (this.cbIsVisible.Checked == true) ? "index" : "";

        if (fuImg.FileName != null && fuImg.FileName != "")
        {
            //mod.Url = fuImg.FileName;
            string nowUrl = Guid.NewGuid().ToString();
            string tzm    = fuImg.FileName.Substring(fuImg.FileName.LastIndexOf("."));
            string url    = "/upload/Category/" + nowUrl + "" + tzm;
            fuImg.SaveAs(Server.MapPath("~" + url));
            mod.Url = url;
        }

        if (this.id != "" && this.id != null)
        {
            mod.CategoryPath = pPath + mod.CategoryId;
            if (bll.Update(mod))
            {
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "修改菜谱分类《" + mod.CategoryName + "》", "修改", "", "", HttpContext.Current.Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            mod.CategoryId   = IdCreator.CreateId("T_Menu_Category", "CategoryId");
            mod.CategoryPath = pPath + mod.CategoryId;
            bll.Add(mod);
            LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加菜谱分类《" + mod.CategoryName + "》", "添加", "", "", HttpContext.Current.Request.Url.ToString());
            ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('添加成功');layer_close_refresh();</script>");
            //JSUtility.ReplaceOpenerParentWindow("menuTree.aspx");
        }
    }
예제 #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int updateInt = -1;

        if (this.id == "")
        {
            if (this.FileUpload1.HasFile == false)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务图片');</script>");
                return;
            }

            if (this.ddlMorePropertys.SelectedValue == "视频和练习")
            {
                if (this.FileUpload2.HasFile == false)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择视频文件');</script>");
                    return;
                }
            }

            GoodsModel mod = new GoodsModel();
            mod.GoodsId    = IdCreator.CreateId("T_Goods_Info", "GoodsId");
            mod.AddTime    = DateTime.Now;
            mod.CategoryId = mod.GoodsToTypeId = this.hid_pgoodsid.Value;
            if (hfSign.Value.Length > 0)
            {
                mod.signId = hfSign.Value;
            }
            else
            {
                mod.signId = "";
            }


            string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
            if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>");
                return;
            }
            if (this.FileUpload1.PostedFile.ContentLength > 1024000)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>");
                return;
            }
            string newFileName = Guid.NewGuid().ToString() + fileExt;
            string dir         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
            if (System.IO.Directory.Exists(Server.MapPath(dir)) == false)
            {
                System.IO.Directory.CreateDirectory(Server.MapPath(dir));
            }
            string newPath = dir + newFileName;


            this.FileUpload1.SaveAs(Server.MapPath(newPath));
            //缩略图
            //MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt)));
            //mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt);
            mod.GoodsSmallPic           = newPath;
            ViewState["OriginalBigImg"] = mod.GoodsSmallPic;


            //视频文件_start
            if (this.FileUpload2.HasFile == true)
            {
                string fileExt_video = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower();
                if (fileExt_video != ".mp4")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('视频格式不正确');</script>");
                    return;
                }
                string newFileName_video = Guid.NewGuid().ToString() + fileExt_video;
                string dir_video         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir_video)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir_video));
                }
                string newPath_video = dir_video + newFileName_video;
                this.FileUpload2.SaveAs(Server.MapPath(newPath_video));
                mod.BookInfo = newPath_video;
            }
            //视频文件_end

            GetFormInfo(ref mod);
            if (mod.CategoryId == "1")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类')</script>");
            }
            if (bll.Add(mod) > 0)
            {
                //默认幻灯图片
                //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); }
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加任务《" + mod.GoodsName + "》", "添加", "", "", HttpContext.Current.Request.Url.ToString());

                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>if(confirm('保存成功')){location.href='SubGoodsAdd.aspx?id=" + mod.GoodsId + "'}else{}</script>");
            }
        }
        else
        {
            updateInt = 0;
            //string strSQL = "select * from T_Goods_Update where goodsid='" + id+"' and updatetime>'"+DateTime.Now.ToShortDateString()+" 00:00:00';";
            string    strSQL    = "";
            AdoHelper adohelper = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance);
            //DataSet ds = adohelper.ExecuteSqlDataset(strSQL);

            //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >= 0)
            //{
            //    if (ds.Tables[0].Rows.Count > 2)
            //    {
            //        ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>");
            //        return;
            //    }
            //    else
            //    {
            //        updateInt = 2 - ds.Tables[0].Rows.Count;
            //    }
            //}



            GoodsModel mod = bll.GetModel(this.id);
            if (this.FileUpload1.HasFile == true)
            {
                string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
                if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>");
                    return;
                }
                if (this.FileUpload1.PostedFile.ContentLength > 1024000)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>");
                    return;
                }
                string newFileName = Guid.NewGuid().ToString() + fileExt;
                string dir         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir));
                }
                string newPath = dir + newFileName;

                this.FileUpload1.SaveAs(Server.MapPath(newPath));
                //缩略图
                //MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt)));
                //mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt);
                mod.GoodsSmallPic           = newPath;
                ViewState["OriginalBigImg"] = mod.GoodsSmallPic;
            }


            //视频文件_start
            if (this.FileUpload2.HasFile == true)
            {
                string fileExt_video = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower();
                if (fileExt_video != ".mp4")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('视频格式不正确');</script>");
                    return;
                }
                string newFileName_video = Guid.NewGuid().ToString() + fileExt_video;
                string dir_video         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir_video)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir_video));
                }
                string newPath_video = dir_video + newFileName_video;
                this.FileUpload2.SaveAs(Server.MapPath(newPath_video));
                mod.BookInfo = newPath_video;
            }
            //视频文件_end

            //hfSign.Value = hfSign.Value.Replace("--", "-");
            if (hfSign.Value.Length > 0)
            {
                mod.signId = hfSign.Value;
            }
            else
            {
                mod.signId = "";
            }



            GetFormInfo(ref mod);
            if (bll.Update(mod))
            {
                adohelper.ExecuteSqlNonQuery("update T_Goods_Info set JobDay=datediff(day,JobStartTime,JobEndTime) where GoodsId='" + mod.GoodsId + "'");

                //默认图片
                //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); }
                //if (updateInt == -1)
                //    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href='GoodsList.aspx?id=" + this.cselect.categoryID + "';</script>");
                //else{
                strSQL = "insert T_Goods_Update values('" + mod.GoodsId + "',getdate(),'');";
                adohelper.ExecuteSqlNonQuery(strSQL);
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "编辑任务《" + mod.GoodsName + "》", "编辑", "", "", HttpContext.Current.Request.Url.ToString());

                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>");
                //}
            }
        }
    }
예제 #4
0
    protected void InitForm()
    {
        //string signList = "";
        string sign = "";

        if (this.id != "")
        {
            GoodsModel mod = bll.GetModel(this.id);
            if (mod != null)
            {
                this.txtName.Value      = mod.GoodsName;
                this.txtOrder.Value     = mod.Orderby.ToString();
                this.txtRemarks.Text    = mod.Remarks;
                this.div_img.Visible    = true;
                this.Image1.ImageUrl    = mod.GoodsSmallPic;
                this.hidVideoPath.Value = mod.BookInfo;
                if (this.hidVideoPath.Value.Length > 5 && System.IO.File.Exists(Server.MapPath(this.hidVideoPath.Value)))
                {
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(Server.MapPath(this.hidVideoPath.Value));
                    int size = (int)fileInfo.Length / 1024 / 1024;
                    this.ltVideoSize.Text = "&nbsp;视频文件大小:" + size.ToString() + "M";
                }
                this.txtSampleDesc.Text = mod.GoodsSampleDesc;
                this.hzst_ckeditor.Text = mod.GoodsDesc;
                this.cselect.categoryID = mod.CategoryId;
                if (mod.MorePropertys != "")
                {
                    this.ddlMorePropertys.SelectedValue = mod.MorePropertys;
                }

                this.goodsCode = this.txtGoodsCode.Value = mod.GoodsCode;
                if (mod.IsHot == 1)
                {
                    this.cbIsHot.Checked = true;
                }
                if (mod.IsNew == 1)
                {
                    this.cbIsNew.Checked = true;
                }
                if (mod.IsRec == 1)
                {
                    this.cbIsRec.Checked = true;
                }
                //if (mod.IsSpe == 1) { this.cbIsSpe.Checked = true; }
                this.txtSalePrice.Value   = mod.SalePrice.ToString();
                this.txtMarketPrice.Value = mod.MarketPrice.ToString();

                this.rdIsSale.SelectedValue = mod.IsSale.ToString();
                this.hidOldGoodsCode.Value  = mod.GoodsCode;

                sign         = mod.signId;
                hfSign.Value = sign;

                //20160605

                //this.txtJobStartTime.Value = mod.JobStartTime.ToString("yyyy-MM-dd HH:mm");
                //this.txtJobEndTime.Value = mod.JobEndTime.ToString("yyyy-MM-dd HH:mm");
                this.ddlJobType.Value        = mod.JobType;
                this.txtTotalSaleCount.Value = mod.TotalSaleCount.ToString();

                //this.llRemark.Text = GetMemberPrice(this.id);
                //试听课程
                if ((decimal)(mod.SalePrice) < 0)
                {
                    cbFree.Checked = true;
                }

                //外部课程
                this.txtOutGoodsId.Value = mod.DataFrom;
            }
        }
        else
        {
            this.txtGoodsCode.Value = IdCreator.CreateId("T_Goods_Info", "GoodsCode");
            if (this.cateId != "")   //this.ddlPCategory.SelectedValue = this.cateId;
            {
                this.cselect.categoryID = this.cateId;
            }
            //this.txtJobStartTime.Value = this.txtJobEndTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
        }

        string strSQL = "";

        strSQL += "select * from T_Goods_Sign;";
        strSQL += "select * from T_Goods_Service order by orderby asc;";
        //strSQL += "select * from T_Goods_SignBind where goodsid='" + id + "';";
        AdoHelper     adohelper   = AdoHelper.CreateHelper(StarTech.Util.AppConfig.DBInstance);
        DataSet       ds          = adohelper.ExecuteSqlDataset(strSQL);
        List <string> signList    = new List <string>();
        List <string> serviceList = new List <string>();

        if (sign != "" && sign != null)
        {
            signList = sign.Split(',').ToList();
        }

        string llText = "";

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            if (signList.Contains(ds.Tables[0].Rows[i]["signid"].ToString().Trim()))
            {
                llText += "<input checked='checked' type='checkbox' signname='" + ds.Tables[0].Rows[i]["signname"].ToString() + "' signid='" + ds.Tables[0].Rows[i]["signid"].ToString() + "' class='ckSign' />";
            }
            else
            {
                llText += "<input type='checkbox' signname='" + ds.Tables[0].Rows[i]["signname"].ToString() + "' signid='" + ds.Tables[0].Rows[i]["signid"].ToString() + "' class='ckSign' />";
            }
            llText += ds.Tables[0].Rows[i]["signname"].ToString();
            if ((i + 1) % 6 == 0)
            {
                llText += "<br/>";
            }
            ltSign.Text = llText;
        }
    }
예제 #5
0
    /// <summary>
    /// 保存信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        MenuModel model = new MenuModel();

        if (menuId != null && menuId != "")
        {
            model = new MenuBll().GetModel(menuId);
            if (model == null)
            {
                model = new MenuModel();
            }
        }
        model.menuName = txtMenuName.Text;
        model.Flavor   = txtFlavor.Text;
        //model.Technology=ddlTechnology.SelectedValue;
        model.Technology   = txtTechnology.Text;
        model.Flavor       = txtFlavor.Text;
        model.CookingTime  = txtCookieTime.Text;
        model.CookingSkill = txtCookingSkill.Text;
        string[] strCode = selectMenu.hfCode.Split('|');
        if (strCode.Length > 0)
        {
            model.categoryId = strCode[strCode.Length - 1];
        }
        if (strCode[strCode.Length - 1] == "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类');</script>");
        }
        if (hfSign.Value.Length > 0)
        {
            model.signId = hfSign.Value;
        }
        else
        {
            model.signId = "";
        }

        decimal d = 0;

        if (decimal.TryParse(txtCalorie.Text, out d))
        {
            model.Calorie = d;
        }
        model.isShow = cbShow.Checked ? 1 : 0;
        model.isTop  = cbTop.Checked ? 1 : 0;

        if (fuBigImg.FileName.ToLower().Contains(".jpg") || fuBigImg.FileName.ToLower().Contains(".png") || fuBigImg.FileName.ToLower().Contains(".bmp") || fuBigImg.FileName.ToLower().Contains(".gif"))
        {
            string filePath = "/Upload/Menu/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/";
            if (!Directory.Exists(Server.MapPath(filePath)))
            {
                Directory.CreateDirectory(Server.MapPath(filePath));
            }
            string fileName = DateTime.Now.Hour + "" + DateTime.Now.Minute + "" + DateTime.Now.Second + new Random().Next(10, 99);
            string tzm      = fuBigImg.FileName.Substring(fuBigImg.FileName.LastIndexOf("."));
            fuBigImg.SaveAs(Server.MapPath(filePath + fileName + tzm));
            model.imgSrc = filePath + fileName + tzm;
            if (model.imgSrc != null && model.imgSrc != "")
            {
                llBigImg.Text = "<img src='" + model.imgSrc + "' width='100px' height='100px'/>";
            }
        }
        else if (fuBigImg.FileName != null && fuBigImg.FileName != "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('展示图图片格式不正确');</script>");
            return;
        }

        if (fuSmallImg.FileName.ToLower().Contains(".jpg") || fuSmallImg.FileName.ToLower().Contains(".png") || fuSmallImg.FileName.ToLower().Contains(".bmp") || fuSmallImg.FileName.ToLower().Contains(".gif"))
        {
            string filePath = "/Upload/Menu/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/";
            string fileName = DateTime.Now.Hour + "" + DateTime.Now.Minute + "" + DateTime.Now.Second + new Random().Next(10, 99);
            string tzm      = fuSmallImg.FileName.Substring(fuSmallImg.FileName.LastIndexOf("."));
            fuSmallImg.SaveAs(Server.MapPath(filePath + fileName + tzm));
            model.smallImgSrc = filePath + fileName + tzm;
            if (model.smallImgSrc != null && model.smallImgSrc != "")
            {
                llSmallImg.Text = "<img src='" + model.smallImgSrc + "' width='100px' height='100px'/>";
            }
        }
        else if (fuSmallImg.FileName != null && fuSmallImg.FileName != "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('预览图图片格式不正确');</script>");
            return;
        }

        if (menuId == null || menuId == "")
        {
            model.menuId  = IdCreator.CreateId("T_Menu_Info", "menuId");
            model.AddTime = DateTime.Now;
            if (new MenuBll().Add(model))
            {
                BindItemInfo(model.menuId);
                LogAdd.CreateLog(Session["UserId"].ToString(), "添加菜谱《" + model.menuName + "》", "添加", "", "", Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('添加成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            //model.menuId = IdCreator.CreateId("T_Menu_Info", "menuId");
            if (new MenuBll().Update(model))
            {
                BindItemInfo(model.menuId);
                LogAdd.CreateLog(Session["UserId"].ToString(), "修改菜谱《" + model.menuName + "》", "修改", "", "", Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
    }