protected void btnFileSubmit_Click(object sender, EventArgs e)
    {
        string dsc = "ویرایش پرونده";
        string oprationType = FileLogOpration.Edit.ToString();
        int harfParvandeID;
        int shomareParvande;
        if (CheckValidate())
        {
            JazbFile file;

            if (FileID == 0)
            {
                dsc = "درج پرونده";
                oprationType = FileLogOpration.Insert.ToString();
                file = new JazbFile();
                dc.JazbFiles.Add(file);
            }
            else
                file = dc.JazbFiles.Single(p => p.ID == FileID);

            harfParvandeID = GetHarfParvandeID(txtLastName.Text.Trim().Substring(0, 1));
            shomareParvande = txtShomareParvande.Text != string.Empty ? Convert.ToInt32(txtShomareParvande.Text) : GenerateShomareParvande(harfParvandeID);

            file.FileNo = shomareParvande;
            if(harfParvandeID!=0)
                file.FileHarfID = harfParvandeID;
            file.NationalCode = txtNationalCode.Text;
            file.FirstName = txtFirstName.Text;
            file.LastName = txtLastName.Text;
            file.FormerLastName = txtFormerLastName.Text;
            file.FatherName = txtFatherName.Text;
            file.BirthDate = txtBirthDate.Text;
            file.IdentNum = txtIdentNo.Text;
            file.IssuancePlaceNamex = txtIssuancePlace.Text;
            if (cboSex.SelectedValue != "-1")
                file.SexID = Convert.ToInt32(cboSex.SelectedValue);
            if (cboNationality.SelectedItem != null && cboNationality.SelectedValue != "-1")
                file.NationalityID = Convert.ToInt32(cboNationality.SelectedValue);
            if (cboReligion.SelectedValue != "-1")
                file.ReligionID = Convert.ToInt32(cboReligion.SelectedValue);
            if (cboMarriage.SelectedValue != "-1")
                file.MarriageStatusID = Convert.ToInt32(cboMarriage.SelectedValue);
            if (txtChildCount.Text != string.Empty)
                file.ChildCount = Convert.ToInt32(txtChildCount.Text);
            file.Address = txtAddress.Text;
            file.PostalCode = txtPostalCode.Text.Trim();
            file.Phone = txtPhone.Text.Trim();
            file.Mobile = txtMobile.TextWithLiterals.Trim();
            file.Email = txtEmailAddress.Text;
            //file.UpdateDate = PersianDate.CurrentDate();
            dc.SaveChanges();
            dc.Entry(file).Reference(p => p.FileHarf).Load();
            EventLogger.Log("پرونده ها", Audit.Level.Audit, dsc + " به شماره " + shomareParvande + " " + (file.FileHarf!=null? file.FileHarf.Dsc:" "), "Jazb.File", file.ID, EnumerableListUtility.GetByQualifer(oprationType), Audit.Result.Success);
            //InsertFileLog(file.ID, FileLogRelatedSection.File.ToString(),
            //    oprationType, dsc + " به شماره " + shomareParvande + " " + file.FileHarf.Dsc);

            this.FileID = file.ID;
            string tempPath = Config.TempPath + "Jazb.FileDocument/" + file.ID;
            Directory.CreateDirectory(MapPath(tempPath));

            if (AuthenticatedUser.Permission("Jazb-File-Document"))
            {
                foreach (UploadedFile item in uplDoc.UploadedFiles)
                    if (item.FileName != string.Empty)
                    {
                        var fileName = Guid.NewGuid().ToString().Substring(1, 5) + StringUtility.NormalizeKeAndYe (item.GetName().Replace("%", ""));
                        string filePath = MapPath(tempPath) + "\\" + fileName;
                        item.SaveAs(filePath);

                        FileDocument doc = new FileDocument();
                        doc.FileID = file.ID;
                        doc.DocumentName = Path.GetFileName(filePath);
                        dc.FileDocuments.Add(doc);
                        dc.SaveChanges();
                        EventLogger.Log("پرونده ها", Audit.Level.Audit, "بارگذاری فایل پیوست " + doc.DocumentName, RoshdSchema.Jazb_File, file.ID, "Jazb.FileDocument", doc.ID, EnumerableListUtility.GetByQualifer(oprationType), Audit.Result.Success);
                        FileTableUtility.UploadFile("Jazb.FileDocument", doc.FileID.ToString(), Path.GetFileName(filePath), File.ReadAllBytes(filePath));
                    }
            }
            BindFileDocuments();
            //ucFile.FileID = file.ID;
            //ReloadParvandeForm(file);
            //SetVisibilityEducationInsertButton();
        }
        //SetControls();
    }