protected virtual IActionResult Get(MaterialView materialView) { if (materialView == null) { return(BadRequest()); } var category = categoriesCache.GetCategory(materialView.CategoryName); if (!materialsAuthorization.CanGet(User.Roles, category)) { return(Unauthorized()); } if (materialView.IsHidden && !materialsAuthorization.CanHide(User.Roles, category)) { return(Unauthorized()); } if (materialView.IsDeleted && !materialsAuthorization.CanRestoreAsync(User, category.Id)) { return(Unauthorized()); } return(Json(materialView)); }
public ActionResult Delete(Guid id) { JobCardManager manager = new JobCardManager(); MaterialView jobType = manager.GetMaterial(id); return(View(jobType)); }
protected virtual IActionResult Get(MaterialView materialView) { if (materialView == null) { return(BadRequest()); } var category = categoriesCache.GetCategory(materialView.CategoryName); if (!materialsAuthorization.CanGet(User.Roles, category)) { return(Unauthorized()); } if (materialView.IsHidden && !materialsAuthorization.CanHide(User.Roles, category)) { return(Unauthorized()); } if (materialView.DeletedDate != null && !materialsAuthorization.CanRestoreAsync(User, category.Id)) { return(Unauthorized()); } materialView.VisitsCount += materialsVisitsCounterCache.CountMaterial(UserOrIpKey, materialView.Id); return(Json(materialView)); }
private void mnuMaterial_Click(object sender, System.EventArgs e) { var materialView = new MaterialView(); materialView.MdiParent = this; materialView.Show(); }
public ActionResult Edit(Guid id) { JobCardManager manager = new JobCardManager(); MaterialView material = manager.GetMaterial(id); return(View(material)); }
public MaterialViewEditWindow() { InitializeComponent(); bufferData = BufferData.GetInstance(); MaterialView MaterialView = (MaterialView)bufferData.CurrentRow; string str = bufferData.NameOfAttribDictinionary["IdMaterial"]; label1.Content = str; str = bufferData.NameOfAttribDictinionary["Name"]; label2.Content = str; str = bufferData.NameOfAttribDictinionary["DateProducing"]; label3.Content = str; str = bufferData.NameOfAttribDictinionary["Manufacturer"]; label4.Content = str; str = bufferData.NameOfAttribDictinionary["MaterialType"]; label5.Content = str; str = bufferData.NameOfAttribDictinionary["Fashion"]; label6.Content = str; var lst1 = new List <string>(bufferData.ManufacturerTable.Data.Select(x => x.Name)); var lst2 = new List <string>(bufferData.MaterialTypeTable.Data.Select(x => x.Name)); var lst3 = new List <string>(bufferData.FashionTable.Data.Select(x => x.Name)); comboBox4.ItemsSource = lst1; comboBox5.ItemsSource = lst2; comboBox6.ItemsSource = lst3; if (bufferData.EditMode == BufferData.EditModes.Update) { oldId = MaterialView.IdMaterial; textBox1.Text = MaterialView.IdMaterial.ToString(); textBox2.Text = MaterialView.Name; datePicker3.SelectedDate = DateTime.Parse(MaterialView.DateProducing); int index = lst1.FindIndex(x => x == MaterialView.Manufacturer); comboBox4.SelectedIndex = index; index = lst2.FindIndex(x => x == MaterialView.MaterialType); comboBox5.SelectedIndex = index; index = lst3.FindIndex(x => x == MaterialView.Fashion); comboBox6.SelectedIndex = index; } if (bufferData.EditMode == BufferData.EditModes.Insert) { oldId = -1; textBox1.Text = ""; textBox2.Text = ""; datePicker3.SelectedDate = DateTime.Now.Date; comboBox4.SelectedIndex = 0; comboBox5.SelectedIndex = 0; comboBox6.SelectedIndex = 0; } }
public void DeleteMaterial(MaterialView material) { using (DigiFusionEntities db = new DigiFusionEntities()) { Material materialDB = db.Materials.Single(x => x.MaterialID == material.MaterialID); materialDB.IsDeleted = true; db.SaveChanges(); } }
private MaterialView GetViewModel(Material material) { MaterialView result = new MaterialView { MaterialID = material.MaterialID, Description = material.Description, IsDeleted = material.IsDeleted, Name = material.Name }; return(result); }
public void UpdateMaterial(MaterialView material) { using (DigiFusionEntities db = new DigiFusionEntities()) { Material materialDb = db.Materials.Single(x => x.MaterialID == material.MaterialID); materialDb.Description = material.Description; materialDb.IsDeleted = material.IsDeleted; materialDb.Name = material.Name; db.SaveChanges(); } }
public MaterialView GetMaterial(Guid id) { using (DigiFusionEntities db = new Database.DigiFusionEntities()) { var material = db.Materials.SingleOrDefault(x => x.MaterialID == id && !x.IsDeleted); MaterialView result = new MaterialView() { MaterialID = material.MaterialID, Description = material.Description, Name = material.Name }; return(result); } }
public void CreateMaterial(MaterialView material) { using (DigiFusionEntities db = new DigiFusionEntities()) { var dbMaterial = new Material { MaterialID = Guid.NewGuid(), Description = material.Description, IsDeleted = false, Name = material.Name }; db.Materials.Add(dbMaterial); db.SaveChanges(); } }
private void prepareMaterialView() { nfloat width = 200f; nfloat height = 200f; //var imageView = new UIImageView(UIImage.FromBundle("Demo")); //View.AddSubview(imageView); var materialView = new MaterialView(new CGRect(0, 0, width, height)); materialView.Image = UIImage.FromBundle("CosmicMind"); materialView.Shape = MaterialShape.Circle; materialView.Depth = MaterialDepth.Depth2; materialView.Center = View.Center; View.AddSubview(materialView); }
public MaterialController(EditorController editorController, MaterialView materialView) { _editorController = editorController; _materialView = materialView; _materials = new BindingList <EditorMaterial>(); List <XElement> materialData; // Load materials ResourceManager.loadAllMaterials(new FileStream(ResourceManager.materialPath, FileMode.Open)); materialData = ResourceManager.materialResources; foreach (XElement data in materialData) { _materials.Add(new EditorMaterial(data)); } // Initialize material view materialView.setController(this); }
public ActionResult Delete(MaterialView material) { try { if (ModelState.IsValid) { JobCardManager manager = new JobCardManager(); manager.DeleteMaterial(material); return(RedirectToAction("Index")); } return(View()); } catch { return(View()); } }
///<summary> ///获取详情: ///</summary> /// <param name="id">数据Id</param> /// <returns>数据详情model</returns> public Result <MaterialView> GetMaterialModel(long id) { MaterialView list = new MaterialView(); Result <MaterialView> result = new Result <MaterialView>(); try { list.Epm_Material = DataOperateBusiness <Epm_Material> .Get().GetModel(id); list.MaterialDetails = DataOperateBusiness <Epm_MaterialDetails> .Get().GetList(p => p.MaterialCheckId == id).ToList(); result.Data = list; result.Flag = EResultFlag.Success; } catch (Exception ex) { result.Data = null; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "GetMaterialModel"); } return(result); }
public ActionResult Add(Epm_Material model) { ResultView <int> view = new ResultView <int>(); MaterialView material = new MaterialView(); #region 表单验证 if (!model.ProjectId.HasValue || model.ProjectId.Value == 0 || string.IsNullOrWhiteSpace(model.ProjectName)) { view.Flag = false; view.Message = "项目名称不能为空"; return(Json(view)); } #endregion //上传附件 string fileDataJsonFile = Request.Form["fileDataJsonFile"];//获取上传文件json字符串 List <Base_Files> files = new List <Base_Files>(); if (!string.IsNullOrWhiteSpace(fileDataJsonFile)) { files = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJsonFile);//将文件信息json字符 material.FileList = files; } string materialDetails = Request.Form["MaterialDetails"]; if (!string.IsNullOrWhiteSpace(materialDetails)) { material.MaterialDetails = JsonConvert.DeserializeObject <List <Epm_MaterialDetails> >(materialDetails); } Result <int> result = new Result <int>(); using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request))) { material.Epm_Material = model; result = proxy.AddMaterial(material); } return(Json(result.ToResultView())); }
private void Button_Click_1(object sender, RoutedEventArgs e) { var subWindow = new MaterialView(); subWindow.ShowDialog(); }
///<summary> ///修改: ///</summary> /// <param name="model">要修改的model</param> /// <returns>受影响的行数</returns> public Result <int> UpdateMaterial(MaterialView model) { Result <int> result = new Result <int>(); try { var oldModel = DataOperateBusiness <Epm_Material> .Get().GetModel(model.Epm_Material.Id); if (oldModel == null) { throw new Exception("该材料设备验收不存在或已被删除"); } model.Epm_Material = FiterUpdate(oldModel, model.Epm_Material); model.Epm_Material.CompanyId = oldModel.CompanyId; model.Epm_Material.CompanyName = oldModel.CompanyName; var row = DataOperateBusiness <Epm_Material> .Get().Update(model.Epm_Material); if (model.MaterialDetails.Count > 0) { //先删除 var detaileList = DataOperateBusiness <Epm_MaterialDetails> .Get().GetList(p => p.MaterialCheckId == model.Epm_Material.Id); if (detaileList.Any()) { DataOperateBusiness <Epm_MaterialDetails> .Get().DeleteRange(detaileList); } model.MaterialDetails.ForEach(item => { item.MaterialCheckId = model.Epm_Material.Id; item.CrtCompanyId = CurrentCompanyID.ToLongReq(); item.CrtCompanyName = CurrentCompanyName; item.CreateUserId = CurrentUserID.ToLongReq(); item.CreateUserName = CurrentUserName; item.CreateTime = DateTime.Now; item.State = 0; item = SetCurrentUser(item); item = SetCreateUser(item); }); DataOperateBusiness <Epm_MaterialDetails> .Get().AddRange(model.MaterialDetails); } //上传模型 if (model.FileList != null) { //删除之前的附件 DeleteFilesByTable(model.GetType().Name, new List <long>() { model.Epm_Material.Id }); //新增附件 AddFilesByTable(model.Epm_Material, model.FileList); } result.Data = row; result.Flag = EResultFlag.Success; WriteLog(BusinessType.Equipment.GetText(), SystemRight.Add.GetText(), "修改: " + model.Epm_Material.Id); //处理待办 var tempApp = DataOperateBusiness <Epm_Approver> .Get().GetList(t => t.BusinessId == model.Epm_Material.Id && t.IsApprover == false).FirstOrDefault(); if (tempApp != null) { ComplateApprover(tempApp.Id); } if (model.Epm_Material.State == (int)ConfirmState.WaitConfirm) { #region 生成待办 var project = DataOperateBusiness <Epm_Project> .Get().GetModel(model.Epm_Material.ProjectId.Value); List <Epm_Approver> list = new List <Epm_Approver>(); Epm_Approver app = new Epm_Approver(); app.Title = CurrentUserName + "提报了工器具机械验收单,待审核"; app.Content = CurrentUserName + "提报了工器具机械验收单,待审核"; app.SendUserId = CurrentUserID.ToLongReq(); app.SendUserName = CurrentUserName; app.SendTime = DateTime.Now; app.LinkURL = string.Empty; app.BusinessTypeNo = BusinessType.Equipment.ToString(); app.Action = SystemRight.Add.ToString(); app.BusinessTypeName = BusinessType.Equipment.GetText(); app.BusinessState = (int)(ConfirmState.WaitConfirm); app.BusinessId = model.Epm_Material.Id; app.ApproverId = project.ContactUserId; app.ApproverName = project.ContactUserName; app.ProjectId = model.Epm_Material.ProjectId; app.ProjectName = project.Name; list.Add(app); AddApproverBatch(list); WriteLog(BusinessType.Equipment.GetText(), SystemRight.Add.GetText(), "提交工器具机械验收生成待办: " + model.Epm_Material.Id); #endregion #region 消息 Epm_Massage modelMsg = new Epm_Massage(); modelMsg.ReadTime = null; modelMsg.RecId = project.ContactUserId.Value; modelMsg.RecName = project.ContactUserName; modelMsg.RecTime = DateTime.Now; modelMsg.SendId = CurrentUserID.ToLongReq(); modelMsg.SendName = CurrentUserName; modelMsg.SendTime = DateTime.Now; modelMsg.Title = CurrentUserName + "提报了工器具机械验收单,待审核"; modelMsg.Content = CurrentUserName + "提报了工器具机械验收单,待审核"; modelMsg.Type = 2; modelMsg.IsRead = false; modelMsg.BussinessId = model.Epm_Material.Id; modelMsg.BussinesType = BusinessType.Equipment.ToString(); modelMsg.ProjectId = model.Epm_Material.ProjectId.Value; modelMsg.ProjectName = model.Epm_Material.ProjectName; modelMsg = base.SetCurrentUser(modelMsg); modelMsg = base.SetCreateUser(modelMsg); DataOperateBusiness <Epm_Massage> .Get().Add(modelMsg); #endregion #region 发送短信 //Dictionary<string, string> parameters = new Dictionary<string, string>(); //parameters.Add("UserName", CurrentUserName); //WriteSMS(project.ContactUserId.Value, project.CompanyId, MessageStep.MaterialAdd, parameters); #endregion } } catch (Exception e) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(e, "UpdateMaterial"); } return(result); }
///<summary> ///添加: ///</summary> /// <param name="model">要添加的model</param> /// <returns>受影响的行数</returns> public Result <int> AddMaterial(MaterialView model) { Result <int> result = new Result <int>(); try { model.Epm_Material = SetCurrentUser(model.Epm_Material); model.Epm_Material = SetCreateUser(model.Epm_Material); model.Epm_Material.CompanyId = CurrentCompanyID.ToLongReq(); model.Epm_Material.CompanyName = CurrentCompanyName; DataOperateBusiness <Epm_Material> .Get().Add(model.Epm_Material); model.MaterialDetails.ForEach(item => { item.MaterialCheckId = model.Epm_Material.Id; item.CrtCompanyId = CurrentCompanyID.ToLongReq(); item.CrtCompanyName = CurrentCompanyName; item.CreateUserId = CurrentUserID.ToLongReq(); item.CreateUserName = CurrentUserName; item.CreateTime = DateTime.Now; item.State = 0; item = SetCurrentUser(item); item = SetCreateUser(item); }); DataOperateBusiness <Epm_MaterialDetails> .Get().AddRange(model.MaterialDetails); if (model.FileList.Count > 0) { AddFilesByTable(model.Epm_Material, model.FileList); //上传附件 } result.Data = 1; result.Flag = EResultFlag.Success; WriteLog(BusinessType.Equipment.GetText(), SystemRight.Add.GetText(), "新增: " + model.Epm_Material.Id); if (model.Epm_Material.State == (int)ConfirmState.WaitConfirm) { #region 生成待办 var project = DataOperateBusiness <Epm_Project> .Get().GetModel(model.Epm_Material.ProjectId.Value); List <Epm_Approver> list = new List <Epm_Approver>(); Epm_Approver app = new Epm_Approver(); app.Title = CurrentUserName + "提报了工器具机械验收单,待审核"; app.Content = CurrentUserName + "提报了工器具机械验收单,待审核"; app.SendUserId = CurrentUserID.ToLongReq(); app.SendUserName = CurrentUserName; app.SendTime = DateTime.Now; app.LinkURL = string.Empty; app.BusinessTypeNo = BusinessType.Equipment.ToString(); app.Action = SystemRight.Add.ToString(); app.BusinessTypeName = BusinessType.Equipment.GetText(); app.BusinessState = (int)(ConfirmState.WaitConfirm); app.BusinessId = model.Epm_Material.Id; app.ApproverId = project.ContactUserId; app.ApproverName = project.ContactUserName; app.ProjectId = model.Epm_Material.ProjectId; app.ProjectName = project.Name; list.Add(app); AddApproverBatch(list); WriteLog(BusinessType.Equipment.GetText(), SystemRight.Add.GetText(), "提交工器具机械验收生成待办: " + model.Epm_Material.Id); #endregion #region 消息 var waitSend = GetWaitSendMessageList(model.Epm_Material.ProjectId.Value); foreach (var send in waitSend) { Epm_Massage modelMsg = new Epm_Massage(); modelMsg.ReadTime = null; modelMsg.RecId = send.Key; modelMsg.RecName = send.Value; modelMsg.RecTime = DateTime.Now; modelMsg.SendId = CurrentUserID.ToLongReq(); modelMsg.SendName = CurrentUserName; modelMsg.SendTime = DateTime.Now; modelMsg.Title = CurrentUserName + "提报了工器具机械验收单,待审核"; modelMsg.Content = CurrentUserName + "提报了工器具机械验收单,待审核"; modelMsg.Type = 2; modelMsg.IsRead = false; modelMsg.BussinessId = model.Epm_Material.Id; modelMsg.BussinesType = BusinessType.Equipment.ToString(); modelMsg.ProjectId = model.Epm_Material.ProjectId.Value; modelMsg.ProjectName = model.Epm_Material.ProjectName; modelMsg = base.SetCurrentUser(modelMsg); modelMsg = base.SetCreateUser(modelMsg); DataOperateBusiness <Epm_Massage> .Get().Add(modelMsg); } #endregion #region 发送短信 //Dictionary<string, string> parameterSms = new Dictionary<string, string>(); //parameterSms.Add("UserName", CurrentUserName); //WriteSMS(project.ContactUserId.Value, project.CompanyId, MessageStep.MaterialAdd, parameterSms); #endregion } } catch (Exception e) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(e, "AddMaterial"); } return(result); }
private void prepareLargeCardViewExample() { var image = UIImage.FromBundle(name: "CosmicMindInverted"); var cardView = new MaterialPulseView(frame: new CGRect(16, 100, View.Bounds.Width - 32, 400)); cardView.PulseColor = MaterialColor.BlueGrey.Base; cardView.Depth = MaterialDepth.Depth1; View.AddSubview(cardView); var leftImageView = new MaterialView(); leftImageView.Image = image; leftImageView.ContentsGravityPreset = MaterialGravity.ResizeAspectFill; cardView.AddSubview(leftImageView); var topImageView = new MaterialView(); topImageView.Image = image; topImageView.ContentsGravityPreset = MaterialGravity.ResizeAspectFill; cardView.AddSubview(topImageView); var bottomImageView = new MaterialView(); bottomImageView.Image = image; bottomImageView.ContentsGravityPreset = MaterialGravity.ResizeAspectFill; cardView.AddSubview(bottomImageView); var contentView = new MaterialView(); contentView.BackgroundColor = MaterialColor.Clear; cardView.AddSubview(contentView); var titleLabel = new UILabel(); titleLabel.Text = "Material"; titleLabel.TextColor = MaterialColor.BlueGrey.Darken4; titleLabel.BackgroundColor = MaterialColor.Clear; contentView.AddSubview(titleLabel); image = MaterialIcon.CM.Add; var moreButton = new IconButton(); moreButton.ContentEdgeInsetsPreset = MaterialEdgeInset.None; moreButton.PulseColor = MaterialColor.BlueGrey.Darken4; moreButton.TintColor = MaterialColor.BlueGrey.Darken4; moreButton.SetImage(image: image, forState: UIControlState.Normal); moreButton.SetImage(image: image, forState: UIControlState.Highlighted); contentView.AddSubview(moreButton); var detailLabel = new UILabel(); detailLabel.Lines = 0; detailLabel.LineBreakMode = UILineBreakMode.TailTruncation; detailLabel.Font = RobotoFont.RegularWithSize(12); detailLabel.Text = "Express your creativity with Material, an animation and graphics framework for Google's Material Design and Apple's Flat UI in Swift."; detailLabel.TextColor = MaterialColor.BlueGrey.Darken4; detailLabel.BackgroundColor = MaterialColor.Clear; contentView.AddSubview(detailLabel); var alarmLabel = new UILabel(); alarmLabel.Font = RobotoFont.RegularWithSize(12); alarmLabel.Text = "34 min"; alarmLabel.TextColor = MaterialColor.BlueGrey.Darken4; alarmLabel.BackgroundColor = MaterialColor.Clear; contentView.AddSubview(alarmLabel); image = UIImage.FromBundle(name: "ic_alarm_white").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); var alarmButton = new IconButton(); alarmButton.ContentEdgeInsetsPreset = MaterialEdgeInset.None; alarmButton.PulseColor = MaterialColor.BlueGrey.Darken4; alarmButton.TintColor = MaterialColor.Red.Base; alarmButton.SetImage(image: image, forState: UIControlState.Normal); alarmButton.SetImage(image: image, forState: UIControlState.Highlighted); contentView.AddSubview(alarmButton); leftImageView.Grid().Rows = 7; leftImageView.Grid().Columns = 6; topImageView.Grid().Rows = 4; topImageView.Grid().Columns = 6; topImageView.Grid().Offset.Columns = 6; bottomImageView.Grid().Rows = 3; bottomImageView.Grid().Offset.Rows = 4; bottomImageView.Grid().Columns = 6; bottomImageView.Grid().Offset.Columns = 6; contentView.Grid().Rows = 5; contentView.Grid().Offset.Rows = 7; cardView.Grid().Axis.Direction = GridAxisDirection.None; cardView.Grid().Spacing = 4; cardView.Grid().Views = new List <UIView> { leftImageView, topImageView, bottomImageView, contentView }; titleLabel.Grid().Rows = 3; titleLabel.Grid().Columns = 8; moreButton.Grid().Rows = 3; moreButton.Grid().Columns = 2; moreButton.Grid().Offset.Columns = 10; detailLabel.Grid().Rows = 6; detailLabel.Grid().Offset.Rows = 3; alarmLabel.Grid().Rows = 3; alarmLabel.Grid().Columns = 8; alarmLabel.Grid().Offset.Rows = 9; alarmButton.Grid().Rows = 3; alarmButton.Grid().Offset.Rows = 9; alarmButton.Grid().Columns = 2; alarmButton.Grid().Offset.Columns = 10; contentView.Grid().Spacing = 8; contentView.Grid().Axis.Direction = GridAxisDirection.None; contentView.Grid().ContentInsetPreset = MaterialEdgeInset.Square3; contentView.Grid().Views = new List <UIView> { titleLabel, moreButton, detailLabel, alarmLabel, alarmButton }; }