protected void ClearContractControlAfterSave(bool IsEnable = true, string btnText = "Save")
        {
            btnContractSave.Visible           = true;
            TxtContractName.Text              = "";
            TxtContractId.Text                = "";
            ddlContractCategory.SelectedIndex = 0;
            ddlContractStatus.SelectedIndex   = 0;
            TxtGovCountry.Text                = "";
            HdnGovCountry.Value               = "";

            TxtContractExpDate.Text = "";
            foreach (ListItem item in chkCollaboratorList.Items)
            {
                item.Selected = false;
            }
            foreach (ListItem item in chkClause.Items)
            {
                item.Selected = false;
            }
            TxtLastDate.Text             = ""; TxtDateofLast.Text = "";
            TxtEffectiveDate.Text        = "";
            TxtContractFinalizeDate.Text = "";
            ddlAmendments.SelectedIndex  = 0;
            TxtNContractExpiryDate.Text  = "";
            TxtprocedureCost.Text        = "";
            TxtCoOrdinatorFess.Text      = "";
            TxtInvestigatorFees.Text     = "";
            TxtProjectBudgetCash.Text    = "";

            RptClauseDetail.DataSource = null; RptClauseDetail.DataBind();
            lnkDwnldAmendment.Text     = ""; HdnAmendPath.Value = "";
            lnkDwnldCorespondace.Text  = ""; hdnCoresPath.Value = "";


            TxtContractName.Enabled         = IsEnable;
            TxtContractId.Enabled           = IsEnable;
            ddlContractCategory.Enabled     = IsEnable;
            ddlContractStatus.Enabled       = IsEnable;
            TxtGovCountry.Enabled           = IsEnable;
            HdnGovCountry.Value             = "";
            fldAmendmentFile.Enabled        = IsEnable;
            fldContractFile.Enabled         = IsEnable;
            fldCorespondace.Enabled         = IsEnable;
            TxtContractExpDate.Enabled      = IsEnable;
            chkClause.Enabled               = IsEnable;
            chkCollaboratorList.Enabled     = IsEnable;
            TxtLastDate.Enabled             = IsEnable;
            TxtEffectiveDate.Enabled        = IsEnable;
            TxtContractFinalizeDate.Enabled = IsEnable;
            ddlAmendments.Enabled           = IsEnable;

            TxtNContractExpiryDate.Enabled = IsEnable;
            TxtprocedureCost.Enabled       = IsEnable;
            TxtCoOrdinatorFess.Enabled     = IsEnable;
            TxtInvestigatorFees.Enabled    = IsEnable;
            TxtProjectBudgetCash.Enabled   = IsEnable;
            lnkDwnldAmendment.Enabled      = IsEnable; HdnAmendPath.Value = "";
            lnkDwnldCorespondace.Enabled   = IsEnable; hdnCoresPath.Value = "";
        }
        protected void FillContractDetail(string mode = "Save", int ProjectId = 0)
        {
            TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
            List <SelectedCollborators_Details>         lstSelCollab = new List <SelectedCollborators_Details>();
            List <Selected_Clause_Details>              lstSelClause = new List <Selected_Clause_Details>();
            List <ContractDetails_MultipleContractFile> lstmultiple  = new List <ContractDetails_MultipleContractFile>();
            Contract_Details            _Contract_Details            = new Contract_Details();
            List <ContractList>         ctlist = new List <ContractList>();
            List <Contract_Status_Date> lstcsd = new List <Contract_Status_Date>();

            try
            {
                _Contract_Details = cl.GetContractDeta(Convert.ToInt32(Common.iffBlank(HdnContractId.Value, 0)), ProjectId);

                ////****************Contact*******************
                //ctlist = _Contract_Details.contlist.ToList();
                //RptContract.DataSource = ctlist;
                //RptContract.DataBind();
                ////***************END**********************



                //if (Convert.ToInt32(Common.iffBlank(HdnContractId.Value, 0)) > 0)
                //{


                //************Selected Collaborator*************
                chkCollaboratorList.FillCheckList(DropDownName.FillCollaborators, HdnProjectId.Value);
                lstSelCollab = _Contract_Details.lstSelCollab.ToList();
                if (chkCollaboratorList.Items.Count > 0)
                {
                    for (int i = 0; i < lstSelCollab.ListToDatatable().Rows.Count; i++)
                    {
                        chkCollaboratorList.Items.Add(new ListItem()
                        {
                            Value = Convert.ToString(lstSelCollab.ListToDatatable().Rows[i]["i_Collobrator_ID"]), Text = Convert.ToString(lstSelCollab.ListToDatatable().Rows[i]["s_Name"]), Selected = true
                        });
                    }
                }
                else
                {
                    chkCollaboratorList.DataSource     = lstSelCollab;
                    chkCollaboratorList.DataTextField  = "s_Name";
                    chkCollaboratorList.DataValueField = "i_Collobrator_ID";
                    chkCollaboratorList.DataBind();
                    foreach (ListItem item in chkCollaboratorList.Items)
                    {
                        item.Selected = true;
                    }
                }

                //var id = (from i in lstSelCollab select new { i.i_Collobrator_ID }).ToList().ListToDatatable();

                //for (int i = 0; i < id.Rows.Count; i++)
                //{
                //    for (int j = 0; j < chkCollaboratorList.Items.Count; j++)
                //    {
                //        if (chkCollaboratorList.Items[j].Value == Convert.ToString(id.Rows[i]["i_Collobrator_ID"]))
                //        {
                //            chkCollaboratorList.Items[j].Selected = true;
                //        }
                //    }
                //}
                //**************END*******************************

                //***********************Selected Clauese***************
                lstSelClause = _Contract_Details.lstSelClause.ToList();
                RptClauseDetail.DataSource = lstSelClause; RptClauseDetail.DataBind();

                //**************************END************************



                TxtContractName.Text = _Contract_Details.s_Contract_Name;
                TxtContractId.Text   = _Contract_Details.s_Contract_Display_Id;
                FillCombo();
                ddlContractCategory.SelectedIndex = ddlContractCategory.Items.IndexOf(ddlContractCategory.Items.FindByValue(_Contract_Details.i_Contract_Category_ID.ToString()));
                ddlContractStatus.SelectedIndex   = ddlContractStatus.Items.IndexOf(ddlContractStatus.Items.FindByValue(_Contract_Details.i_Contract_Status_ID.ToString()));
                if (ddlContractStatus.SelectedItem.Text.ToLower() == "terminated/withdrawn" || ddlContractStatus.SelectedItem.Text.ToLower() == "completed")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "showMsg", "javascript:DisableOnCompletedStatus();", true);
                }
                lstcsd = _Contract_Details.listcsd.ToList();
                DataRow[] dr = lstcsd.ListToDatatable().Select("i_Contract_Status_ID=" + ddlContractStatus.SelectedValue);
                TxtContStartDate.Text = (dr.Length > 0) ? Convert.ToString(dr[0].ItemArray[1]) : "";
                FillClausesCheckList();
                var    q        = (from i in lstSelClause select new { i.Clause_Name, i.i_Contract_Clause_ID }).ToList().ListToDatatable();
                string arrvalue = string.Join(",", q.AsEnumerable().Select(i => i.Field <int>("i_Contract_Clause_ID")).ToArray());
                for (int j = 0; j < q.Rows.Count; j++)
                {
                    for (int i = 0; i < chkClause.Items.Count; i++)
                    {
                        if (chkClause.Items[i].Value == Convert.ToString(q.Rows[j]["i_Contract_Clause_ID"]))
                        {
                            chkClause.Items[i].Selected = true;
                        }
                    }
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "showMsg", "javascript:PushValues('" + arrvalue + "')", true);
                TxtGovCountry.Text  = _Contract_Details.s_Country;
                HdnGovCountry.Value = Convert.ToString(_Contract_Details.i_Govt_Lawcountry);

                //***************Corrrespondance File*******************
                hdnCoresPath.Value        = _Contract_Details.s_Clauses_File;
                lnkDwnldCorespondace.Text = _Contract_Details.s_Clauses_File.GetFileName();
                //*************END*********************
                TxtLastDate.Text = _Contract_Details.dt_LastUpdated_Date;
                if (ddlContractStatus.SelectedItem.Text.ToLower() == "completed")
                {
                    //************Multiple Contract File************
                    lstmultiple = _Contract_Details.lstmultiple.ToList();
                    var h = (from k in lstmultiple select new { k.s_ContractFile }).ToList().ListToDatatable();

                    if (h != null)
                    {
                        for (int i = 0; i < h.Rows.Count; i++)
                        {
                            HiddenField        hdn = new HiddenField();
                            LinkButton         lnk = new LinkButton();
                            HtmlGenericControl div = new HtmlGenericControl("div"); HtmlGenericControl a = new HtmlGenericControl("a");
                            lnk.ID      = "lnk" + i.ToString();
                            hdn.Value   = Convert.ToString(h.Rows[i][0]);
                            hdn.ID      = "hdn" + i.ToString();
                            a.ID        = "a~" + i.ToString();
                            lnk.Text    = h.Rows[i][0].ToString().GetFileName();
                            a.InnerText = "X";

                            lnk.OnClientClick = "return Callhandler('" + ResolveUrl("~/DownloadHandler.ashx") + "','" + hdn.Value + "')";

                            div.Attributes.Add("class", "MultiFile-label");
                            a.Attributes.Add("class", "MultiFile-remove");
                            a.Style["margin-right"] = "5px";
                            a.Attributes.Add("onclick", "return RemoveDownloadFile(this)");
                            lnk.Attributes.Add("class", "MultiFile-title");
                            div.Controls.Add(a);
                            div.Controls.Add(lnk);
                            div.Controls.Add(hdn);
                            multilistdiv.Controls.Add(div);
                        }
                    }



                    TxtContractExpDate.Text      = _Contract_Details.dt_Expiry_Date;
                    HdnContExpDate.Value         = _Contract_Details.dt_Expiry_Date;
                    TxtEffectiveDate.Text        = _Contract_Details.dt_Effective_Date;
                    TxtDateofLast.Text           = _Contract_Details.dt_LastSigned_Date;
                    TxtContractFinalizeDate.Text = _Contract_Details.dt_Finalization_Date;



                    ddlAmendments.SelectedIndex = (_Contract_Details.b_Amendments == true) ? 1 : 0;
                    if (ddlAmendments.SelectedIndex == 1)
                    {
                        TxtNContractExpiryDate.Text = _Contract_Details.dt_NewExpiry_Date;
                        //**************Amendments File******************
                        HdnAmendPath.Value     = _Contract_Details.s_AmendmenstContract_File;
                        lnkDwnldAmendment.Text = _Contract_Details.s_AmendmenstContract_File.GetFileName();
                        //***************END*****************************
                    }
                }
                //*****************END************************
                TxtprocedureCost.Text     = (_Contract_Details.i_Hospital_Cost == 0) ? "" : Convert.ToString(_Contract_Details.i_Hospital_Cost);
                TxtInvestigatorFees.Text  = (_Contract_Details.i_Investigator_fees == 0) ? "" : Convert.ToString(_Contract_Details.i_Investigator_fees);
                TxtCoOrdinatorFess.Text   = (_Contract_Details.i_Coordinator_fess == 0) ? "" : Convert.ToString(_Contract_Details.i_Coordinator_fess);
                TxtProjectBudgetCash.Text = Convert.ToString(Convert.ToInt32(Common.iffBlank(_Contract_Details.i_Hospital_Cost, 0)) +
                                                             Convert.ToInt32(Common.iffBlank(_Contract_Details.i_Investigator_fees, 0)) +
                                                             Convert.ToInt32(Common.iffBlank(_Contract_Details.i_Coordinator_fess, 0)));
                if (TxtProjectBudgetCash.Text == "0")
                {
                    TxtProjectBudgetCash.Text = "";
                }

                btnContractSave.Visible = true;

                if (mode.ToLower() == "view")
                {
                    PNewCollaborator.Style["display"] = "none";
                    //  btnCReset.Style["display"] = "block";
                    btnContractCancel.Style["display"] = "none";
                    btnContractSave.Style["display"]   = "none";
                    h3.Style["display"]          = "none";
                    LinkButton2.Style["display"] = "block";
                }
                if (mode.ToLower() == "delete")
                {
                    btnCReset.Style["display"]         = "none";
                    btnContractSave.Style["display"]   = "block";
                    btnContractCancel.Style["display"] = "block";
                    btnContractSave.Text = mode;
                }
                else
                {
                    btnContractSave.Text = mode;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }