public ActionResult SoftwareUploadClick(string version, string type, string plistUrl) { var result = new DirectResult(); var fileUploadField = this.GetCmp <FileUploadField>("fileUploadField"); if (fileUploadField.HasFile) { try { string postedFileName = GetPostedFileName(fileUploadField.PostedFile.FileName); postedFileName = ChinesePinYin.GetPinYin(postedFileName); var documentAttachment = new DocumentAttachment(GetFilePath(type, GetSoftwareBaseFolder())); string filePath = documentAttachment.GetFileName(postedFileName); string url = GetUrl(type, GetSoftwareMuLu(), postedFileName); fileUploadField.PostedFile.SaveAs(filePath); SaveSoftwareFilePathToDbstring(version, type, url, plistUrl); X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO)); } catch (Exception ex) { X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO)); } finally { PushMessageToTag(type.ToLower(), version, "all", 1, -1, string.Empty, string.Empty, 0); } } else { result.IsUpload = true; X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR)); } return(result); }
public ActionResult MaterialInfoAdd(T_GM_InfoMaterial MaterialInfo) { MaterialInfo.InputTime = DateTime.Now; MaterialInfo.InputPerson = user.EmployeeId; //decimal uid=DB.T_GM_InfoMaterial.ToList().LastOrDefault().UID; //MaterialInfo.MaterialID = MaterialInfo.Type + (uid + 1).ToString(); var uploadfile = this.GetCmp <FileUploadField>("AttachmentPath"); int filesize = uploadfile.PostedFile.ContentLength; string fileoldname = uploadfile.FileName; if (filesize > 20 * 1024 * 1024) { X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show(); return(this.Direct()); } if (uploadfile.HasFile) { string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname); string logicpath = "~/AttachFile/MaterialInfo/" + filenewname; string filepath = Server.MapPath(logicpath); MaterialInfo.PicturePath = logicpath; uploadfile.PostedFile.SaveAs(filepath); } DB.T_GM_InfoMaterial.Add(MaterialInfo); DB.SaveChanges(); DirectResult r = new DirectResult(); r.IsUpload = true; return(r); }
public ActionResult UploadClick() { string tpl = "Uploaded file: {0}<br/>Size: {1} bytes"; if (this.GetCmp <FileUploadField>("FileUploadField1").HasFile) { X.Msg.Show(new MessageBoxConfig { Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Title = "Success", Message = string.Format(tpl, this.GetCmp <FileUploadField>("FileUploadField1").PostedFile.FileName, this.GetCmp <FileUploadField>("FileUploadField1").PostedFile.ContentLength) }); } else { X.Msg.Show(new MessageBoxConfig { Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Title = "Fail", Message = "No file uploaded" }); } DirectResult result = new DirectResult(); result.IsUpload = true; return(result); }
public DirectResult Solve() { SolveMatrix(); var result = new DirectResult { X = this.Answer }; return result; }
public override ActionResult DataList_ReturnExportClick(string PanelID, string selection = "") { if (selection == "") { X.Msg.Alert("注意", "请先选择需要导出的报表!").Show(); return(this.Direct()); } else { ReportInfoDataListManage man = new ReportInfoDataListManage(); List <tblReportInfo> model = man.GetSpecialModelFromCurrentSelection(selection); if ((model != null) && (model.Count > 0)) { string sAddress = ConstAddressPath.REPORT_WEBPATH; string sWholeFileName = sAddress + model[0].ID + ".xls"; FileManager clsFile = new FileManager(); if (clsFile.HasFile(sWholeFileName)) { clsFile.DownloadFile(sWholeFileName, model[0].Name + ".xls"); } else { X.Msg.Alert("注意", "该报表未正确生成,请重新生成后再下载...").Show(); DataList_ReturnDeleteClick(PanelID, selection, null, null); return(this.Direct()); } } DirectResult result = new DirectResult(); result.IsUpload = true; return(result); } }
public virtual ActionResult DataList_ReturnExportClick(string key, string selection) { DirectResult result = new DirectResult(); result.IsUpload = true; return(result); }
public ActionResult FieldDataAdd(T_GW_FieldDataManagement fdm) { fdm.UploadMan = user.EmployeeName; fdm.UploadTime = DateTime.Now; var uploadfile = this.GetCmp <FileUploadField>("AttachmentPath"); int filesize = uploadfile.PostedFile.ContentLength; string fileoldname = uploadfile.FileName; if (filesize > 20 * 1024 * 1024) { X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show(); return(this.Direct()); } if (uploadfile.HasFile) { string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname); string logicpath = "~/AttachFile/WorkYard/FieldData/" + filenewname; string filepath = Server.MapPath(logicpath); fdm.AnnetPath = logicpath; uploadfile.PostedFile.SaveAs(filepath); } DB.T_GW_FieldDataManagement.Add(fdm); DB.SaveChanges(); DirectResult result = new DirectResult(); result.IsUpload = true; return(result); }
public ActionResult UploadClick() { string tpl = "Uploaded file: {0}<br/>Size: {1} bytes"; if (this.GetCmp<FileUploadField>("FileUploadField1").HasFile) { X.Msg.Show(new MessageBoxConfig { Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Title = "Success", Message = string.Format(tpl, this.GetCmp<FileUploadField>("FileUploadField1").PostedFile.FileName, this.GetCmp<FileUploadField>("FileUploadField1").PostedFile.ContentLength) }); } else { X.Msg.Show(new MessageBoxConfig { Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Title = "Fail", Message = "No file uploaded" }); } DirectResult result = new DirectResult(); result.IsUpload = true; return result; }
public ActionResult VRSubmit(VacationApply vacation) { DirectResult r = new DirectResult(); string orid = vacation.ID; var prelists = from o in entities.T_HR_Vacation where o.VPDelete == true && o.LastID == orid select o; foreach (T_HR_Vacation item in prelists) { T_HR_Vacation prelist = entities.T_HR_Vacation.Find(item.ID); prelist.VPDelete = false; } T_HR_Vacation orlist = entities.T_HR_Vacation.Find(orid); orlist.VPDelete = true; orlist.EditOrDelete = "Delete"; vacation.ID = Guid.NewGuid().ToString(); vacation.OperationListID = Guid.NewGuid().ToString(); vacation.Valid = false; vacation.CreaterName = new LoginUser().EmployeeId; vacation.CreateTime = DateTime.Now; vacation.VPEdit = false; vacation.VPDelete = true; vacation.EditOrDelete = ""; vacation.LastID = orid; T_CH_Operation_list newList = new T_CH_Operation_list(); newList.ID = vacation.OperationListID; newList.State = (int)CheckState.Checking;//审核中 newList.Check_flowID = vacation.CheckFlowId; newList.Check_funcID = vacation.FuncId; newList.CreateTime = DateTime.Now; newList.Creator = new LoginUser().EmployeeId; newList.Url = Url.Action("CheckVacation", "Vacation", new { id = vacation.ID }); entities.T_HR_Vacation.Add(vacation.ToDB(1)); entities.T_CH_Operation_list.Add(newList); try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "保存成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } return(r); }
public ActionResult AddOrEditEducationFund(V_HR_EducationFundWithName educationFund)//AddEducationFund保存相应 { DirectResult r = new DirectResult(); T_HR_EducationFund educationFundupdate = entities.T_HR_EducationFund.Find(educationFund.ID); if (educationFundupdate == null)//为空为添加 { T_HR_EducationFund educationFundadd = new T_HR_EducationFund(); educationFundadd.ID = Tool.ProduceSed64(); educationFundadd.StaffID = educationFund.StaffID; educationFundadd.Style = educationFund.Style; educationFundadd.Money = educationFund.Money; educationFundadd.StartTime = educationFund.StartTime; educationFundadd.EndTime = educationFund.EndTime; educationFundadd.Valid = true; educationFundadd.Remark = educationFund.Remark; educationFundadd.CreaterName = new LoginUser().EmployeeId;//后期改为用户名 educationFundadd.CreateTime = DateTime.Now; entities.T_HR_EducationFund.Add(educationFundadd); try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "保存成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } } else//否则为修改 { educationFundupdate.StaffID = educationFund.StaffID; educationFundupdate.Style = educationFund.Style; educationFundupdate.Money = educationFund.Money; educationFundupdate.StartTime = educationFund.StartTime; educationFundupdate.EndTime = educationFund.EndTime; educationFundupdate.Valid = true; educationFundupdate.Remark = educationFund.Remark; educationFundupdate.EditorName = new LoginUser().EmployeeId;//后期改为用户名 educationFundupdate.EditeTime = DateTime.Now; try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "修改成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据修改失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } } return r; }
public ActionResult AddOrEditJob(V_HR_JobWithDutyName job)//保存相应 { DirectResult r = new DirectResult(); T_HR_Job jobupdate = entities.T_HR_Job.Find(job.JobID); if (jobupdate == null)//为空为添加 { T_HR_Job jobadd = new T_HR_Job(); jobadd.JobID = job.JobID; jobadd.JobName = job.JobName; jobadd.DutyID = job.DutyID; jobadd.Remark = job.Remark; jobadd.CreaterName = "admin";//后期改为用户名 jobadd.CreateTime = DateTime.Now; entities.T_HR_Job.Add(jobadd); try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "保存成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } } else//否则为修改 { jobupdate.JobName = job.JobName; jobupdate.DutyID = job.DutyID; jobupdate.Remark = job.Remark; jobupdate.EditorName = "admin";//后期改为用户名 jobupdate.EditorTime = DateTime.Now; try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "修改成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据修改失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } } return(r); }
public ActionResult SupplierInfoEdit(T_GM_SupplierInfo SupplierInfo) { DirectResult r = new DirectResult(); SupplierInfo.InputTime = DateTime.Now; SupplierInfo.InputPerson = "admin"; DB.T_GM_SupplierInfo.Attach(SupplierInfo); DB.Entry(SupplierInfo).State = EntityState.Modified; DB.SaveChanges(); return(r); }
public ActionResult CustomerInfoEdit(T_GM_CustomerInfo CustomerInfo) { DirectResult r = new DirectResult(); CustomerInfo.InputTime = DateTime.Now; CustomerInfo.InputPerson = user.EmployeeId; DB.T_GM_CustomerInfo.Attach(CustomerInfo); DB.Entry(CustomerInfo).State = EntityState.Modified; DB.SaveChanges(); return(r); }
public virtual ActionResult DataList_ReturnInportClick(string key, string selection, string keywords, string transvalue) { Excel clsExcel = new Excel(); string sFilePath = ConstAddressPath.TEMP_WEBPATH; DirectResult result = new DirectResult(); result.IsUpload = true; string sHint = clsExcel.WholeStep(sFilePath + selection, keywords, transvalue); X.AddScript("Ext.Msg.alert('注意', '" + sHint + "');"); return(result); }
public virtual ActionResult TreeMaster_AfterInportClick(string sAddress) { Excel clsExcel = new Excel(); string sFilePath = ConstAddressPath.TEMP_WEBPATH; DirectResult result = new DirectResult(); result.IsUpload = true; string sHint = clsExcel.WholeStep(sFilePath + sAddress, sDataTreeKey); X.AddScript("Ext.Msg.alert('注意', '" + sHint + "');"); return(result); }
public ActionResult Button1_Click(string user, string pass) { DirectResult r = new DirectResult(); // Do some Authentication... if (user != "Ext.NET" || pass != "extnet") { r.Success = false; r.ErrorMessage = "Invalid username or password."; } return(r); }
public ActionResult Button1_Click(string user, string pass) { DirectResult r = new DirectResult(); // Do some Authentication... if (user != "Ext.NET" || pass != "extnet") { r.Success = false; r.ErrorMessage = "Invalid username or password."; } return r; }
public ActionResult PONoAdd(string prono, T_GM_Project am) { am.UID = Guid.NewGuid().ToString(); am.BudgetGID = DB.V_GM_DetailBudget.Where(w => w.ProjectNo == prono).Where(w => w.Description == "审核通过").Where(w => w.BudgetStatus == null).ToList().FirstOrDefault().GID; am.AgentMan = user.EmployeeId; am.AgentDate = DateTime.Now; am.OfferStatus = string.IsNullOrEmpty(am.CustomerNo) ? "否" : "是"; var budget = DB.T_GM_Budget.Find(am.BudgetGID); budget.BudgetStatus = "未开工"; DB.T_GM_Budget.Attach(budget); DB.Entry(budget).State = EntityState.Modified; var uploadfile = this.GetCmp <FileUploadField>("AttachmentPath"); int filesize = uploadfile.PostedFile.ContentLength; string fileoldname = uploadfile.FileName; if (filesize > 20 * 1024 * 1024) { X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show(); return(this.Direct()); } if (uploadfile.HasFile) { string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname); string logicpath = "~/AttachFile/ProjectPONo/" + filenewname; string filepath = Server.MapPath(logicpath); am.AttachmentPath = logicpath; uploadfile.PostedFile.SaveAs(filepath); } DB.T_GM_Project.Add(am); var material_list = DB.T_GM_DM.Where(w => w.Remark == am.BudgetGID).ToList(); foreach (var item in material_list) { var detail = new T_GM_DM(); detail.Remark = am.UID; detail.MFlID = item.MFlID; detail.NO = item.NO; detail.Num = item.Num; detail.Price = item.Price; detail.Type = "FPM"; DB.T_GM_DM.Add(detail); } DB.SaveChanges(); DirectResult result = new DirectResult(); result.IsUpload = true; return(result); }
public ActionResult AddPC(T_HR_PositionCategory pc)//AddPositionCategory保存相应 { DirectResult r = new DirectResult(); T_HR_PositionCategory pcupdate = entities.T_HR_PositionCategory.Find(pc.PositionCategoryID); if (pcupdate == null) //为空为添加 { pc.CreaterName = "admin"; //后期改为用户名 pc.CreateTime = DateTime.Now; entities.T_HR_PositionCategory.Add(pc); try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "保存成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } } else//否则为修改 { pcupdate.PositionCategoryName = pc.PositionCategoryName; pcupdate.Remark = pc.Remark; pcupdate.EditorName = "admin";//后期改为用户名 pcupdate.EditorTime = DateTime.Now; try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "修改成功!", new JFunction { Fn = "closewindow" }).Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据修改失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); r.Success = false; } } return(r); }
public ActionResult AddOrEditJob(T_HR_SalaryPerHour job)//保存相应 { DirectResult r = new DirectResult(); //T_HR_Job jobupdate = entities.T_HR_Job.Find(job.JobID); //if (jobupdate == null)//为空为添加 //{ // T_HR_Job jobadd = new T_HR_Job(); // jobadd.JobID = job.JobID; // jobadd.JobName = job.JobName; // jobadd.DutyID = job.DutyID; // jobadd.Remark = job.Remark; // jobadd.CreaterName = "admin";//后期改为用户名 // jobadd.CreateTime = DateTime.Now; // entities.T_HR_Job.Add(jobadd); // try // { // entities.SaveChanges(); // r.Success = true; // X.Msg.Alert("提示", "保存成功!", new JFunction { Fn = "closewindow" }).Show(); // } // catch (Exception e) // { // X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); // r.Success = false; // } //} //else//否则为修改 //{ // jobupdate.JobName = job.JobName; // jobupdate.DutyID = job.DutyID; // jobupdate.Remark = job.Remark; // jobupdate.EditorName = "admin";//后期改为用户名 // jobupdate.EditorTime = DateTime.Now; // try // { // entities.SaveChanges(); // r.Success = true; // X.Msg.Alert("提示", "修改成功!", new JFunction { Fn = "closewindow" }).Show(); // } // catch (Exception e) // { // X.Msg.Alert("警告", "数据修改失败!<br /> note:" + e.Message, new JFunction { Fn = "closewindow" }).Show(); // r.Success = false; // } //} return(r); }
public ActionResult ImageUploadClick(string areaPath, string wuYeYongTu, string wuYeBianHao, string wuYeMingCheng, string zhaoPianLeiXin, string importDataType) { var result = new DirectResult(); var fileUploadField = this.GetCmp <FileUploadField>("fileUploadField"); if (fileUploadField.HasFile) { //string strFileName = Path.GetExtension(fileUploadField.PostedFile.FileName).ToUpper();//获取文件后缀 //if (!(strFileName == ".BMP" || strFileName == ".GIF" || strFileName == ".JPG")) //{ // result.IsUpload = true; // X.Msg.Show(MessageBoxErrorFormatConfig()); //} try { string shi = GetCity(areaPath).Description; string postedFileName = GetPostedFileName(fileUploadField.PostedFile.FileName); postedFileName = ChinesePinYin.GetPinYin(postedFileName); //wuYeYongTu = ChinesePinYin.GetPinYin(wuYeYongTu); var imageAttachment = new ImageAttachment(GetFilePath(ChinesePinYin.GetPinYin(shi), ChinesePinYin.GetPinYin(wuYeYongTu), GetZhaoPianBaseFolder(), wuYeBianHao)); string imageFileFullPath = imageAttachment.GetFileName(postedFileName); var img = new WebImage(fileUploadField.PostedFile.InputStream); SetImageDirection(img); img.Save(imageFileFullPath); //string url = GetUrl(areaPath, wuYeYongTu, wuYeMingCheng, zhaoPianLeiXin, postedFileName); string url = GetUrl(ChinesePinYin.GetPinYin(shi), ChinesePinYin.GetPinYin(wuYeYongTu), wuYeBianHao, GetZhaoPianMuLu(), postedFileName); SaveImageFilePathToDb(wuYeYongTu, shi, wuYeBianHao, wuYeMingCheng, zhaoPianLeiXin, imageFileFullPath, url, postedFileName, areaPath, img.GetBytes()); X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO)); } catch (Exception ex) { X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO)); } } else { result.IsUpload = true; X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR)); } return(result); }
public ActionResult DataList_RegularExportClick(string ParentVariable, string sInitNames, string sInitValues, string sInitSigns, string sNowNames, string sNowValues, string sNowSigns) { DirectResult result = new DirectResult(); result.IsUpload = true; string sNames = sInitNames; string sValues = sInitValues; string sSigns = sInitSigns; if (sInitNames != "") { if (sSigns == "") { string[] ss = sNames.Split(CosValue.SPLITOPERATOR1); for (int i = 0; i < ss.Length; i++) { sSigns = SIGN.Equal.ToString() + CosValue.SPLITOPERATOR1; } sSigns = sSigns.Remove(sSigns.Length - 1, 1); } } if (sNowValues != "") { if (sNames != "") { sNames = sNames + CosValue.SPLITOPERATOR1 + sNowNames; sValues = sValues + CosValue.SPLITOPERATOR1 + sNowValues; sSigns = sSigns + CosValue.SPLITOPERATOR1 + sNowSigns; } else { sNames = sNowNames; sValues = sNowValues; sSigns = sNowSigns; } } GetParentVariable(ParentVariable); DataListManage man = GetDataListManage(ParentVar.KeyWords, ParentVar.transValue); DataTable dt = man.GetSomeRecordForExcel(sNames, sValues, sSigns); ExcelOut ex = new ExcelOut(); if (!ex.ExcelCreateAndDownload(dt)) { X.Msg.Alert("错误", "导出文件出错!").Show(); } return(result); }
public ActionResult SetConstValue_Save(string sData) { ConstValueStr model = JSON.Deserialize <ConstValueStr>(sData); //SetConnectConfiguration("ConnStr", model.sConnStr); //SetConnectConfiguration("ConnSyStr", model.sConnSysStr); SetAppSettingConfiguration("DataListPageLimit", model.sDataListPageLimit.ToString()); SetAppSettingConfiguration("FloatDecimal", model.sFloatDecimal.ToString()); SetAppSettingConfiguration("MenuType", model.cmbMenuType); SetAppSettingConfiguration("TabType", model.cmbTabType); X.Msg.Alert("成功", "保存完毕,请刷新整个系统。").Show(); DirectResult result = new DirectResult(); //result.IsUpload = true; return(result); }
public ActionResult FieldInfoAdd(T_GW_FieldInfoManagement fim) { var list = DB.T_GM_Warehouse.Where(w => w.WarehouseID == fim.WarehouseID).ToList().FirstOrDefault(); if (list == null) { X.Msg.Alert("提示", "输入的仓库有误").Show(); return(this.Direct()); } fim.InputMan = user.EmployeeName; fim.InputTime = DateTime.Now; var uploadfile = this.GetCmp <FileUploadField>("AttachmentPath"); int filesize = uploadfile.PostedFile.ContentLength; string fileoldname = uploadfile.FileName; if (filesize > 20 * 1024 * 1024) { X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show(); return(this.Direct()); } if (uploadfile.HasFile) { string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname); string logicpath = "~/AttachFile/WorkYard/FieldInfo/" + filenewname; string filepath = Server.MapPath(logicpath); fim.FieldMapPath = logicpath; uploadfile.PostedFile.SaveAs(filepath); } DB.T_GW_FieldInfoManagement.Add(fim); T_GW_FieldSchedule fs = new T_GW_FieldSchedule(); fs.ProjectNo = fim.ProjectNo; DB.T_GW_FieldSchedule.Add(fs); var project = DB.V_GM_DetailProject.FirstOrDefault(w => w.ProjectNo == fim.ProjectNo); fim.ProjectName = project.ProjectName; DB.SaveChanges(); DirectResult result = new DirectResult(); result.IsUpload = true; return(result); }
public DirectResult SaveData(string id, FormCollection values, string startDate, string endDate) { DirectResult response = new DirectResult(); Ext.Net.Store store = X.GetCmp <Ext.Net.Store>("StoreTest"); StoreDataHandler dataHandler = new StoreDataHandler(values["data"]); ChangeRecords <TestData> data = dataHandler.BatchObjectData <TestData>(); for (int i = 0; i < data.Updated.Count; i++) { TestData testData = data.Updated[i]; //we want to remove the record since it is processed so we use the delete record option ModelProxy record = store.GetById(testData.id); store.Remove(record); store.CommitRemoving(testData.id); } return(response); }
public ActionResult SetConstValue_InportClick() { DirectResult result = new DirectResult(); result.IsUpload = true; //var upFile = this.GetCmp<FileUploadField>("SetConstValue_File"); //if (upFile.HasFile) //{ // FileManager clsFile = new FileManager(); // string sFilePath = ConstAddressPath.TEMP_WEBPATH; // string sAddress = DateTime.Now.ToFileTimeUtc().ToString() + upFile.FileName.Remove(0, upFile.FileName.LastIndexOf('.')); // if (clsFile.UploadFile(upFile, sFilePath + sAddress)) // { // ExcelIn clsExcel = new ExcelIn(); // clsExcel.WholeStep(sFilePath + sAddress, "OriginData"); // } //} return(result); }
public ActionResult ZhuanYeRenShiUploadClick(string areaPath) { var result = new DirectResult(); var fileUploadField = this.GetCmp <FileUploadField>("fileUploadField"); if (fileUploadField.HasFile) { try { var shi = GetCity(areaPath).Description; string postedFileName = GetPostedFileName(fileUploadField.PostedFile.FileName); postedFileName = ChinesePinYin.GetPinYin(postedFileName); const string type = "zhuanyerenshi"; var folder = Path.Combine(GetZhaoPianMuLu(), ChinesePinYin.GetPinYin(shi), type); var fileName = Path.GetFileNameWithoutExtension(postedFileName) + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(postedFileName); var imageAttachment = new ImageAttachment(Server.MapPath("~/" + folder)); string imageFileFullPath = imageAttachment.GetFileName(fileName); var img = new WebImage(fileUploadField.PostedFile.InputStream); img.Save(imageFileFullPath); X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO)); X.GetCmp <TextField>("ZhaoPian").Value = imageFileFullPath; var url = WebPathUtility.Path.ToURI(imageFileFullPath);// "/" + Path.Combine(folder, fileName).Replace("\\", "/"); X.GetCmp <Image>("ZhaoPianImage").ImageUrl = url; X.GetCmp <Hidden>("ZhaoPianUrl").Value = url; } catch (Exception ex) { X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO)); } } else { result.IsUpload = true; X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR)); } return(result); }
public ActionResult UploadClick() { var uploadfile = this.GetCmp <FileUploadField>("FileUploadField1").PostedFile; int filesize = Int32.Parse(uploadfile.ContentLength.ToString()); string fileoldname = uploadfile.FileName; string filenewname = Path.GetFileNameWithoutExtension(fileoldname) + DateTime.Now.ToString(@"yyyyMMddHHmmss") + new Random().Next(1, 100).ToString() + Path.GetExtension(fileoldname); if (filesize > 5 * 1024 * 1024) { X.Msg.Alert("提示", "上传文件过大,大小必须低于5M").Show(); } string filepath = Server.MapPath("~/App_Data/" + filenewname); if (this.GetCmp <FileUploadField>("FileUploadField1").HasFile) { uploadfile.SaveAs(filepath); X.Msg.Show(new MessageBoxConfig { Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Title = "Success", Message = "文件上传成功" }); } else { X.Msg.Show(new MessageBoxConfig { Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Title = "Fail", Message = "No file uploaded" }); } DirectResult result = new DirectResult(); result.IsUpload = true; return(result); }
public virtual ActionResult TreeMaster_InportClick() { DirectResult result = new DirectResult(); result.IsUpload = true; //首先把文件临时copy到服务器上 var upFile = this.GetCmp <FileUploadField>(sMainFormName + "_btnInport"); if (upFile.HasFile) { FileManager clsFile = new FileManager(); string sFilePath = ConstAddressPath.TEMP_WEBPATH; string sAddress = DateTime.Now.ToFileTimeUtc().ToString() + upFile.FileName.Remove(0, upFile.FileName.LastIndexOf('.')); if (clsFile.UploadFile(upFile, sFilePath + sAddress)) { SetHiddenValue(sMainFormName + "_txtInportFileName", sAddress); return(result); } } result.IsUpload = false; return(result); }
public ActionResult ExcelUploadClick(string importDataType) { var result = new DirectResult(); var fileUploadField = this.GetCmp <FileUploadField>("fileUploadField"); if (fileUploadField.HasFile) { var excelImportManager = new ExcelImportManager(); try { string orgNamePath = GetOrganizationNamePath(); string createBy = GetCurrentUserName(); string areaPath = GetOrganizationAreaPath(); excelImportManager.ImportData(importDataType, fileUploadField.PostedFile.InputStream, areaPath, orgNamePath, createBy); if (string.IsNullOrEmpty(excelImportManager.ErrorInfo)) { X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO)); } else { X.Msg.Show(MessageBoxConfig(Success + "<br/>" + excelImportManager.ErrorInfo, TiShi, MessageBox.Icon.INFO)); } } catch (Exception ex) { X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO)); } } else { result.IsUpload = true; X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR)); } return(result); }
public ActionResult XiTongImageUploadClick(string areaPath, string zhaoPianLeiXin, string importDataType) { var result = new DirectResult(); var fileUploadField = this.GetCmp <FileUploadField>("fileUploadField"); if (fileUploadField.HasFile) { try { var shi = GetCity(areaPath).Description; string postedFileName = GetPostedFileName(fileUploadField.PostedFile.FileName); postedFileName = ChinesePinYin.GetPinYin(postedFileName); const string type = "system"; var imageAttachment = new ImageAttachment(GetFilePath(ChinesePinYin.GetPinYin(shi), type, GetZhaoPianBaseFolder())); string imageFileFullPath = imageAttachment.GetFileName(postedFileName); var img = new WebImage(fileUploadField.PostedFile.InputStream); SetImageDirection(img); img.Save(imageFileFullPath); string url = GetUrl(ChinesePinYin.GetPinYin(shi), type, GetZhaoPianMuLu(), postedFileName); SaveXiTongImageFilePathToDb(shi, zhaoPianLeiXin, imageFileFullPath, url, postedFileName, areaPath); X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO)); } catch (Exception ex) { X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO)); } } else { result.IsUpload = true; X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR)); } return(result); }
public ActionResult EditPeople(V_HR_TipsPeople tp) { DirectResult r = new DirectResult(); var last = from o in entities.V_HR_TipsPeople where o.ID == tp.ID select o; if (last.Any()) { T_HR_TipsPeople lasttp = entities.T_HR_TipsPeople.Find(tp.ID); lasttp.Valid = false; } T_HR_TipsPeople newtp = new T_HR_TipsPeople(); newtp.ID = Tool.ProduceSed64(); newtp.StaffID = tp.StaffID; newtp.Valid = true; newtp.Remark = tp.Remark; newtp.CreaterName = new LoginUser().EmployeeId; newtp.CreateTime = DateTime.Now; entities.T_HR_TipsPeople.Add(newtp); try { entities.SaveChanges(); r.Success = true; X.Msg.Alert("提示", "保存成功!").Show(); } catch (Exception e) { X.Msg.Alert("警告", "数据保存失败!<br /> note:" + e.Message).Show(); r.Success = false; } return(r); }
public ActionResult FieldDataAdd(T_GW_FieldImportantAttach fdm) { DirectResult result = new DirectResult(); var list = DB.T_GM_TypeNo.ToList(); foreach (var item in list) { if (item.TypeID.Contains("FD_")) { fdm.UploadMan = user.EmployeeName; fdm.UploadTime = DateTime.Now; fdm.AnnetType = item.TypeID; string str = UploadAttach(item.TypeID.Trim()); if (str != "-1") { fdm.AnnetPath = str; DB.T_GW_FieldImportantAttach.Add(fdm); DB.SaveChanges(); result.IsUpload = true; } } } return(result); }