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