private bool InsertDocumentStatus(string DocType, string fileName)
        {
            if (cmbFamilyDocNo.SelectedIndex < 0)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please Select family number');", true);
                return(false);
            }
            else if (cmbVillage.SelectedIndex < 0)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Village');", true);
                return(false);
            }
            //else if (cmbDocumentNo.SelectedIndex < 0)
            //{
            //    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select survey No.');", true);
            //    return false;
            //}
            else
            {
                string DocumentID = dbDocumentStatusData.getDocumentSeqNo();
                dbDocumentStatusData.documentid  = Convert.ToInt32(DocumentID);
                dbDocumentStatusData.villagecode = cmbVillage.SelectedValue.ToString().Trim();
                dbDocumentStatusData.familyno    = "";
                dbDocumentStatusData.surveyno    = cmbDocumentNo.SelectedValue.ToString().Trim();
                //Check Existing Title Search Exist
                dsDocumenttitleSearch = dbDocumentStatusData.DocumentTitleExistRO(cmbVillage.SelectedValue.ToString().Trim(), cmbFamilyDocNo.SelectedValue.ToString().Trim());
                if (dsDocumenttitleSearch.Tables[0].Rows.Count > 0)
                {
                    dbDocumentStatusData.titlesearchno = dsDocumenttitleSearch.Tables[0].Rows[0]["titlesearchno"].ToString();
                }
                else
                {
                    // dbDocumentStatusData.titlesearchno = cmbVillage.SelectedValue.ToString().Trim() + "_" + cmbFamily.SelectedValue.ToString().Trim() + "-" + cmbDocumentNo.SelectedValue.ToString().Trim() + "_" + DocumentID;
                    dbDocumentStatusData.titlesearchno = cmbDocumentNo.SelectedValue.ToString().Trim();
                }

                dbDocumentStatusData.docno        = cmbFamilyDocNo.SelectedValue.ToString().Trim();
                dbDocumentStatusData.documentcode = DocType;
                dbDocumentStatusData.documentname = fileName;
                dbDocumentStatusData.documentpath = ViewState["filepath"].ToString();
                dbDocumentStatusData.createdby    = "RSD";
                dbDocumentStatusData.createddate  = DateTime.Today;
                //Check For Record Exist
                dsDocumentexists = dbDocumentStatusData.DocumentExistRO(cmbVillage.SelectedValue.ToString().Trim(), cmbFamilyDocNo.SelectedValue.ToString().Trim(), DocType);
                if (dsDocumentexists.Tables[0].Rows.Count == 0)
                {
                    bool DocInsert = dbDocumentStatusData.AddDocumentStatus();
                }
                else
                {
                    //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('File Already exist now updating');", true);
                    // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "element.onclick = function(){ return confirm('Are you sure you want to delete?'); };",true);
                    bool DocumentFileUpdate = dbDocumentStatusData.UpdateDocumentFileRO(cmbDocumentNo.SelectedValue.ToString().Trim());
                    if (DocumentFileUpdate)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('New File updated');", true);
                    }
                }
                return(true);
            }
        }