public ActionResult GetBanerListJson() { List <object> baners = new List <object>(); FileApp fileApp = new FileApp(); var data = fileApp.GetList("baner"); foreach (var item in data) { baners.Add(new { name = item.FileName, base64 = item.FileContent }); } return(Content(baners.ToJson())); }
public ActionResult GetInventory(string f_Id, string longitude, string latitude) { string strSql = @"select a.Id,a.WareId,a.WareName,d.Address,d.Longitude,d.Latitude,Distince=6378137.0*acos(sin(cast('" + latitude + "' as decimal(18,6))/180*pi())*sin(Latitude/180*pi())+cos(cast('" + latitude + "' as decimal(18,6))/180*pi())*cos(Latitude/180*pi())*cos((cast('" + longitude + "' as decimal(18,6))-Longitude)/180*pi())),a.OrderNo,c.ProductName as ProductType,(select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0202' and F_ItemCode=a.Grade) as Grade,a.Strength,(select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0208' and F_ItemCode=a.Length) as Length,(select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0203' and F_ItemCode=a.HorseValue) as HorseValue,(select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0207' and F_ItemCode=a.Status) as Status,(select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0206' and F_ItemCode=a.QuoteType) as QuoteType,(case when a.QuoteType<>'Futures' then a.Price else null end) as Price,(case when a.QuoteType<>'Futures' then null else a.Contract end) as Contract,(case when a.QuoteType<>'Futures' then null else cast(b.Price as decimal(18,2)) end) as ContractPrice,(case when a.QuoteType<>'Futures' then null else cast(a.Basis+b.Price as decimal(18,2)) end) as TotalPrice,(case when a.QuoteType<>'Futures' then null else Basis end) as Basis,a.Year,a.SailingSchedule,(a.Weight-isnull((select sum(Weight) from InventoryOut where InventoryId=a.Id),0)) as Weight,a.Description from Inventory a left join Contract b on a.Contract=b.ContractCode left join Product c on c.ProductCode=a.ProductType inner join WareHouse d on a.WareId=d.Id where a.Id='" + f_Id + "'"; DataView dv = DbHelper.ExecuteToDataView(strSql); FileApp fileApp = new FileApp(); var files = fileApp.GetList(f_Id); List <object> img = new List <object>(); foreach (FileEntity file in files) { //img.Add(new { base64 = file.FileContent }); if (!string.IsNullOrEmpty(file.FilePath)) { img.Add(new { base64 = file.FilePath.Replace("\\", "/") }); } } object obj = new object(); obj = new { f_Id = Convert.ToString(dv[0]["Id"]), wareId = Convert.ToString(dv[0]["WareId"]), wareName = Convert.ToString(dv[0]["WareName"]), address = Convert.ToString(dv[0]["Address"]), distance = (Convert.ToDouble(dv[0]["Distince"]) / 1000).ToString("#0.00"), longitude = Convert.ToDouble(dv[0]["Longitude"]), latitude = Convert.ToDouble(dv[0]["Latitude"]), orderNo = Convert.ToString(dv[0]["OrderNo"]), productType = Convert.ToString(dv[0]["ProductType"]), grade = Convert.ToString(dv[0]["Grade"]), strength = Convert.ToString(dv[0]["Strength"]), length = Convert.ToString(dv[0]["Length"]), horseValue = Convert.ToString(dv[0]["HorseValue"]), status = Convert.ToString(dv[0]["Status"]), quoteType = Convert.ToString(dv[0]["QuoteType"]), price = Convert.ToString(dv[0]["Price"]), contract = Convert.ToString(dv[0]["Contract"]), contractPrice = Convert.ToString(dv[0]["ContractPrice"]), totalPrice = Convert.ToString(dv[0]["TotalPrice"]), basis = Convert.ToString(dv[0]["Basis"]), year = Convert.ToString(dv[0]["Year"]), sailingSchedule = Convert.ToString(dv[0]["SailingSchedule"]), weight = Convert.ToString(dv[0]["Weight"]), description = Convert.ToString(dv[0]["Description"]), imgList = img }; return(Content(obj.ToJson())); }
public ActionResult GetBanerListJson() { List <object> baners = new List <object>(); FileApp fileApp = new FileApp(); var data = fileApp.GetList("baner"); foreach (var item in data) { //baners.Add(new { name = item.FileName, base64 = item.FileContent }); if (!string.IsNullOrEmpty(item.FilePath)) { baners.Add(new { name = item.FileName, base64 = item.FilePath.Replace("\\", "/") }); } } return(Content(baners.ToJson())); }
public FilesController(FileApp app) { _app = app; }
public FilesController(IAuth authUtil, FileApp app) : base(authUtil) { _app = app; }
public ActionResult GetInventoryListJson(InventoryReq inventoryReq) { //sql string strSql = @" select a.Id, WareName, OrderNo, c.ProductName as ProductType, c.ImgContent as ProductImg, (select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0202' and F_ItemCode=a.Grade) as Grade, Strength, (select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0208' and F_ItemCode=a.Length) as Length, (select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0203' and F_ItemCode=a.HorseValue) as HorseValue, (select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0207' and F_ItemCode=a.Status) as Status, (select F_ItemName from View_ItemType_ItemDetail where F_EnCode='0206' and F_ItemCode=a.QuoteType) as QuoteType, (case when a.QuoteType<>'Futures' then a.Price else null end) as Price, (case when a.QuoteType<>'Futures' then null else a.Contract end) as Contract, (case when a.QuoteType<>'Futures' then null else cast(b.Price as decimal(18,2)) end) as ContractPrice, (case when a.QuoteType<>'Futures' then null else cast(a.Basis+b.Price as decimal(18,2)) end) as TotalPrice, (case when a.QuoteType<>'Futures' then null else Basis end) as Basis, Year, SailingSchedule, (Weight-isnull((select sum(Weight) from InventoryOut where InventoryId=a.Id),0)) as Weight, IsRecommend, b.FS,b.M,b.S,b.C,b.V from Inventory a left join Contract b on a.Contract=b.ContractCode left join Product c on c.ProductCode=a.ProductType where 1=1 "; //where string strQry = ""; if (inventoryReq.inventoryQry != null) { InventoryQry[] inventoryQrys = inventoryReq.inventoryQry; foreach (InventoryQry inventoryQry in inventoryQrys) { if (inventoryQry.code.ToLower() == "strength")//强力是范围,其他都是选项 { foreach (List selected in inventoryQry.list) { if (selected.name.ToLower() == "min") { strQry += " and cast(Strength as float)>=" + selected.code + " "; } else if (selected.name.ToLower() == "max") { strQry += " and cast(Strength as float)<=" + selected.code + " "; } } } else if (inventoryQry.code.ToLower() == "producttype")//分类中,其他是除美棉/澳棉/巴西棉/印度棉以外的所有 { string condition = ""; foreach (List selected in inventoryQry.list) { if (selected.code.ToLower() != "qt") { if (selected.selected) { condition += "'" + selected.code + "',"; } } else { if (selected.selected) { DataView dvQT = DbHelper.ExecuteToDataView("select ProductCode from Product where ProductCode not in ('mm','bxm','ydm','om')"); foreach (DataRowView drv in dvQT) { condition += "'" + drv["ProductCode"] + "',"; } } } } if (!string.IsNullOrEmpty(condition)) { strQry += " and " + inventoryQry.code + " in (" + condition.Trim(',') + ") "; } } else { string condition = ""; foreach (List selected in inventoryQry.list) { if (selected.selected) { condition += "'" + selected.code + "',"; } } if (!string.IsNullOrEmpty(condition)) { strQry += " and " + inventoryQry.code + " in (" + condition.Trim(',') + ") "; } } } } //order string strOrder = " order by IsRecommend desc,a.CreatorTime desc "; //paging Pagination pagination = inventoryReq.pagination; string strPaging = " offset " + (pagination.page - 1) * pagination.rows + " rows fetch next " + pagination.rows + " rows only"; DataView dvInventory = DbHelper.ExecuteToDataView(strSql + strQry + strOrder + strPaging); List <object> inventorys = new List <object>(); foreach (DataRowView drv in dvInventory) { FileApp fileApp = new FileApp(); var files = fileApp.GetList(Convert.ToString(drv["Id"])); List <object> img = new List <object>(); foreach (FileEntity file in files) { //baer64改成url,参数名不变了 //img.Add(new { base64 = file.FileContent }); if (!string.IsNullOrEmpty(file.FilePath)) { img.Add(new { base64 = file.FilePath.Replace("\\", "/") }); } } inventorys.Add(new { f_Id = Convert.ToString(drv["Id"]), wareName = Convert.ToString(drv["WareName"]), orderNo = Convert.ToString(drv["OrderNo"]), productType = Convert.ToString(drv["ProductType"]), productImg = Convert.ToString(drv["ProductImg"]), grade = Convert.ToString(drv["Grade"]), strength = Convert.ToString(drv["Strength"]), length = Convert.ToString(drv["Length"]), horseValue = Convert.ToString(drv["HorseValue"]), status = Convert.ToString(drv["Status"]), quoteType = Convert.ToString(drv["QuoteType"]), price = Convert.ToString(drv["Price"]), contract = Convert.ToString(drv["Contract"]), contractPrice = Convert.ToString(drv["ContractPrice"]), basis = Convert.ToString(drv["Basis"]), totalPrice = Convert.ToString(drv["TotalPrice"]), year = Convert.ToString(drv["Year"]), sailingSchedule = Convert.ToString(drv["SailingSchedule"]), weight = Convert.ToString(drv["Weight"]), isRecommend = Convert.ToString(drv["IsRecommend"]), fs = Convert.ToString(drv["FS"]), m = Convert.ToString(drv["M"]), s = Convert.ToString(drv["S"]), c = Convert.ToString(drv["C"]), v = Convert.ToString(drv["V"]), imgList = img }); } return(Content(inventorys.ToJson())); }
public ActionResult Export(string id) { var data = new ResumeApp().GetResume(id); var tpFilePath = Server.MapPath("~/Content/ResumeTemp.html"); var resumeTp = ""; using (var sr = new StreamReader(tpFilePath)) { resumeTp = sr.ReadToEnd(); } if (data.Cv != null) { var entity = new FileApp().GetForm(data.Cv.Logo); string path = Server.MapPath("~/Image/") + entity.FileName; resumeTp = resumeTp.Replace("[#cvUsername#]", data.Cv.Username) .Replace("[#cvUserSex#]", data.Cv.UserSex) .Replace("[#cvUserAge#]", data.Cv.UserAge.HasValue?data.Cv.UserAge.ToString():"") .Replace("[#cvUserAddress#]", data.Cv.UserAddress) .Replace("[#cvUserTel#]", data.Cv.UserTel) .Replace("[#cvUserEmail#]", data.Cv.UserEmail) .Replace("[#cvSkill#]", data.Cv.SkillContent) .Replace("[#cvSelf#]", data.Cv.SelfContent) .Replace("[#cvUserLogo#]", path); } if (data.Edu != null) { resumeTp = resumeTp.Replace("[#eduSchool#]", data.Edu.School) .Replace("[#eduMajor#]", data.Edu.Major) .Replace("[#eduSDT#]", data.Edu.SDTStr); } var jobExpTp = "<table>" + " <tr><td class=\"font18 width400\">[#CpyName#]</td><td>[#SDT#] ~ [#EDT#]</td></tr>" + " <tr><td colspan=\"2\"><span>职务:[#Post#]</span></td></tr>" + " <tr><td colspan=\"2\"><span>工作内容:[#JobDesc#]</span></td></tr>" + "</table>"; if (data.JobExps != null) { List <string> jobExps = new List <string>(); data.JobExps.ForEach(x => { var temp = jobExpTp.Replace("[#CpyName#]", x.CpyName) .Replace("[#SDT#]", x.SDTStr) .Replace("[#EDT#]", x.EDTStr) .Replace("[#Post#]", x.Post) .Replace("[#JobDesc#]", x.JobDesc); jobExps.Add(temp); }); resumeTp = resumeTp.Replace("[#cvJobExp#]", string.Join("", jobExps.ToArray())); } var trainExpTp = "<table>" + " <tr><td class=\"font18 width400\">[#CpyName#]</td><td>[#SDT#] ~ [#EDT#]</td></tr>" + " <tr><td colspan=\"2\"><span>培训岗位:[#Post#]</span></td></tr>" + " <tr><td colspan=\"2\"><span>培训内容:[#TrainDesc#]</span></td></tr>" + "</table>"; if (data.TrainExps != null) { List <string> trainExps = new List <string>(); data.TrainExps.ForEach(x => { var temp = trainExpTp.Replace("[#CpyName#]", x.CpyName) .Replace("[#SDT#]", x.SDTStr) .Replace("[#EDT#]", x.EDTStr) .Replace("[#Post#]", x.Post) .Replace("[#TrainDesc#]", x.TrainDesc); trainExps.Add(temp); }); resumeTp = resumeTp.Replace("[#cvTrainExp#]", string.Join("", trainExps.ToArray())); } var cerTp = "<table>" + " <tr><td class=\"width400\">[#Name#]</td><td>[#Level#]</td></tr>" + "</table>"; if (data.Cers != null) { List <string> cers = new List <string>(); data.Cers.ForEach(x => { var temp = cerTp.Replace("[#Name#]", x.Name) .Replace("[#Level#]", x.Level); cers.Add(temp); }); resumeTp = resumeTp.Replace("[#cvCer#]", string.Join("", cers.ToArray())); } Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.InsertHtml(resumeTp); byte[] buffer = null; using (var ms = new MemoryStream()) { doc.Save(ms, SaveFormat.Doc); buffer = new byte[ms.Length]; ms.Position = 0; ms.Read(buffer, 0, buffer.Length); } return(File(buffer, "application/x-zip-compressed", HttpUtility.UrlEncode("我的简历.doc", Encoding.UTF8))); }