public HttpResponseBase PromoAdditionalPriceEdit()
        {
            string jsonStr = String.Empty;
            _promoadditionproceMgr = new PromoAdditionalPriceMgr(mySqlConnectionString);
            PromoAdditionalPrice model = new PromoAdditionalPrice();
            PromoAdditionalPrice oldermodel = new PromoAdditionalPrice();
            PromoAdditionalPriceQuery PPQuery = new PromoAdditionalPriceQuery();
            ProductCategory olderpcmodel = new ProductCategory();
            PromoAdditionalPriceQuery oldPPQuery = new PromoAdditionalPriceQuery();
            if (!String.IsNullOrEmpty(Request.Params["rowid"]))
            {
                try
                {
                    model.id = Convert.ToInt32(Request.Params["rowid"].ToString());
                    oldermodel = _promoadditionproceMgr.GetModel(model.id);
                    model.category_id = oldermodel.category_id;
                    olderpcmodel = _produCateMgr.GetModelById(Convert.ToUInt32(model.category_id));
                    model.event_name = Request.Params["event_name"].ToString();
                    model.event_desc = Request.Params["event_desc"].ToString();
                    model.event_type = oldermodel.event_type;
                    if (!string.IsNullOrEmpty(Request.Params["url_by"]))
                    {
                        model.url_by =Convert.ToInt32(Request.Params["url_by"]);
                    }
                    #region 會員群組 會員條件
                    if (Request.Params["group_id"].ToString() != "")
                    {
                        try//group_id
                        {
                            model.group_id = Convert.ToInt32(Request.Params["group_id"].ToString());
                        }
                        catch (Exception)
                        {
                            model.group_id = oldermodel.group_id;
                        }
                        model.condition_id = 0;
                    }
                    if (Request.Params["condition_id"].ToString() != "" && Request.Params["condition_id"].ToString() != "0")
                    {
                        try//condition_id
                        {
                            model.condition_id = Convert.ToInt32(Request.Params["condition_id"].ToString());
                        }
                        catch (Exception)
                        {
                            model.condition_id = oldermodel.condition_id;
                        }
                        model.group_id = 0;
                    }
                    #endregion
                    model.deliver_type = Convert.ToInt32(Request.Params["deliver_id"].ToString());
                    model.device = Request.Params["device_id"].ToString();
                    model.website = Request.Params["side"].ToString();
                    PPQuery.event_id = GetEventId(model.event_type, model.id.ToString());
                    try
                    {
                        model.fixed_price = Convert.ToInt32(Request.Params["fixed_price"].ToString());
                    }
                    catch (Exception)
                    {
                        model.fixed_price = oldermodel.fixed_price;
                    }
                    try
                    {
                        model.buy_limit = Convert.ToInt32(Request.Params["buy_limit"].ToString());
                    }
                    catch (Exception)
                    {
                        model.fixed_price = oldermodel.fixed_price;
                    }
                    model.starts = Convert.ToDateTime(Request.Params["starts"].ToString());
                    //string s = Request.Params["starts"];
                    //model.starts = DateTime.Parse(Request.Params["starts"]);
                    model.end = Convert.ToDateTime(Request.Params["end"].ToString());
                    model.muser = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString();
                    model.modified = DateTime.Now;
                    //20140925 add 折扣
                    if (model.event_type == "A3")
                    {
                        model.discount = Int32.Parse(Request.Params["discount"].ToString());
                    }
                    else
                    {
                        model.discount = 0;
                    }
                    PPQuery.category_ipfrom = Request.UserHostAddress;
                    PPQuery.event_id = GetEventId(model.event_type, model.id.ToString());
                    try//存連接地址
                    {
                        PPQuery.category_link_url = Request.Params["banner_url"].ToString();
                        if (PPQuery.category_link_url == "" || PPQuery.category_link_url == null)
                        {
                            model.url_by = 0;
                            //刪除上傳的圖片
                            string oldFileName = olderpcmodel.banner_image;
                            FTP ftp = new FTP(imgLocalPath + promoPath, ftpuser, ftppwd);
                            List<string> tem = ftp.GetFileList();
                            if (tem.Contains(oldFileName))
                            {
                                FTP ftps = new FTP(imgLocalPath + promoPath + oldFileName, ftpuser, ftppwd);
                                ftps.DeleteFile(imgLocalPath + promoPath + oldFileName);//刪除ftp:71.159上的舊圖片
                                DeletePicFile(Server.MapPath(imgLocalServerPath + promoPath) + oldFileName);//刪除本地圖片
                            }
                            PPQuery.category_link_url = "";
                            PPQuery.banner_image = "";
                        }
                        else
                        {
                            model.url_by = 1;
                            #region 上傳圖片
                            try
                            {
                                string path = Server.MapPath(xmlPath);
                                SiteConfigMgr _siteConfigMgr = new SiteConfigMgr(path);
                                SiteConfig extention_config = _siteConfigMgr.GetConfigByName("PIC_Extention_Format");
                                SiteConfig minValue_config = _siteConfigMgr.GetConfigByName("PIC_Length_MinValue");
                                SiteConfig maxValue_config = _siteConfigMgr.GetConfigByName("PIC_Length_MaxValue");
                                SiteConfig admin_userName = _siteConfigMgr.GetConfigByName("ADMIN_USERNAME");
                                SiteConfig admin_passwd = _siteConfigMgr.GetConfigByName("ADMIN_PASSWD");
                                //擴展名、最小值、最大值
                                string extention = extention_config.Value == "" ? extention_config.DefaultValue : extention_config.Value;
                                string minValue = minValue_config.Value == "" ? minValue_config.DefaultValue : minValue_config.Value;
                                string maxValue = maxValue_config.Value == "" ? maxValue_config.DefaultValue : maxValue_config.Value;
                                string localPromoPath = imgLocalPath + promoPath;//圖片存儲地址
                                Random rand = new Random();
                                int newRand = rand.Next(1000, 9999);
                                FileManagement fileLoad = new FileManagement();
                                for (int iFile = 0; iFile < Request.Files.Count; iFile++)
                                {
                                    HttpPostedFileBase file = Request.Files[iFile];
                                    string fileName = string.Empty;//當前文件名
                                    string fileExtention = string.Empty;//當前文件的擴展名
                                    fileName = Path.GetFileName(file.FileName);
                                    // string returnName = imgServerPath;
                                    bool result = false;
                                    string NewFileName = string.Empty;
                                    fileExtention = fileName.Substring(fileName.LastIndexOf(".")).ToLower();
                                    NewFileName = PPQuery.event_id + newRand + fileExtention;
                                    string ServerPath = string.Empty;
                                    //判斷目錄是否存在,不存在則創建
                                    //string[] mapPath = new string[1];
                                    //mapPath[0] = promoPath.Substring(1, promoPath.Length - 2);
                                    //string s = localPromoPath.Substring(0, localPromoPath.Length - promoPath.Length + 1);
                                    CreateFolder(localPromoPath.Substring(0, localPromoPath.Length - promoPath.Length + 1), promoPath.Substring(1, promoPath.Length - 2).Split('/'));
                                    //  returnName += promoPath + NewFileName;
                                    fileName = NewFileName;
                                    NewFileName = localPromoPath + NewFileName;//絕對路徑
                                    ServerPath = Server.MapPath(imgLocalServerPath + promoPath);
                                    string ErrorMsg = string.Empty;
                                    //上傳之前刪除已有的圖片
                                    string oldFileName = olderpcmodel.banner_image;
                                    FTP ftp = new FTP(localPromoPath, ftpuser, ftppwd);
                                    List<string> tem = ftp.GetFileList();
                                    if (tem.Contains(oldFileName))
                                    {
                                        FTP ftps = new FTP(localPromoPath + oldFileName, ftpuser, ftppwd);
                                        ftps.DeleteFile(localPromoPath + oldFileName);//刪除ftp:71.159上的舊圖片
                                        DeletePicFile(ServerPath + oldFileName);//刪除本地圖片
                                    }
                                    try
                                    {
                                        //上傳
                                        result = fileLoad.UpLoadFile(file, ServerPath, NewFileName, extention, int.Parse(maxValue), int.Parse(minValue), ref ErrorMsg, ftpuser, ftppwd);
                                        if (result)//上傳成功
                                        {
                                            PPQuery.banner_image = fileName;
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        PPQuery.banner_image = olderpcmodel.banner_image;
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                PPQuery.banner_image = olderpcmodel.banner_image;
                            }
                            #endregion
                        }
                    }
                    catch (Exception)
                    {
                        PPQuery.category_link_url = oldPPQuery.category_link_url;
                    }
                    model.active = false;
                    if (_promoadditionproceMgr.CategoryID(model).ToString() == "true")
                    {

                        _promoadditionproceMgr.Update(model, PPQuery);
                        jsonStr = "{success:true}";
                    }
                    else
                    {
                        jsonStr = "{success:false,msg:3}";
                    }
                }
                catch (Exception ex)
                {
                    Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                    logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                    logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                    log.Error(logMessage);
                    jsonStr = "{success:false}";
                }
            }
            this.Response.Clear();
            this.Response.Write(jsonStr);
            this.Response.End();
            return this.Response;
        }