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 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();
        }
예제 #3
0
 public void Fault(Exception exception)
 {
     Write((seq, opt) => FaultRecord.Write(seq, opt, exception.Message));
 }
        public ProductionReleaseFaultModel faultRecord()
        {
            var finnumber = "";

            if (CSTypeValue.Text.ToString() != "-Select-")
            {
                int csType = CSTypeValue.Text.ToString() == "" ? 0 : int.Parse(CSTypeValue.SelectedItem.Value.ToString());
            }
            else
            {
                FaultRecord FaultInput = new FaultRecord();
                //FaultInput.CSType = CSTypeValue.Text == "" ? 0 : int.Parse(CSTypeValue.SelectedItem.Value.ToString());
                FaultInput.Remarks = "MandatoryEmpty";
                ProductionReleaseFaultModel InsertFaultRecordFault = new ProductionReleaseFaultModel();
                {
                    InsertFaultRecordFault.FaultRecordModels = FaultInput;
                };
                return(InsertFaultRecordFault);
            }
            var ncp = tbNCP.Text;
            // int productionHistoriesId = cbFINNumber.Value == null ? 0 : Convert.ToInt32(cbFINNumber.SelectedItem.Text);
            int          productionHistoriesId = 0;
            var          faultNumber           = "32054";
            int          QGate        = Convert.ToInt32(cbQG.Value);
            int          station      = Convert.ToInt32(cbStation.Value);
            ListEditItem selectedItem = cbFINNumber.SelectedItem;

            if (cbFINNumber.Text.ToString() == "-Select-")
            {
                FaultRecord FaultInputfailed = new FaultRecord();
                FaultInputfailed.CSType  = CSTypeValue.Text == "" ? 0 : int.Parse(CSTypeValue.SelectedItem.Value.ToString());
                FaultInputfailed.Remarks = "MandatoryEmpty2";
                ProductionReleaseFaultModel InsertFaultRecordFaultfailed = new ProductionReleaseFaultModel();
                {
                    InsertFaultRecordFaultfailed.FaultRecordModels = FaultInputfailed;
                };
                return(InsertFaultRecordFaultfailed);
            }
            else
            {
                // finnumber = cbFINNumber.Text == "1" ? Session["FINNumber"].ToString() : cbFINNumber.Text;
                finnumber = selectedItem.GetValue("FINNumber").ToString();
            }

            var tempAssemblySection = ProductionRepository.GetAssemblySection(station);
            int assemblySectionId   = tempAssemblySection.Id;

            var tempProductionLine = ProductionRepository.GetLineByProductionId(productionHistoriesId);
            int productionLineId   = tempProductionLine.Id;

            var cgisId       = Convert.ToInt32(cbCGIS.Value);
            int priority     = Convert.ToInt32(cbPriority.Value);
            int partProces   = Convert.ToInt32(cbPartProces.Value);
            int faultRelated = Convert.ToInt32(cbFaultRelated.Value);
            int faultDescId;

            if (int.TryParse(cbFaultDesc.Value.ToString(), out faultDescId))
            {
                faultDescId = Convert.ToInt32(cbFaultDesc.Value);
            }
            else
            {
                faultDescId = ProductionRepository.InputNonStandard(cbFaultDesc.Value.ToString());
            }
            var faultDescText = cbFaultDesc.Text;
            int inspectorId   = Convert.ToInt32(cbInspector.Value);
            var inspectorName = cbInspector.SelectedItem;
            int stampId       = Convert.ToInt32(cbStamp.Value);
            // var stampName = cbStamp.SelectedItem;
            var  stampName = "";
            var  remark    = tbRemark.Text;
            bool recti     = Convert.ToBoolean(cbRecti.Value.ToInt32());

            FaultRecord DataFault = new FaultRecord();

            DataFault.CSType = CSTypeValue.Text == "-Select-" ? 0 : int.Parse(CSTypeValue.SelectedItem.Value.ToString());
            DataFault.NCP    = ncp;
            DataFault.ProductionHistoriesId = productionHistoriesId;
            DataFault.FaultNumber           = faultNumber;
            DataFault.QualityGateId         = QGate;
            DataFault.AssemblySectionId     = assemblySectionId;
            DataFault.ProductionLinesId     = productionLineId;
            DataFault.StationId             = station;
            DataFault.FINNumber             = finnumber.ToString();
            DataFault.CGISId                = cgisId;
            DataFault.Priority              = priority;
            DataFault.FaultPartProcessId    = partProces;
            DataFault.FaultRelatedTypeId    = faultRelated;
            DataFault.FaultDescriptionId    = faultDescId;
            DataFault.FaultDescriptionText  = faultDescText;
            DataFault.InspectorUserId       = inspectorId == null ? 0 : inspectorId;
            DataFault.InspectorName         = inspectorName.ToString();
            DataFault.StamperUserID         = stampId;
            DataFault.StamperName           = stampName.ToString();
            DataFault.Remarks               = remark;
            DataFault.IsSentToRectification = recti;
            DataFault.UserAuth              = "";


            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);
            }

            ProductionReleaseFaultModel InsertFaultRecord = new ProductionReleaseFaultModel();

            {
                InsertFaultRecord.FaultRecordModels = DataFault;
                InsertFaultRecord.AttachmentModels  = ListAttachFile;
            };
            return(InsertFaultRecord);
        }
        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");
            }
        }
        // Token: 0x0600002C RID: 44 RVA: 0x00003848 File Offset: 0x00001A48
        public virtual bool TryRun(Action code, TimeSpan duration, out FaultDefinition faultDefinition, ComplianceMessage context = null, Action <ExceptionHandler.ExceptionData> exceptionHandler = null, CancellationToken cancelToken = default(CancellationToken), double[] retrySchedule = null, [CallerMemberName] string callerMember = null, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0)
        {
            bool result2;

            try
            {
                if (retrySchedule == null)
                {
                    retrySchedule = new double[]
                    {
                        10.0,
                        20.0,
                        30.0
                    };
                }
                int  num = 0;
                long elapsedMilliseconds            = ExceptionHandler.watch.ElapsedMilliseconds;
                ExceptionHandler.ExceptionData args = new ExceptionHandler.ExceptionData
                {
                    Exception   = null,
                    RetryCount  = num,
                    ShouldRetry = false,
                    Context     = context
                };
                for (;;)
                {
                    args.RetryCount = num;
                    bool result = false;
                    ExWatson.SendReportOnUnhandledException(delegate()
                    {
                        result = this.TryRunInternal(code, ref args);
                    });
                    if (result)
                    {
                        break;
                    }
                    if (exceptionHandler != null)
                    {
                        exceptionHandler(args);
                    }
                    if (!args.ShouldRetry)
                    {
                        goto IL_17D;
                    }
                    int num2 = (int)(duration.TotalMilliseconds * (retrySchedule[(num >= retrySchedule.Length) ? (retrySchedule.Length - 1) : num] / 100.0));
                    if (num2 > 0)
                    {
                        faultDefinition = FaultDefinition.FromException(args.Exception, true, args.ShouldRetry, callerMember, callerFilePath, callerLineNumber);
                        ExceptionHandler.FaultMessage(context, faultDefinition, false);
                        if (cancelToken.WaitHandle.WaitOne(num2))
                        {
                            goto IL_17D;
                        }
                    }
                    num++;
                    if ((double)(ExceptionHandler.watch.ElapsedMilliseconds - elapsedMilliseconds) >= duration.TotalMilliseconds || elapsedMilliseconds == ExceptionHandler.watch.ElapsedMilliseconds)
                    {
                        goto IL_17D;
                    }
                }
                faultDefinition = null;
                return(true);

IL_17D:
                faultDefinition = new FaultDefinition();
                FaultRecord faultRecord = new FaultRecord();
                faultDefinition.Faults.TryAdd(faultRecord);
                faultRecord.Data["RC"]    = args.RetryCount.ToString();
                faultRecord.Data["TEX"]   = args.ShouldRetry.ToString();
                faultRecord.Data["EFILE"] = callerFilePath;
                faultRecord.Data["EFUNC"] = callerMember;
                faultRecord.Data["ELINE"] = callerLineNumber.ToString();
                if (args.Exception != null)
                {
                    faultRecord.Data["EX"] = args.Exception.ToString();
                    LocalizedException ex = args.Exception as LocalizedException;
                    if (ex != null)
                    {
                        faultRecord.Data["UM"] = ex.Message;
                    }
                }
                faultDefinition = FaultDefinition.FromException(args.Exception, true, args.ShouldRetry, callerMember, callerFilePath, callerLineNumber);
                ExceptionHandler.FaultMessage(context, faultDefinition, false);
                result2 = false;
            }
            catch (Exception error)
            {
                faultDefinition = FaultDefinition.FromException(error, true, false, callerMember, callerFilePath, callerLineNumber);
                ExceptionHandler.FaultMessage(context, faultDefinition, true);
                throw;
            }
            return(result2);
        }