private void btnUpload_Click(object sender, EventArgs e) { try { foreach (var file in uploadedFiles) { var imageLibrary = new FaultLibrary(); imageLibrary.FileName = file.Split('@')[0]; imageLibrary.Url = file.Split('@')[1]; imageLibrary.FaultId = _customFault.Id; imageLibrary.ModifiedBy = AuthenticatedDetails.LoggedUser.Id; imageLibrary.ModifiedDate = DateTime.Now; imageLibrary.CreatedDate = DateTime.Now; imageLibrary.CreatedBy = AuthenticatedDetails.LoggedUser.Id; FaultRepository.SaveFile(imageLibrary); UploadedFiles = FaultRepository.GetFilesByFaultId(_customFault.Id).ToList(); dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = UploadedFiles; } MessageBox.Show("Files Added Successfully !!!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Failed to load form", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//binding & set default form Fault private void loadFaultDefaultEdit(int id) { Session["DtAttachmentEdit"] = null; HiddenText["Edit"] = "1"; HiddenText["IdFault"] = id; var DataLoad = FaultRepository.GetFaultRecordById(id); currentdate.Date = DateTime.Now; //GVDataAttachment.DataSource = Session["dtAttachment"]; //GVDataAttachment.DataBind(); CSTypeValue.Text = DataLoad[0].CSType.ToString(); cbStation.Text = DataLoad[0].StationName.ToString(); cbStation.ReadOnly = true; cbStamp.Text = DataLoad[0].StamperName; tbRemark.Text = DataLoad[0].Remarks; cbQG.Text = DataLoad[0].QualityGateName.ToString(); cbQG.ReadOnly = true; cbFINNumber.Text = DataLoad[0].FINNumber.ToString(); cbFINNumber.ReadOnly = true; cbPartProces.Text = DataLoad[0].FaultPartProcessDesc.ToString(); cbFaultDesc.Text = DataLoad[0].FaultDescriptionText; cbFaultRelated.Text = DataLoad[0].FaultRelatedTypeDesc; cbPriority.Text = DataLoad[0].Priority.ToString(); cbInspector.Text = DataLoad[0].InspectorName; cbStamp.Text = DataLoad[0].StamperName; cbRecti.Text = DataLoad[0].IsSentToRectification.ToString(); tbNCP.Text = DataLoad[0].NCP; tbRemark.Text = DataLoad[0].Remarks; //set TextBox Line //string line = GetLine(Convert.ToInt32(cbFINNumber.Value)); tbLine.Text = DataLoad[0].ProductionLineName; //set textBox Assembly Section //string section = GetSection(Convert.ToInt32(cbStation.Value)); tbAssemblySection.Text = DataLoad[0].AssemblySectionName; //set textBox Fault Classification //string classification = GetClassification(Convert.ToInt32(cbFaultDesc.Value)); tbClassification.Text = DataLoad[0].FaultClassDescription; //set comboBox CGIS cbCGISx.Text = DataLoad[0].CGISNo; HiddenText["FINNumber"] = cbFINNumberx.Text == "1" ? "-Select-" : cbFINNumberx.Text; if (cbFINNumberx.Text == "1") { cbFINNumberx.Text = "-Select-"; } else { cbFINNumberx.Text = DataLoad[0].FINNumber; } var faults = FaultRepository.GetAttachMentViewEdit(id); Session["DtAttachmentEdit"] = faults; Session["dtAttachment"] = ConvertListToDataTable(faults); GVDataAttachment.DataSource = faults; GVDataAttachment.DataBind(); }
public ActionResult UploadFiles(FaultDTO model, HttpPostedFileBase postedfile) { ViewBag.Priorities = FaultPrioritiesRepository.GetActivePriorities(); ViewBag.Complexities = FaultComplexityRepository.GetActiveComplexities(); ViewBag.Companies = CompanyRepository.GetAllActive(); ViewBag.Enigineers = UsersinfoRepository.GetAllActiveEngineers(); ViewBag.UploadedFiles = FaultRepository.GetFilesByFaultId(model.Id); try { var imageLibrary = new FaultLibrary(); if (postedfile != null) { var filePath = SaveImage(postedfile); imageLibrary.FileName = postedfile.FileName; imageLibrary.Url = filePath; imageLibrary.FaultId = model.Id; imageLibrary.ModifiedBy = this.CurrentSession.LoggedUser.Id; imageLibrary.ModifiedDate = DateTime.Now; imageLibrary.CreatedDate = DateTime.Now; imageLibrary.CreatedBy = this.CurrentSession.LoggedUser.Id; } FaultRepository.SaveFile(imageLibrary); TempData["Message"] = "Files uploaded successfully !!!"; TempData["IsError"] = false; return(RedirectToAction("Edit", new { id = model.Id })); } catch (Exception ex) { TempData["Message"] = "Files uploaded successfully !!!"; TempData["IsError"] = false; } return(RedirectToAction("Edit", new { id = model.Id })); }
private void btnSave_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(ddlCompany.SelectedValue) <= 0) { MessageBox.Show("Please select company ", "Required", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (string.IsNullOrEmpty(txtLocation.Text)) { MessageBox.Show("Please enter location", "Required", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Convert.ToInt32(ddlPriority.SelectedValue) <= -1) { MessageBox.Show("Please select priority ", "Required", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Convert.ToInt32(ddlComplexity.SelectedValue) <= -1) { MessageBox.Show("Please select complexity ", "Required", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Convert.ToInt32(ddlAssignedTo.SelectedValue) <= 0) { MessageBox.Show("Please select engineer ", "Required", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var imageLibrary = new FaultLibrary(); var fault = new Fault(); fault.CreatedDate = DateTime.Now; fault.CreatedBy = AuthenticatedDetails.LoggedUser.Id; fault.Status = 1; fault.CompanyId = Convert.ToInt32(ddlCompany.SelectedValue); fault.Complexity = Convert.ToInt32(ddlComplexity.SelectedValue); fault.FaultDescription = txtFaultDescription.Text; fault.FaultStatus = Convert.ToInt32(ddlPriority.SelectedValue) < 1 ? 0 : 1; fault.Location = txtLocation.Text; fault.MachineDescription = txtMachineDescription.Text; fault.ModifiedBy = AuthenticatedDetails.LoggedUser.Id; fault.ModifiedDate = DateTime.Now; fault.Priority = Convert.ToInt32(ddlPriority.SelectedValue); fault.StartDate = DateTime.Now; fault.AssignedTo = Convert.ToInt32(ddlAssignedTo.SelectedValue); fault.FaultLibraries = new List <FaultLibrary>(); FaultRepository.SaveFault(fault); MessageBox.Show("Job Added Successfully !!!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); _parent.ViewJobs(); } catch (Exception ex) { MessageBox.Show("Failed to load form", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void gridFault_DataBinding(object sender, EventArgs e) { ASPxGridView faultGridView = (ASPxGridView)sender; var faults = FaultRepository.GetReleaseFaultRecord(); faultGridView.DataSource = faults; (faultGridView.Columns["FaultStatus"] as GridViewDataComboBoxColumn).PropertiesComboBox.DataSource = Enum.GetValues(typeof(EFaultStatus)); }
protected void Btn_ShowAttach_Click(object sender, EventArgs e) { PopUpViewDocument.ShowOnPageLoad = true; ASPxButton btn = sender as ASPxButton; GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer; var index = container.VisibleIndex; var FinNumber = gridFault.GetRowValues(index, "FINNumber"); string FinParam = FinNumber.ToString(); var faults = FaultRepository.GetAttachMentView(FinParam); GvAttachMentView.DataSource = faults; GvAttachMentView.DataBind(); }
protected void gridFault_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { var model = new FaultRecord(); model.FaultRecordId = (int)e.Keys[0]; model.FaultStatus = e.NewValues["FaultStatus"].ToString() == EFaultStatus.Open.ToString() ? (int)EFaultStatus.Open : (int)EFaultStatus.Close; model.Remarks = (string)e.NewValues["Remarks"]; FaultRepository.UpdateFaultRecord(model); ASPxGridView senderGridView = (ASPxGridView)sender; e.Cancel = true; senderGridView.CancelEdit(); senderGridView.DataSource = FaultRepository.GetReleaseFaultRecord(); }
protected void btnSaveCloseEdit_Click(object sender, EventArgs e) { var model = new FaultRecord(); model.FaultRecordId = int.Parse(HiddenText["IdFault"].ToString()); model.FaultStatus = FaultStatusx.Text == "" ? 0 : int.Parse(FaultStatusx.SelectedItem.Value.ToString()); model.Remarks = tbRemarkx.ToString(); model.Priority = cbPriorityx.SelectedItem == null ? 0 : int.Parse(cbPriorityx.Value.ToString()); model.FaultDescriptionId = cbFaultDescx.SelectedItem == null ? 0 : int.Parse(cbFaultDescx.Value.ToString()); model.FaultRelatedTypeId = cbFaultRelatedx.SelectedItem == null ? 0 : int.Parse(cbFaultRelatedx.Value.ToString()); FaultRepository.UpdateFaultRecord(model); pcInteruptFault.ShowOnPageLoad = false; pcInteruptFaultx.ShowOnPageLoad = false; Response.Redirect("../Production/ProductionReleaseFault.aspx"); }
protected void Btn_Delete_Click(object sender, EventArgs e) { pcInteruptFaultx.ShowOnPageLoad = true; ASPxButton btn = sender as ASPxButton; GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer; var index = container.VisibleIndex; int ValueId = int.Parse(gridFault.GetRowValues(index, "FaultRecordId").ToString()); try { FaultRepository.DeleteFault(ValueId); } catch (Exception ex) { AppLogger.LogError(ex); } Response.Redirect(Request.RawUrl); }
private void FrmEditJob_Load(object sender, EventArgs e) { try { Priorities = FaultPrioritiesRepository.GetActivePriorities(); Complexities = FaultComplexityRepository.GetActiveComplexities(); Companies = CompanyRepository.GetAllActive(); Enigineers = UsersinfoRepository.GetAllActiveEngineers(); UploadedFiles = FaultRepository.GetFilesByFaultId(_customFault.Id).ToList(); var fault = FaultRepository.GetFaultById(_customFault.Id); ddlCompany.DataSource = Companies; ddlCompany.DisplayMember = "Name"; ddlCompany.ValueMember = "Id"; ddlComplexity.DataSource = Complexities; ddlComplexity.DisplayMember = "Name"; ddlComplexity.ValueMember = "Id"; ddlPriority.DataSource = Priorities; ddlPriority.DisplayMember = "Name"; ddlPriority.ValueMember = "Id"; ddlAssignedTo.DataSource = Enigineers; ddlAssignedTo.DisplayMember = "Name"; ddlAssignedTo.ValueMember = "Id"; txtFaultDescription.Text = fault.FaultDescription; txtLocation.Text = fault.Location; txtMachineDescription.Text = fault.MachineDescription; ddlAssignedTo.SelectedValue = fault.AssignedTo; ddlCompany.SelectedValue = fault.CompanyId; ddlComplexity.SelectedValue = fault.Complexity; ddlPriority.SelectedValue = fault.Priority; dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = UploadedFiles; } catch (Exception ex) { MessageBox.Show("Failed to load form", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// List<DocumentAttachment> AttachFileModelList = new List<DocumentAttachment>(); protected void Page_Load(object sender, EventArgs e) { UploadAttachment.ValidationSettings.MaxFileSize = AppConfiguration.UPLOAD_MAXFILESIZE_BYTES; UploadAttachment.ValidationSettings.MaxFileSizeErrorText = "File size must be <= " + AppConfiguration.UPLOAD_MAXFILESIZE_BYTES.BytesToString(); UploadAttachment.ValidationSettings.AllowedFileExtensions = AppConfiguration.UPLOAD_FILE_EXTENSIONS.Split(","); if (!IsPostBack) { var faults = FaultRepository.GetReleaseFaultRecord(); gridFault.DataSource = faults; gridFault.DataBind(); //if (Session["dtAttachment"] != null) //{ // GVDataAttachment.DataSource = Session["dtAttachment"]; // GVDataAttachment.DataBind(); //} } PopUpAttachMent.ShowOnPageLoad = false; }
public ActionResult Edit(int id) { var model = new FaultDTO(); try { if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"]; ViewBag.IsError = TempData["IsError"]; } ViewBag.Priorities = FaultPrioritiesRepository.GetActivePriorities(); ViewBag.Complexities = FaultComplexityRepository.GetActiveComplexities(); ViewBag.Companies = CompanyRepository.GetAllActive(); ViewBag.Enigineers = UsersinfoRepository.GetAllActiveEngineers(); ViewBag.UploadedFiles = FaultRepository.GetFilesByFaultId(id); var fault = FaultRepository.GetFaultById(id); if (fault != null) { model.AssignedTo = fault.AssignedTo; model.CompanyId = fault.CompanyId; model.Complexity = fault.Complexity; model.FaultDescription = fault.FaultDescription; model.FaultStatus = fault.FaultStatus; model.Id = fault.Id; model.Location = fault.Location; model.MachineDescription = fault.MachineDescription; model.Priority = fault.Priority; model.StartDate = fault.StartDate; return(View(model)); } TempData["Message"] = "No job exists with this Id."; TempData["IsError"] = true; return(RedirectToAction("Index")); } catch (Exception ex) { } return(View(model)); }
// GET: Job public ActionResult Index() { var list = new List <CustomFault>(); try { if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"]; ViewBag.IsError = TempData["IsError"]; } list = FaultRepository.GetFaults(new Fault()).ToList(); } catch (Exception ex) { ViewBag.Message = "Failed to get faults"; ViewBag.IsError = true; } return(View(list)); }
//get Fault Classification by DescriptionId public static string GetClassification(int values) { var tempClassification = FaultRepository.GetFaultClassification(values); return(tempClassification.Description); }
protected void btnProcess_Click(object sender, EventArgs e) { var items = gridCondition.GetSelectedFieldValues(new string[] { "ItemId", "StationId" }); if (items.Any()) { foreach (var item in items) { //convert object to readable type IEnumerable <object> prodItem = (IEnumerable <object>)item; var _itemId = Convert.ToInt32(prodItem.FirstOrDefault().ToString()); var _stationId = Convert.ToInt32(prodItem.LastOrDefault().ToString()); //get history item var histItem = ProductionRepository.GetProductionItemByHistoryStation(_stationId, _itemId); if (_condition == "isVoca") { //check if this car still have fault to solve if (FaultRepository.IsHaveFault(_itemId)) { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('There are still unfinished fault, please solve this first.');", true); } else if (ProductionRepository.UpdateProductionHistoryVOCA(_itemId, false)) { // insert new inventory if (ProductionRepository.InsertProductionInventory(_itemId, assemblyTypeId) > 0) { //update this last item production history detail if (ProductionRepository.UpdateProductionHistoryDetail(_itemId, _stationId, histItem.IsOffline, histItem.IsRectification, histItem.IsOffline, histItem.IsRectification, true)) { //update production history status to complete if (ProductionRepository.UpdateProductionHistoryComplete(_itemId)) { //update all existing assembly for this part ProductionRepository.UpdateAllSubAssyBySerialNumber(histItem.FINNumber); //load data LoadData(); } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed Update Production History, please contact your administrator');", true); } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed Update Production History Details, please contact your administrator');", true); } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed Insert New Inventory, please contact your administrator');", true); } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Failed Insert New Inventory, please contact your administrator');", true); } } else { var newStationId = _condition == "isRecti" ? ProductionRepository.GetFirstEndOfLineStation(assemblyTypeId) : ProductionRepository.GetFirstStation(assemblyTypeId); //insert new station detail to start eol if (0 != ProductionRepository.InsertProductionHistoryDetail(histItem.ItemId, newStationId, _condition == "isRecti" ? histItem.IsOffline : false, _condition == "isRecti" ? false : histItem.IsRectification, "")) { //update last un done history detail if (ProductionRepository.UpdateProductionHistoryDetail(histItem.ItemId, histItem.StationId, histItem.IsOffline, histItem.IsRectification, histItem.IsOffline, true, true)) { if (_condition == "isRecti") { ProductionRepository.UpdateAllSubAssyBySerialNumber(histItem.FINNumber); } //todo success LoadData(); } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Cannot update last history details.');", true); } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Cannot send " + histItem.FINNumber + " to " + _condition == "isRecti" ? "End of Line" : "Trimming Line" + ".');", true); } } } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('No Rows Selected.');", true); } }
public void InstantiateIn(Control container) { int assemblyTypeId = HttpContext.Current.Session["assemblyType"].ToInt32(0); var dvMasterContainer = container as DataViewItemTemplateContainer; StationInfo info = dvMasterContainer.DataItem as StationInfo; if (info == null) { return; } var firstStationId = ProductionRepository.GetFirstStation(assemblyTypeId); ////set parameter //int _historyId = GetData(dataItem, "HistoryId").ToInt32(0); //string _model = GetData(dataItem, "ModelName").ToString(string.Empty); //string _variant = GetData(dataItem, "VariantName").ToString(string.Empty); //string _finNo = GetData(dataItem, "FINNumber").ToString(string.Empty); //string _statusId = GetData(dataItem, "StatusId").ToString(string.Empty); //string _stationName = GetData(dataItem, "StationName").ToString(string.Empty); //bool _isQGate = GetData(dataItem, "IsQGate") == "True" ? true : false; //string _stationId = GetData(dataItem, "StationId").ToString(string.Empty); //bool _isSubAssy = GetData(dataItem, "IsSubAssy") == "True" ? true : false; //bool _IsEndOfLine = GetData(dataItem, "IsEndOfLine") == "True" ? true : false; //string _sectionId = GetData(dataItem, "SectionId").ToString(string.Empty); //string _numSubAssy = GetData(dataItem, "NumSubAssy").ToString(string.Empty); //bool _isfinishLine = GetData(dataItem, "IsFinishLine") == "True" ? true : false; //bool isMechLine = GetData(dataItem, "IsMechLine") == "True" ? true : false; //bool isList = GetData(dataItem, "IsList") == "True" ? true : false; //string UrlImageCar = ProductionHistoryHelper.GetImageCar(_historyId); ////MemoryStream ms = new MemoryStream(ImageCar); ////System.Drawing.Image img = System.Drawing.Image.FromStream(ms); ////paramter get problem //int LineId = GetData(dataItem, "LineId").ToInt32(0); //int stationId = GetData(dataItem, "StationId").ToInt32(0); //if (firstStationId == stationId) //{ // var countCarHOP = ProductionRepository.GetVehicleCountInStation(stationId, LineId); // _stationName = _stationName + '(' + countCarHOP + ')'; //} //Generate new divTemplateDataView in Template dataView HtmlGenericControl div = new HtmlGenericControl("div"); //Generate new divHeader in divTemplateDataView HtmlGenericControl divHeader = new HtmlGenericControl("div"); divHeader.Attributes.Add("class", "div-station-name"); ASPxLabel lblStationName = new ASPxLabel(); lblStationName.CssClass = "lblStationName_" + info.LineId + "_" + info.StationId; divHeader.Controls.Add(lblStationName); //Generate new divBody in divTemplateDataView HtmlGenericControl divBody = new HtmlGenericControl("div"); divBody.Attributes.Add("class", "div-body"); ASPxLabel lblModel = new ASPxLabel(); lblModel.ID = "lblModel_" + info.LineId + "_" + info.StationId; lblModel.Text = ""; divBody.Controls.Add(lblModel); //Generate imageCondition ImageButton imgCondition = new ImageButton(); imgCondition.ID = "imgCondition_" + info.LineId + "_" + info.StationId; imgCondition.Enabled = false; imgCondition.CssClass = "img-notification"; divBody.Controls.Add(imgCondition); //Generate new divImage in divTemplateDataView HtmlGenericControl divImage = new HtmlGenericControl("div"); ASPxButton btnDetail = new ASPxButton(); btnDetail.ID = "btnDetail_" + info.LineId + "_" + info.StationId;; btnDetail.AutoPostBack = false; btnDetail.CssClass = "btn-details"; divImage.Controls.Add(btnDetail); //Generate new divFooter in divTemplateDataView HtmlGenericControl divFooter = new HtmlGenericControl("div"); divFooter.Attributes.Add("class", "div-footer"); ASPxLabel lblFINNumber = new ASPxLabel(); lblFINNumber.ID = "lblFINNumber_" + info.LineId + "_" + info.StationId; lblFINNumber.Text = ""; divFooter.Controls.Add(lblFINNumber); div.Controls.Add(divHeader); div.Controls.Add(divBody); div.Controls.Add(divImage); div.Controls.Add(divFooter); container.Controls.Add(div); if (info.Capacity <= 1 || info.Items == null || info.Items.Count == 0) { lblStationName.Text = info.StationName; } else { lblStationName.Text = String.Format("{0} ({1})", lblStationName, info.Items.Count); } if (info.Capacity > 1) { btnDetail.Text = info.Items.Count.ToString(); lblModel.Visible = false; imgCondition.Visible = false; lblFINNumber.Visible = false; } else { if (info.Items.Count == 0) { lblModel.Text = ""; imgCondition.Visible = false; lblFINNumber.Text = ""; btnDetail.ClientEnabled = false; btnDetail.ImageUrl = urlImgDefaultEmpty; } else { lblModel.Text = info.Items[0].ModelName; imgCondition.ImageUrl = FaultRepository.hasFault(info.Items[0].Id) || (ProductionRepository.GetAndonProductionProblem(info.LineId, DateTime.Now, "", info.StationId).Count() > 0) ? urlImgNotifRed : urlImgNotifGreen; if (info.Items[0].SerialNumber.Length < 17)//Engine Data { // Permintaaan 8 Character lblFINNumber.Text = string.IsNullOrWhiteSpace(info.Items[0].SerialNumber) ? string.Empty : info.Items[0].SerialNumber.Length < 14 ? string.Empty : info.Items[0].SerialNumber.Substring(6, 8); } else { lblFINNumber.Text = string.IsNullOrWhiteSpace(info.Items[0].SerialNumber) ? string.Empty : info.Items[0].SerialNumber.Length < 17 ? string.Empty : info.Items[0].SerialNumber.Substring(11, 6); } string UrlImageCar = ProductionHistoryHelper.GetImageCar(info.Items[0].Id); if (UrlImageCar == "" || UrlImageCar == null) { btnDetail.ImageUrl = urlImgDefaultCar; } else { btnDetail.ImageUrl = UrlImageCar; } } } //if Subassy DataView if (info.Capacity > 1) { btnDetail.ClientSideEvents.Click = "function (s, e) {window.location = '../Production/ProductionStationList.aspx?Stat=" + info.StationId + "'}"; } else { btnDetail.ClientSideEvents.Click = "function (s, e) {window.location = '../Production/ProductionDashboardDetail.aspx?Type=" + (info.IsQGate ? "1" : "0") + "&Hist=" + 0 + "&Stat=" + info.StationId + "&Sect=0'}"; } }
public ActionResult Edit(FaultDTO model) { ViewBag.Priorities = FaultPrioritiesRepository.GetActivePriorities(); ViewBag.Complexities = FaultComplexityRepository.GetActiveComplexities(); ViewBag.Companies = CompanyRepository.GetAllActive(); ViewBag.Enigineers = UsersinfoRepository.GetAllActiveEngineers(); ViewBag.UploadedFiles = FaultRepository.GetFilesByFaultId(model.Id); try { if (model.CompanyId == null || model.CompanyId <= 0) { ViewBag.Message = "Please select company"; ViewBag.IsError = true; return(View(model)); } if (string.IsNullOrEmpty(model.Location)) { ViewBag.Message = "Please enter location name"; ViewBag.IsError = true; return(View(model)); } if (model.Priority == null) { ViewBag.Message = "Please select priority"; ViewBag.IsError = true; return(View(model)); } if (model.Complexity == null) { ViewBag.Message = "Please select complexity"; ViewBag.IsError = true; return(View(model)); } if (model.AssignedTo == null || model.AssignedTo <= 0) { ViewBag.Message = "Please select an engineer"; ViewBag.IsError = true; return(View(model)); } if (model.StartDate == null) { ViewBag.Message = "Please enter start date"; ViewBag.IsError = true; return(View(model)); } var imageLibrary = new FaultLibrary(); var fault = FaultRepository.GetFaultById(model.Id); fault.CompanyId = model.CompanyId; fault.Complexity = model.Complexity; fault.FaultDescription = model.FaultDescription; fault.FaultStatus = model.Priority < 1 ? 0 : 1; fault.Location = model.Location; fault.MachineDescription = model.MachineDescription; fault.ModifiedBy = this.CurrentSession.LoggedUser.Id; fault.ModifiedDate = DateTime.Now; fault.Priority = model.Priority; fault.StartDate = model.StartDate; fault.AssignedTo = model.AssignedTo; FaultRepository.UpdateFault(fault); TempData["Message"] = "Job added successfully !!!"; TempData["IsError"] = false; return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Message = "Failed to save job details"; ViewBag.IsError = true; } return(View(model)); }
public ActionResult Add(FaultDTO model, HttpPostedFileBase postedfile) { ViewBag.Priorities = FaultPrioritiesRepository.GetActivePriorities(); ViewBag.Complexities = FaultComplexityRepository.GetActiveComplexities(); ViewBag.Companies = CompanyRepository.GetAllActive(); ViewBag.Enigineers = UsersinfoRepository.GetAllActiveEngineers(); try { if (model.CompanyId == null || model.CompanyId <= 0) { ViewBag.Message = "Please select company"; ViewBag.IsError = true; return(View(model)); } if (string.IsNullOrEmpty(model.Location)) { ViewBag.Message = "Please enter location name"; ViewBag.IsError = true; return(View(model)); } if (model.Priority == null) { ViewBag.Message = "Please select priority"; ViewBag.IsError = true; return(View(model)); } if (model.Complexity == null) { ViewBag.Message = "Please select complexity"; ViewBag.IsError = true; return(View(model)); } if (model.AssignedTo == null || model.AssignedTo <= 0) { ViewBag.Message = "Please select an engineer"; ViewBag.IsError = true; return(View(model)); } var imageLibrary = new FaultLibrary(); if (postedfile != null) { var filePath = SaveImage(postedfile); imageLibrary.FileName = postedfile.FileName; imageLibrary.Url = filePath; imageLibrary.ModifiedBy = this.CurrentSession.LoggedUser.Id; imageLibrary.ModifiedDate = DateTime.Now; imageLibrary.CreatedDate = DateTime.Now; imageLibrary.CreatedBy = this.CurrentSession.LoggedUser.Id; } var fault = new Fault() { CompanyId = model.CompanyId, CreatedDate = DateTime.Now, CreatedBy = this.CurrentSession.LoggedUser.Id, Complexity = model.Complexity, FaultDescription = model.FaultDescription, FaultStatus = model.Priority < 1 ? 0 : 1, Location = model.Location, MachineDescription = model.MachineDescription, ModifiedBy = this.CurrentSession.LoggedUser.Id, ModifiedDate = DateTime.Now, Priority = model.Priority, StartDate = DateTime.Now, Status = 1, AssignedTo = model.AssignedTo, FaultLibraries = new List <FaultLibrary>() }; if (!string.IsNullOrEmpty(imageLibrary.Url)) { imageLibrary.FaultId = fault.Id; fault.FaultLibraries.Add(imageLibrary); } FaultRepository.SaveFault(fault); TempData["Message"] = "Job added successfully !!!"; TempData["IsError"] = false; return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Message = "Failed to save job details"; ViewBag.IsError = true; } return(View(model)); }
public static string GetBauMaster(string values) { var tempType = FaultRepository.GetBauMaster(values); return(tempType); }
protected void btnSaveClose_Click(object sender, EventArgs e) { if (HiddenText["Edit"].ToString() == "0") { var fault = faultRecord(); if (fault.FaultRecordModels.Remarks != "MandatoryEmpty") { if (fault.FaultRecordModels.Remarks != "MandatoryEmpty2") { var GetIdFault = FaultRepository.InsertFaultRecordReleaseDynamic(fault.FaultRecordModels); for (int x = 0; x < fault.AttachmentModels.Count(); x++) { var id = cbFINNumber.Text.Split('/')[1].Trim(); FaultRepository.InsertAttachMent(fault.AttachmentModels[x].FileName, fault.AttachmentModels[x].FilePath, id, GetIdFault); } //add to fault record //close popUpControl Fault pcInteruptFault.ShowOnPageLoad = false; //binding again grid Fault gridFault.DataBind(); // detailCondition.ImageUrl = FaultRepository.IsHaveFault(_historyId) ? urlImgNotifRed : urlImgNotifGreen; //} } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage2", @"alert('Please Fill FinNumber');", true); } } else { ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage4", @"alert('Please Fill CSType');", true); } Response.Redirect("../Production/ProductionReleaseFault.aspx"); } else { var model = new FaultRecord(); int IdFault = int.Parse(HiddenText["IdFault"].ToString()); model.FaultRecordId = IdFault; model.FaultStatus = faultStatus.Text == "" ? 0 : int.Parse(faultStatus.SelectedItem.Value.ToString()); model.Remarks = tbRemark.Text.ToString(); model.Priority = cbPriority.SelectedItem == null ? 0 : int.Parse(cbPriority.Value.ToString()); model.FaultDescriptionId = cbFaultDesc.SelectedItem == null ? 0 : int.Parse(cbFaultDesc.Value.ToString()); model.FaultRelatedTypeId = cbFaultRelated.SelectedItem == null ? 0 : int.Parse(cbFaultRelated.Value.ToString()); FaultRepository.UpdateFaultRecord(model); FaultRepository.Delete(IdFault); var SumRowData = GVDataAttachment.VisibleRowCount; List <DocumentAttachment> ListAttachFile = new List <DocumentAttachment>(); for (int i = 0; i < SumRowData; i++) { DocumentAttachment AttachFile = new DocumentAttachment(); AttachFile.FileName = GVDataAttachment.GetRowValues(i, "FileName").ToString(); AttachFile.FilePath = GVDataAttachment.GetRowValues(i, "FileLocation").ToString(); ListAttachFile.Add(AttachFile); } for (int x = 0; x < ListAttachFile.Count(); x++) { var Fin = cbFINNumber.Text; FaultRepository.InsertAttachMent(ListAttachFile[x].FileName, ListAttachFile[x].FilePath, Fin, IdFault); } pcInteruptFault.ShowOnPageLoad = false; pcInteruptFaultx.ShowOnPageLoad = false; Response.Redirect("../Production/ProductionReleaseFault.aspx"); } }
public void RefreshJobs() { Faults = FaultRepository.GetFaults(new Fault()).ToList(); dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = Faults; }