private string GetProductPicturePath(PaPr product) { var fileExtension = "." + System.Configuration.ConfigurationManager.AppSettings["PicExtend"]; var fileName = !string.IsNullOrEmpty(product.PicFileName) ? product.PicFileName : product.PartNo; var path1 = System.Configuration.ConfigurationManager.AppSettings["PicPath1"] + fileName.Substring(0, 2) + "-/" + fileName.Substring(0, 3) + "/" + fileName + fileExtension; var path2 = System.Configuration.ConfigurationManager.AppSettings["PicPath2"] + fileName.Substring(0, 2) + "-/" + fileName.Substring(0, 3) + "/" + fileName + fileExtension; var path3 = System.Configuration.ConfigurationManager.AppSettings["PicPath3"] + fileName.Substring(0, 2) + "-/" + fileName.Substring(0, 3) + "/" + fileName + fileExtension; if (System.IO.File.Exists(HttpContext.Server.MapPath(path1))) { return(path1); } else if (System.IO.File.Exists(HttpContext.Server.MapPath(path2))) { return(path2); } else if (System.IO.File.Exists(HttpContext.Server.MapPath(path3))) { return(path3); } else { return(null); } }
public ActionResult DeleteConfirmed(int id) { PaPr paPr = db.PaPrs.Find(id); db.PaPrs.Remove(paPr); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,BarCode,PartNo,Descr,DescrCN,PicFileName,CPartNo,Species,ISize,ColorKind,Plating,Material,IShape,MaterialExp,StoneCode,StoneSize,StoneShape,StoneQtys,WasteRate,HumanExp,CostZm,CostPg,CostDd,LevelZm,IUnit,CurrencySymbol,UnitPrice,Weight,WeightMemo,INote,EditMemo,ModelNo,CreateDate,CheckPriceDt,SilverWeight,EditDateDd,EditDate,CreateEmployeeCode,EditEmployeeCode,MadeSupply,SilverLoss,SettingCost,PolishingCost,MountingCost,PlatingCost,StoneCost,TotalProngs,LoppingCost,CostST,CostPA,CostDM,CostXS,CostNS,CostSH,CostOT,CostRemark,CostCrDate,CostEdDate,CostCrEmpCode,CostEdEmpCode,CostPrice,WeightCS,WeightPA,WeightST,CreatePriceDt,UnitPrice08,NoMemo,CheckDate,CheckEmployeeCode,Checked,WorkPriceZM,WorkPricePG,WorkPriceCheckDt,QuNoZm,QuNoPg,SetNo1,SetNo2,SetNo3,NeedNewPic")] PaPr paPr) { if (ModelState.IsValid) { db.Entry(paPr).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(paPr)); }
// GET: PaPrs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PaPr paPr = db.PaPrs.Find(id); if (paPr == null) { return(HttpNotFound()); } return(View(paPr)); }