/// <summary>
 /// 保存不确定度
 /// </summary>
 /// <param name="HTMLVALUE">html</param>
 /// <param name="URL">不确定计算存储地址</param>
 /// <returns></returns>
 public ActionResult JiSuanBuQueDingDuSave(string HTMLVALUE = "", string URL = "")
 {
     Common.ClientResult.Result result = new Common.ClientResult.Result();
     try
     {
         URL = GetBuQueDingDuUrl(URL);
         if (DirFile.FileExists(URL))
         {
             DirFile.DeleteFile(URL);
         }
         HTMLVALUE = Server.UrlDecode(HTMLVALUE);                                  //解码
         DirFile.SaveFile(HTMLVALUE, URL);
         LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + Url, "不确定度计算"); //写入日志
         result.Code    = Common.ClientCode.Succeed;
         result.Message = URL;
         return(Json(result)); //提示创建成功
     }
     catch (Exception ex)
     {
         LogClassModels.WriteServiceLog(Suggestion.InsertFail + Url + ":" + ex.Message, "不确定度计算");//写入日志
         result.Code    = Common.ClientCode.Fail;
         result.Message = Suggestion.InsertFail + ex.Message;
         return(Json(result)); //提示插入失败
     }
 }
Esempio n. 2
0
        public int Del(string curl, int id)
        {
            int result = new BLL.root.keJianBLL().Del(id);

            if (result != 0 && curl.Length != 0)
            {
                DirFile.DeleteFile(curl);
                DirFile.DeleteFiles(curl);
            }
            return(result);
        }
        public ActionResult Edit(string id, SysPerson entity)
        {
            if (entity != null && ModelState.IsValid)
            {                               //数据校验
                string oldPic = Request.Form["OldPic"];
                if (entity.HDpic != oldPic) //修改头像删除老的头像文件
                {
                    DirFile.DeleteFile(oldPic);
                }
                string currentPerson = GetCurrentPerson();
                entity.UpdateTime   = DateTime.Now;
                entity.UpdatePerson = currentPerson;

                //如果修改了密码,就将密码加密 2016830
                IBLL.IAccountBLL accountBLL = new AccountBLL();
                if (null == (accountBLL.ValidateUser(entity.Name, entity.Password)))
                {
                    entity.Password     = EncryptAndDecrypte.EncryptString(entity.Password);
                    entity.SurePassword = EncryptAndDecrypte.EncryptString(entity.SurePassword);
                }
                string returnValue = string.Empty;
                if (m_BLL.Edit(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",人员信息的Id为" + id, "人员"
                                                   );       //写入日志
                    App.Codes.MenuCaching.ClearCache(id);   //清除缓存
                    return(Json(Suggestion.UpdateSucceed)); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",人员信息的Id为" + id + "," + returnValue, "人员"
                                                   );                  //写入日志
                    return(Json(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }
            return(Json(Suggestion.UpdateFail + "请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
Esempio n. 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            #region 检查是否存在UpdateInfo.xml文件,如果不存在则启动设置窗口,创建UpdateInfo.xml文件,并配置该文件
            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "UpdateInfo.xml"))
            {
                //启动设置窗口
                SettingsForm settingForm = new SettingsForm();
                settingForm.ShowDialog();
            }

            #endregion
            #region 连接到FTP,下载最新的XML配置文件到临时文件夹
            //从原程序目录下读取XML文件中的FTP信息,并下载最新的XML文件
            FTPPath     = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "FTPInformation", "FTPPath");
            FTPUser     = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "FTPInformation", "FTPUser");
            FTPPassword = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "FTPInformation", "FTPPassword");
            //检查temp文件夹是否存在,并创建temp文件夹
            DirFile.CreateDir("temp");
            //将最新的XML文件下载到temp文件夹中
            ftp = new FTPHelper(FTPPath, "", FTPUser, FTPPassword);
            ftp.Download(FTPPath, AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\temp", "UpdateInfo.xml");
            #endregion

            #region 获取临时文件夹XML文件中的版本更新日期,以及原程序的版本更新日期
            //获取旧版本版本号及更新时间
            strOldAppName       = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationName");
            strOldAppVersion    = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationVersion");
            strOldAppUpdateTime = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationUpdateTime");
            strOldAppMessages   = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationMessages");
            //获取新版本版本号及更新时间
            strNewAppName       = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationName");
            strNewAppVersion    = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationVersion");
            strNewAppUpdateTime = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationUpdateTime");
            strNewAppMessages   = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationMessages");
            #endregion

            #region 比较两个版本的更新日期,提示用户是否升级,若选择不升级,则退出升级程序
            if (strOldAppVersion != strNewAppVersion || strOldAppUpdateTime != strNewAppUpdateTime)
            {
                VersionForm versionform = new VersionForm();
                versionform.ShowDialog();
            }
            else
            {
                Application.Exit();
            }
            #endregion

            #region 检测原程序是否在运行,若运行则杀死
            //检测原程序是否在运行,若运行则杀死。
            proc = Process.GetProcessesByName(strOldAppName);
            if (proc.Length != 0)
            {
                KillForm killform = new KillForm();
                killform.ShowDialog();
            }
            #endregion

            #region 开始批量下载文件到临时文件夹
            //下载FTP上的文件到temp文件夹
            string[] filelist = ftp.GetFileList(FTPPath);
            for (int i = 0; i < filelist.Length; i++)
            {
                ftp.Download(FTPPath, AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\temp", filelist[i]);
            }
            //下载FTP上的文件夹到temp文件夹(包括文件夹下内容),如果没有文件夹,则folderlist.Length=0,不执行下列循环
            string[] folderlist = ftp.GetFolderList(FTPPath);
            for (int i = 0; i < folderlist.Length; i++)
            {
                //根据得到的文件夹列表,在temp下创建相应的文件夹
                DirFile.CreateDir(@"\temp\" + folderlist[i]);
                //获取该文件夹下的文件列表,并下载到文件夹下
                string   ftpURI        = FTPPath + folderlist[i] + "/";
                string[] InnerFilelist = ftp.GetFileList(ftpURI);
                for (int j = 0; j < InnerFilelist.Length; j++)
                {
                    ftp.Download(ftpURI, AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\temp\" + folderlist[i], InnerFilelist[j]);
                }
            }
            #endregion

            #region 将原程序删除(包括文件和文件夹),拷贝临时文件夹中的文件到原目录
            //删除原程序中的文件
            string[] deletefilelist = DirFile.GetFileNames(AppDomain.CurrentDomain.BaseDirectory.ToString());
            for (int i = 0; i < deletefilelist.Length; i++)
            {
                if (!deletefilelist[i].Contains("UpdateProgram") & !deletefilelist[i].Contains("CSkin"))
                {
                    DirFile.DeleteFile(deletefilelist[i]);
                }
            }
            //删除原程序中的文件夹
            string[] deletefolderlist = DirFile.GetFolderNames(AppDomain.CurrentDomain.BaseDirectory.ToString());
            for (int i = 0; i < deletefolderlist.Length; i++)
            {
                if (!deletefolderlist[i].Contains("temp") & !deletefolderlist[i].Contains("Backup"))
                {
                    DirFile.DeleteDirectory(deletefolderlist[i]);
                }
            }
            //拷贝temp文件夹下文件到原程序目录
            string[] copyfilelist = DirFile.GetFileNames(AppDomain.CurrentDomain.BaseDirectory.ToString() + "temp");
            string[] strFileName  = new string[copyfilelist.Length];
            for (int i = 0; i < copyfilelist.Length; i++)
            {
                strFileName[i] = Path.GetFileName(copyfilelist[i]);
                DirFile.CopyFile(copyfilelist[i], AppDomain.CurrentDomain.BaseDirectory.ToString() + strFileName[i]);
            }
            //拷贝temp文件夹下文件夹到原程序目录
            string[] copyfolderlist = DirFile.GetFolderNames(AppDomain.CurrentDomain.BaseDirectory.ToString() + "temp");
            string[] strFolderName  = new string[copyfolderlist.Length];
            for (int i = 0; i < copyfolderlist.Length; i++)
            {
                strFolderName[i] = Path.GetFileName(copyfolderlist[i]);
                DirFile.CopyFolder(copyfolderlist[i], AppDomain.CurrentDomain.BaseDirectory.ToString() + strFolderName[i]);
            }
            #endregion

            #region 拷贝完成后,删除temp文件夹,提示更新完毕,然后启动新的主程序
            DirFile.DeleteDirectory(AppDomain.CurrentDomain.BaseDirectory.ToString() + "temp");
            Process.Start(strNewAppName + ".exe");
            #endregion

            Application.Run(new UpdateForm());
        }
Esempio n. 5
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            #region 获取字段值并赋给变量
            string title = txtTitle.Value.Trim();             //标题
            string col   = ddlColumn.SelectedValue;           //栏目
            //string type = ddlType.SelectedValue;//类型
            string author      = txtAuthor.Value.Trim();      //作者
            string from        = txtFrom.Value.Trim();        //来源
            string description = tarDescription.Value.Trim(); //导读
            string content     = tarContent.Value.Trim();     //详细内容
            bool   isTop       = rboIsTopTrue.Checked;        //是否置顶
            //bool isFlash = rboIsFlashTrue.Checked;//是否幻灯
            #endregion
            #region  验证输入内容
            if (string.IsNullOrEmpty(title))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入标题');</script>");
                txtTitle.Focus();
                return;
            }
            if (string.IsNullOrEmpty(col) || col == "0") //判断栏目
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择栏目');</script>");
                ddlColumn.Focus();
                return;
            }
            //if (string.IsNullOrEmpty(type) || type == "0") //判断类型
            //{
            //    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择类型');</script>");
            //    ddlType.Focus();
            //    return;
            //}
            //if (string.IsNullOrEmpty(author)) //判断库存是否为空
            //{
            //    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入作者');</script>");
            //    txtAuthor.Focus();
            //    return;
            //}
            //if (string.IsNullOrEmpty(from)) //判断库存是否为空
            //{
            //    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入来源');</script>");
            //    txtFrom.Focus();
            //    return;
            //}
            //if (Request.QueryString["AId"] == "0")
            //{
            //    if (isFlash)
            //    {
            //        if (!fuPFlash.HasFile)
            //        {
            //            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择幻灯图片');</script>");
            //            fuPFlash.Focus();
            //            return;
            //        }
            //    }
            //}
            if (string.IsNullOrEmpty(description)) //判断商品概述是否为空
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入导读');</script>");
                tarDescription.Focus();
                return;
            }
            if (string.IsNullOrEmpty(content)) //判断商品概述是否为空
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入详细内容');</script>");
                tarContent.Focus();
                return;
            }

            #endregion
            //修改信息
            if (!string.IsNullOrEmpty(AId)) //判断商品Id是否为空,如果不为空就是编辑数据
            {
                #region 修改内容
                try
                {
                    #region 查询编辑对象,并赋值给对象字段
                    //查询编辑的商品信息
                    aModel = aDAL.GetModel(Convert.ToInt32(AId)); //查询产品信息
                    if (aModel != null)                           //判断编辑果品对象是否为空
                    {
                        aModel.Title = title;                     //商品名称
                        aModel.ColId = Convert.ToInt32(col);      //产品概述
                        //aModel.ATId = Convert.ToInt32(type); //产品描述
                        aModel.Author      = author;
                        aModel.Source      = from;
                        aModel.Description = description;
                        aModel.Content     = content;
                        aModel.CheckTime   = DateTime.Now;
                        //aModel.PEmplId=  修改人
                        //审核人
                        if (isTop)
                        {
                            aModel.IsTop = 1;
                        }
                        else
                        {
                            aModel.IsTop = 0;
                        }
                        //if (isFlash)
                        //{
                        //    aModel.IsSplendid = 1;
                        //}
                        //else
                        //{
                        //    aModel.IsSplendid = 0;
                        //}
                        #endregion

                        if (!fuPFlash.HasFile && attDAL.GetModel(Convert.ToInt32(AId), 0) == null)
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                    "<script>alert('请选择幻灯');</script>");
                            fuPFlash.Focus();
                            return;
                        }

                        if (fuPFlash.HasFile)
                        {
                            int    sizeFlash;
                            string msgFlash;
                            string imgFlashUrl;
                            if (attDAL.Exists(Convert.ToInt32(AId), 0))     //判断图片地址是否存在
                            {
                                attModel = attDAL.GetModel(Convert.ToInt32(AId), 0);
                                DirFile.DeleteFile(attModel.AttName);     // 删除图片地址

                                UpImg(ref fuPFlash, out imgFlashUrl, out msgFlash, imgPath, out sizeFlash);
                                //上传图片(无水印)
                                if (string.IsNullOrEmpty(imgFlashUrl))
                                {
                                    Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                            "<script>alert('" + msgFlash + "');</script>");
                                    return;
                                }
                                attModel.AttName = imgFlashUrl;     //幻灯地址
                                if (!attDAL.Update(attModel))
                                {
                                    return;
                                }
                            }
                            else
                            {
                                UpImg(ref fuPFlash, out imgFlashUrl, out msgFlash, imgPath, out sizeFlash);
                                //上传图片(无水印)
                                if (string.IsNullOrEmpty(imgFlashUrl))
                                {
                                    Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                            "<script>alert('" + msgFlash + "');</script>");
                                    return;
                                }
                                attModel.AttName = imgFlashUrl;     //幻灯地址
                                attModel.Type    = 0;
                                attModel.AId     = Convert.ToInt32(AId);
                                attModel.Status  = 1;
                                if (!(attDAL.Add(attModel) > 0))
                                {
                                    return;
                                }
                            }
                        }

                        bool re = aDAL.Update(aModel);
                        if (re)
                        {
                            System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                              "<script>alert('修改成功'); window.location = 'CMArticle.aspx';</script>", false);//跳转页面
                        }
                        else
                        {
                            System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                              "<script>alert('修改失败'); ", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                #endregion
            }
            else //新增信息
            {
                #region 新增信息
                try
                {
                    #region 给果品实体对象字段赋值
                    aModel.Title = title;                //商品名称
                    aModel.ColId = Convert.ToInt32(col); //产品概述
                    //aModel.ATId = Convert.ToInt32(type); //产品描述
                    aModel.Author      = author;
                    aModel.Source      = from;
                    aModel.Description = description;
                    aModel.Content     = content;
                    aModel.Status      = 0;
                    aModel.AddTime     = DateTime.Now;
                    if (isTop)
                    {
                        aModel.IsTop = 1;
                    }
                    else
                    {
                        aModel.IsTop = 0;
                    }
                    //if (isFlash)
                    //{
                    //    aModel.IsSplendid = 1;
                    //}
                    //else
                    //{
                    //    aModel.IsSplendid = 0;
                    //}
                    #endregion

                    if (!fuPFlash.HasFile)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                "<script>alert('请选择幻灯');</script>");
                        fuPFlash.Focus();
                        return;
                    }
                    if (fuPFlash.HasFile)
                    {
                        int    sizeFlash;
                        string msgFlash;
                        string imgFlashUrl;
                        UpImg(ref fuPFlash, out imgFlashUrl, out msgFlash, imgPath, out sizeFlash);    //上传图片
                        if (string.IsNullOrEmpty(imgFlashUrl))
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                    "<script>alert('" + msgFlash + "');</script>");
                            return;
                        }

                        attModel.Type    = 0;
                        attModel.AttName = imgFlashUrl;     //幻灯地址
                        attModel.Status  = 1;
                    }
                    aModel.ATId = 1;
                    int re = aDAL.Add(aModel); //增加方法
                    if (re > 0)                //判断商品增加是否成功
                    {
                        attModel.AId = re;
                        if (attDAL.Add(attModel) > 0)
                        {
                            System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                              "<script>alert('新增成功'); window.location = 'CMArticle.aspx';</script>", false);//跳转页面
                        }
                        else
                        {
                            System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                              "<script>alert('新增失败'); ", false);
                        }
                    }
                    else
                    {
                        System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                          "<script>alert('新增失败'); ", false);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                #endregion
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 保存方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            #region 获取字段值并赋给变量
            string title       = txtTitle.Value.Trim();       //标题
            string col         = ddlColumn.SelectedValue;     //栏目
            string type        = ddlType.SelectedValue;       //类型
            string author      = txtAuthor.Value.Trim();      //作者
            string from        = txtFrom.Value.Trim();        //来源
            string description = tarDescription.Value.Trim(); //导读
            string content     = tarContent.Value.Trim();     //详细内容
            bool   isTop       = rboIsTopTrue.Checked;        //是否置顶
            string displayTime = txtDisplayTime.Value;        //显示时长
            #endregion
            #region  验证输入内容
            if (string.IsNullOrEmpty(title))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入标题');</script>");
                txtTitle.Focus();
                return;
            }
            if (string.IsNullOrEmpty(col) || col == "0") //判断栏目
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择栏目');</script>");
                ddlColumn.Focus();
                return;
            }
            if (string.IsNullOrEmpty(type) || type == "0") //判断类型
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择类型');</script>");
                ddlType.Focus();
                return;
            }
            //if (string.IsNullOrEmpty(author)) //判断库存是否为空
            //{
            //    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入作者');</script>");
            //    txtAuthor.Focus();
            //    return;
            //}
            //if (string.IsNullOrEmpty(from)) //判断库存是否为空
            //{
            //    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入来源');</script>");
            //    txtFrom.Focus();
            //    return;
            //}
            //if (Request.QueryString["AId"] == "0")
            //{
            //    if (isFlash)
            //    {
            //        if (!fuPFlash.HasFile)
            //        {
            //            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择幻灯图片');</script>");
            //            fuPFlash.Focus();
            //            return;
            //        }
            //    }
            //}
            if (string.IsNullOrEmpty(description)) //判断商品概述是否为空
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入导读');</script>");
                tarDescription.Focus();
                return;
            }
            if (string.IsNullOrEmpty(content)) //判断商品概述是否为空
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入详细内容');</script>");
                tarContent.Focus();
                return;
            }
            if (string.IsNullOrEmpty(displayTime)) //判断商品概述是否为空
            {
                displayTime = "0";
            }
            else
            {
                try
                {
                    Convert.ToInt32(displayTime);
                }
                catch (Exception)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('显示时长请输入数字');</script>");
                    tarContent.Focus();
                    return;
                }
            }
            #endregion
            //修改信息
            if (!string.IsNullOrEmpty(hidAId.Value)) //判断商品Id是否为空,如果不为空就是编辑数据
            {
                #region 修改内容
                try
                {
                    List <Logs.InfoLog> infolist = new List <Logs.InfoLog>();
                    #region 查询编辑对象,并赋值给对象字段
                    //查询编辑的商品信息
                    aModel = aDAL.GetModel(Convert.ToInt32(hidAId.Value)); //查询产品信息
                    if (aModel != null)                                    //判断编辑果品对象是否为空
                    {
                        if (title != aModel.Title)
                        {
                            infolist.Add(new Logs.InfoLog(title, aModel.Title, "文章标题"));
                        }
                        aModel.Title = title; //文章标题

                        string orgId = Session["OrgId"] != null ? Session["OrgId"].ToString() : "";
                        if (!string.IsNullOrEmpty(orgId))
                        {
                            if (Convert.ToInt32(orgId) != aModel.OrgId)
                            {
                                infolist.Add(new Logs.InfoLog(orgId, aModel.OrgId.ToString(), "生产厂商"));
                            }
                            aModel.OrgId = Convert.ToInt32(orgId); //生产厂商
                        }

                        if (Convert.ToInt32(col) != aModel.ColId)
                        {
                            ECommerce.CM.DAL.CMColumn cmColumnDal = new ECommerce.CM.DAL.CMColumn();
                            var cmColimnInfo = cmColumnDal.GetModel(Convert.ToInt32(aModel.ColId));
                            infolist.Add(new Logs.InfoLog(ddlColumn.SelectedItem.Text, cmColimnInfo.ColName.ToString(), "栏目"));
                        }
                        aModel.ColId = Convert.ToInt32(col); //栏目
                        if (Convert.ToInt32(type) != aModel.ATId)
                        {
                            ECommerce.CM.DAL.CMArticleType cmArticleDal = new ECommerce.CM.DAL.CMArticleType();
                            var cmColimnInfo = cmArticleDal.GetModel(Convert.ToInt32(aModel.ATId));
                            infolist.Add(new Logs.InfoLog(ddlType.SelectedItem.Text, cmColimnInfo.ATName.ToString(), "类型"));
                        }
                        aModel.ATId = Convert.ToInt32(type); //类型
                        if (author != aModel.Author)
                        {
                            infolist.Add(new Logs.InfoLog(author, aModel.Author, "作者"));
                        }
                        aModel.Author = author;
                        if (from != aModel.Source)
                        {
                            infolist.Add(new Logs.InfoLog(from, aModel.Source, "来源"));
                        }
                        aModel.Source = from;
                        if (description != aModel.Description)
                        {
                            infolist.Add(new Logs.InfoLog(description, aModel.Description, "内容导读"));
                        }
                        aModel.Description = description;
                        if (content != aModel.Content)
                        {
                            infolist.Add(new Logs.InfoLog(content, aModel.Content, "详细内容"));
                        }
                        aModel.Content = content;

                        aModel.CheckTime   = DateTime.Now;
                        aModel.DisplayTime = Convert.ToInt32(displayTime);
                        //aModel.PEmplId=  修改人
                        //审核人
                        if (isTop)
                        {
                            if (1 != aModel.IsTop)
                            {
                                infolist.Add(new Logs.InfoLog("1", aModel.IsTop.ToString(), "是否置顶"));
                            }
                            aModel.IsTop = 1;
                        }
                        else
                        {
                            if (0 != aModel.IsTop)
                            {
                                infolist.Add(new Logs.InfoLog("0", aModel.IsTop.ToString(), "是否置顶"));
                            }
                            aModel.IsTop = 0;
                        }

                        #endregion

                        if (fuPFlash.HasFile)
                        {
                            int    sizeFlash;
                            string msgFlash;
                            string imgFlashUrl;
                            if (attDAL.Exists(Convert.ToInt32(hidAId.Value), 0)) //判断图片地址是否存在
                            {
                                attModel = attDAL.GetModel(Convert.ToInt32(hidAId.Value), 0);
                                attMod   = attDAL.GetModel(Convert.ToInt32(hidAId.Value), 0);
                                DirFile.DeleteFile(attModel.AttName); // 删除图片地址

                                UpImg(ref fuPFlash, out imgFlashUrl, out msgFlash, imgPath, out sizeFlash);
                                //上传图片(无水印)
                                if (string.IsNullOrEmpty(imgFlashUrl))
                                {
                                    Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                            "<script>alert('" + msgFlash + "');</script>");
                                    return;
                                }
                                attModel.AttName = imgFlashUrl; //幻灯地址
                                if (!attDAL.Update(attModel))
                                {
                                    return;
                                }
                            }
                            else
                            {
                                UpImg(ref fuPFlash, out imgFlashUrl, out msgFlash, imgPath, out sizeFlash);
                                //上传图片(无水印)
                                if (string.IsNullOrEmpty(imgFlashUrl))
                                {
                                    Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                            "<script>alert('" + msgFlash + "');</script>");
                                    return;
                                }
                                attModel.AttName = imgFlashUrl; //幻灯地址
                                attModel.Type    = 0;
                                attModel.AId     = Convert.ToInt32(hidAId.Value);
                                attModel.Status  = 1;
                                if (!(attDAL.Add(attModel) > 0))
                                {
                                    return;
                                }
                            }
                        }
                        attDAL.DeleteByAid(Convert.ToInt32(hidAId.Value));
                        string attName = atts.Value;
                        if (!string.IsNullOrEmpty(attName))
                        {
                            var attNames = attName.Split(',');
                            for (int i = 0; i < attNames.Length - 1; i++)
                            {
                                if (!string.IsNullOrEmpty(attNames[i]))
                                {
                                    attMod.AId     = Convert.ToInt32(hidAId.Value);
                                    attMod.Type    = 1;
                                    attMod.AttName = attNames[i];

                                    attMod.Status = 1;
                                    attDAL.Add(attMod);
                                }
                            }
                        }

                        bool re = aDAL.Update(aModel);
                        if (re)
                        {
                            string orgAreaIds = Session["OrgAreaIds"] != null ? Session["OrgAreaIds"].ToString() : "";
                            if (!string.IsNullOrEmpty(orgAreaIds))
                            {
                                bool res = cmAreaDal.AddList(hidAId.Value, orgAreaIds);
                                if (res)
                                {
                                    if (infolist.Count > 0)
                                    {
                                        _logsDal.WriteLogs(infolist, CurrentUser.EmplId.ToString(), aModel.AId, DateTime.Now, "CMArticle");
                                    }
                                }
                                else
                                {
                                    System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                                      "<script>alert('修改区域失败'); </script>", false);
                                }
                            }
                            else
                            {
                                if (infolist.Count > 0)
                                {
                                    _logsDal.WriteLogs(infolist, CurrentUser.EmplId.ToString(), aModel.AId, DateTime.Now, "CMArticle");
                                }
                            }
                            Session["OrgAreaIds"] = null;

                            string aid  = hidAId.Value;
                            string pids = Session["PIDS"] != null ? Session["PIDS"].ToString() : "";

                            if (!string.IsNullOrEmpty(aid) && !string.IsNullOrEmpty(pids))
                            {
                                int res = cmProDal.AddPro(Convert.ToInt32(aid), pids);
                                if (res > 0)
                                {
                                    if (infolist.Count > 0)
                                    {
                                        _logsDal.WriteLogs(infolist, CurrentUser.EmplId.ToString(), aModel.AId, DateTime.Now, "CMPro");
                                    }
                                }
                                else
                                {
                                    System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                                      "<script>alert('修改关联商品失败'); </script>", false);
                                }
                            }
                            else
                            {
                                if (infolist.Count > 0)
                                {
                                    _logsDal.WriteLogs(infolist, CurrentUser.EmplId.ToString(), aModel.AId, DateTime.Now, "CMArticle");
                                }
                            }
                            Session["AID"]   = null;
                            Session["PIDS"]  = null;
                            Session["OrgId"] = null;

                            System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                              "<script>window.location = '/Manage/CM/CMArticle.aspx?Page=" + page + "';</script>", false);//跳转页面
                        }
                        else
                        {
                            System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                              "<script>alert('修改失败'); </script>", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                #endregion
            }
            else //新增信息
            {
                #region 新增信息
                try
                {
                    #region 给果品实体对象字段赋值
                    aModel.Title = title; //商品名称
                    string orgId = Session["OrgId"] != null ? Session["OrgId"].ToString() : "";
                    if (!string.IsNullOrEmpty(orgId))
                    {
                        aModel.OrgId = Convert.ToInt32(orgId);  //生产厂商
                    }
                    aModel.ColId       = Convert.ToInt32(col);  //产品概述
                    aModel.ATId        = Convert.ToInt32(type); //产品描述
                    aModel.Author      = author;
                    aModel.Source      = from;
                    aModel.Description = description;
                    aModel.Content     = content;
                    aModel.Hits        = 0;
                    aModel.Status      = 0;
                    aModel.AddTime     = DateTime.Now;
                    aModel.DisplayTime = Convert.ToInt32(displayTime);
                    if (isTop)
                    {
                        aModel.IsTop = 1;
                    }
                    else
                    {
                        aModel.IsTop = 0;
                    }

                    #endregion
                    int re = aDAL.Add(aModel); //增加方法

                    if (fuPFlash.HasFile)
                    {
                        int    sizeFlash;
                        string msgFlash;
                        string imgFlashUrl;
                        UpImg(ref fuPFlash, out imgFlashUrl, out msgFlash, imgPath, out sizeFlash);//上传图片
                        if (string.IsNullOrEmpty(imgFlashUrl))
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                    "<script>alert('" + msgFlash + "');</script>");
                            return;
                        }

                        attModel.Type    = 0;
                        attModel.AttName = imgFlashUrl; //幻灯地址
                        attModel.Status  = 1;
                        attModel.AId     = re;
                        attDAL.Add(attModel);
                    }

                    string attName = atts.Value;
                    if (!string.IsNullOrEmpty(attName))
                    {
                        var attNames = attName.Split(',');
                        for (int i = 0; i < attNames.Length - 1; i++)
                        {
                            if (!string.IsNullOrEmpty(attNames[i]))
                            {
                                attMod.AId     = re;
                                attMod.Type    = 1;
                                attMod.AttName = attNames[i];
                                attMod.Status  = 1;
                                attDAL.Add(attMod);
                            }
                        }
                    }
                    if (re > 0) //判断商品增加是否成功
                    {
                        string orgAreaIds = Session["OrgAreaIds"] != null ? Session["OrgAreaIds"].ToString() : "";
                        if (!string.IsNullOrEmpty(orgAreaIds))
                        {
                            bool res = cmAreaDal.AddList(re.ToString(), orgAreaIds);
                            if (res)
                            {
                                System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "", "<script>window.location = '/Manage/CM/CMArticle.aspx?Page=" + page + "';</script>", false);//跳转页面
                            }
                            else
                            {
                                System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                                  "<script>alert('新增区域失败'); </script>", false);
                            }
                        }
                        Session["OrgAreaIds"] = null;

                        string aid  = re.ToString();
                        string pids = Session["PIDS"] != null ? Session["PIDS"].ToString() : "";
                        if (!string.IsNullOrEmpty(aid) && !string.IsNullOrEmpty(pids))
                        {
                            int res = cmProDal.AddPro(Convert.ToInt32(aid), pids);
                            if (res > 0)
                            {
                                page = Request.QueryString["Page"] == null ? 1 : Convert.ToInt32(Request.QueryString["Page"]);
                                System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "", "<script>window.location = '/Manage/CM/CMArticle.aspx?Page=" + page + "';</script>", false);//跳转页面
                            }
                            else
                            {
                                System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                                  "<script>alert('新增关联商品失败');</script> ", false);
                            }
                        }
                        Session["AID"]   = null;
                        Session["PIDS"]  = null;
                        Session["OrgId"] = null;
                        System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "", "<script>window.location = '/Manage/CM/CMArticle.aspx';</script>", false);//跳转页面
                    }
                    else
                    {
                        System.Web.UI.ScriptManager.RegisterStartupScript(Page, GetType(), "",
                                                                          "<script>alert('新增失败'); </script>", false);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                #endregion
            }
        }
Esempio n. 7
0
        protected void btnSub_Click(object sender, EventArgs e)
        {
            const string imgPath = "/UpLoad/Image";
            var          name    = txtName.Value.Trim();
            var          type    = ddltype.SelectedValue;
            var          addr    = txtaddr.Value;
            var          descr   = txtdescr.Value;
            var          age     = txtage.Value;
            var          job     = txtjob.Value;
            var          ser     = txtserch.Value;
            var          edu     = txtedu.Value;

            if (string.IsNullOrEmpty(name))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写专家姓名!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(type))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择所属分类!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(addr))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写工作单位!');</script>");
                return;
            }

            if (string.IsNullOrEmpty(descr))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写专家简介!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(age))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写专家年龄!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(job))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写职称/职务!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(ser))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写研究方向!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(edu))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写学历!');</script>");
                return;
            }


            if (!string.IsNullOrEmpty(Request.QueryString["OrgId"]))
            {
                try {
                    List <SqlParameter> parameters = new List <SqlParameter>();
                    var parameter = new SqlParameter("@OrgId", DbType.AnsiString)
                    {
                        Value = Request.QueryString["OrgId"]
                    };
                    parameters.Add(parameter);
                    var dt = _dataDal.GetModel(Convert.ToInt32(Request.QueryString["OrgId"]));
                    if (null == dt)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('专家信息不存在!');</script>");
                        return;
                    }
                    var exists =
                        _dataDal.GetModel(
                            " Name='" + name + "' and PIID!=" + Convert.ToInt32(Request.QueryString["OrgId"]),
                            new List <SqlParameter>());
                    if (null != exists)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('专家信息已经存在!');</script>");
                        return;
                    }
                    dt.Age         = age;
                    dt.ComAddr     = addr;
                    dt.Descri      = descr;
                    dt.Education   = edu;
                    dt.Job         = job;
                    dt.MajorSearch = ser;
                    dt.Name        = name;
                    dt.PTID        = Convert.ToInt32(type);
                    dt.UId         = CurrentUser.UId;

                    if (fuPImg.HasFile)
                    {
                        if (!string.IsNullOrEmpty(dt.Photo))
                        {
                            DirFile.DeleteFile(dt.Photo);
                        }
                        int    size;
                        string msg;
                        string imgUrl;
                        UpImg(ref fuPImg, out imgUrl, out msg, imgPath, out size);
                        if (string.IsNullOrEmpty(imgUrl))
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                            return;
                        }
                        dt.Photo = imgUrl;
                    }
                    var res = _dataDal.Update(dt);
                    if (res)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                "<script>window.top.$op.location=window.top.$op.location;window.top.$modal.destroy();</script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('更新失败!');window.top.$modal.destroy();</script>");
                    }
                }
                catch (Exception) {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('操作失败!');window.top.$modal.destroy();</script>");
                }
            }
            else
            {
                var model = new ECommerce.Admin.Model.ProfInfo {
                    Age         = age,
                    Descri      = descr,
                    ComAddr     = addr,
                    CreateDate  = DateTime.Now,
                    Education   = edu,
                    Job         = job,
                    MajorSearch = ser,
                    Name        = name,
                    PTID        = Convert.ToInt32(type),
                    Status      = 1
                };
                var exists = _dataDal.GetModel(" Name='" + name + "' ", new List <SqlParameter>());
                if (null != exists)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('专家信息已经存在!');</script>");
                    return;
                }
                if (fuPImg.HasFile)
                {
                    int    size;
                    string msg;
                    string imgUrl;
                    UpImg(ref fuPImg, out imgUrl, out msg, imgPath, out size);
                    if (string.IsNullOrEmpty(imgUrl))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                        return;
                    }
                    model.Photo = imgUrl;
                }
                var resAdd = _dataDal.Add(model);
                if (resAdd > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                            "<script>window.top.$op.location=window.top.$op.location;window.top.$modal.destroy();</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('新增失败!');window.top.$modal.destroy();</script>");
                }
            }
        }
Esempio n. 8
0
        protected void btnSub_Click(object sender, EventArgs e)
        {
            const string imgPath   = "/UpLoad/Image";
            var          name      = txtName.Value.Trim();
            var          addr      = txtaddr.Value;
            var          Contact   = txtContact.Value;
            var          MajorSell = txtMajorSell.Value;
            var          descri    = txtdescri.Value;
            var          fr        = txtfr.Value;
            var          tel       = txttel.Value;
            var          email     = txtemail.Value;

            if (string.IsNullOrEmpty(name))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写机构名称!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(addr))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写地址!');</script>");
                return;
            }

            if (string.IsNullOrEmpty(Contact))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写联系人!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(fr))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写法人!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(MajorSell))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写主营方向!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(descri))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写机构简介!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(tel))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写联系电话!');</script>");
                return;
            }
            if (string.IsNullOrEmpty(email))
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请填写邮箱!');</script>");
                return;
            }


            if (!string.IsNullOrEmpty(Request.QueryString["OrgId"]))
            {
                try {
                    List <SqlParameter> parameters = new List <SqlParameter>();
                    var parameter = new SqlParameter("@OrgId", DbType.AnsiString)
                    {
                        Value = Request.QueryString["OrgId"]
                    };
                    parameters.Add(parameter);
                    var dt = _dataDal.GetModel(Convert.ToInt32(Request.QueryString["OrgId"]));
                    if (null == dt)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('机构信息不存在!');</script>");
                        return;
                    }
                    var exists =
                        _dataDal.GetModel(
                            " Name='" + name + "' and OID!=" + Convert.ToInt32(Request.QueryString["OrgId"]),
                            new List <SqlParameter>());
                    if (null != exists)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('机构名称已经存在!');</script>");
                        return;
                    }
                    dt.Email      = email;
                    dt.Addr       = addr;
                    dt.Contact    = Contact;
                    dt.FR         = fr;
                    dt.MajorSell  = MajorSell;
                    dt.Tel        = tel;
                    dt.Name       = name;
                    dt.UpdateDate = DateTime.Now;
                    dt.UId        = CurrentUser.UId;
                    dt.Descr      = descri;
                    if (fuPImg.HasFile)
                    {
                        if (!string.IsNullOrEmpty(dt.OrgAptitude))
                        {
                            DirFile.DeleteFile(dt.OrgAptitude);
                        }
                        int    size;
                        string msg;
                        string imgUrl;
                        UpImg(ref fuPImg, out imgUrl, out msg, imgPath, out size);
                        if (string.IsNullOrEmpty(imgUrl))
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                            return;
                        }
                        dt.OrgAptitude = imgUrl;
                    }
                    if (FileUpload1.HasFile)
                    {
                        if (!string.IsNullOrEmpty(dt.YYZZ))
                        {
                            DirFile.DeleteFile(dt.YYZZ);
                        }
                        int    size;
                        string msg;
                        string imgUrl;
                        UpImg(ref FileUpload1, out imgUrl, out msg, imgPath, out size);
                        if (string.IsNullOrEmpty(imgUrl))
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                            return;
                        }
                        dt.YYZZ = imgUrl;
                    }
                    if (FileUpload2.HasFile)
                    {
                        if (!string.IsNullOrEmpty(dt.Logo))
                        {
                            DirFile.DeleteFile(dt.Logo);
                        }
                        int    size;
                        string msg;
                        string imgUrl;
                        UpImg(ref FileUpload2, out imgUrl, out msg, imgPath, out size);
                        if (string.IsNullOrEmpty(imgUrl))
                        {
                            Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                            return;
                        }
                        dt.Logo = imgUrl;
                    }
                    var res = _dataDal.Update(dt);
                    if (res)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                                "<script>window.top.$op.location=window.top.$op.location;window.top.$modal.destroy();</script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('更新失败!');window.top.$modal.destroy();</script>");
                    }
                }
                catch (Exception) {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('操作失败!');window.top.$modal.destroy();</script>");
                }
            }
            else
            {
                var model = new ECommerce.Admin.Model.ProfOrg {
                    Descr      = descri,
                    Tel        = tel,
                    Email      = email,
                    CreateDate = DateTime.Now,
                    Addr       = addr,
                    FR         = fr,
                    MajorSell  = MajorSell,
                    Name       = name,
                    UId        = CurrentUser.UId,
                    Contact    = Contact,
                    Status     = 1
                };
                var exists = _dataDal.GetModel(" Name='" + name + "' ", new List <SqlParameter>());
                if (null != exists)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('机构名称已经存在!');</script>");
                    return;
                }
                if (fuPImg.HasFile)
                {
                    int    size;
                    string msg;
                    string imgUrl;
                    UpImg(ref fuPImg, out imgUrl, out msg, imgPath, out size);
                    if (string.IsNullOrEmpty(imgUrl))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                        return;
                    }
                    model.OrgAptitude = imgUrl;
                }
                if (FileUpload1.HasFile)
                {
                    int    size;
                    string msg;
                    string imgUrl;
                    UpImg(ref FileUpload1, out imgUrl, out msg, imgPath, out size);
                    if (string.IsNullOrEmpty(imgUrl))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                        return;
                    }
                    model.YYZZ = imgUrl;
                }
                if (FileUpload2.HasFile)
                {
                    int    size;
                    string msg;
                    string imgUrl;
                    UpImg(ref FileUpload2, out imgUrl, out msg, imgPath, out size);
                    if (string.IsNullOrEmpty(imgUrl))
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + msg + "');</script>");
                        return;
                    }
                    model.Logo = imgUrl;
                }
                var resAdd = _dataDal.Add(model);
                if (resAdd > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "",
                                                            "<script>window.top.$op.location=window.top.$op.location;window.top.$modal.destroy();</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('新增失败!');window.top.$modal.destroy();</script>");
                }
            }
        }