protected void FillControl()
        {
            TTSHWCFServiceClient  cl                   = new TTSHWCFServiceClient();
            List <Project_Master> Pjctlist             = new List <Project_Master>();
            List <Contract_Collobrator_Master> ccmlist = new List <Contract_Collobrator_Master>();
            List <PI_Master> pi_mlist                  = new List <PI_Master>();
            Contract_Master  cmlist = new Contract_Master();

            try
            {
                cmlist                      = cl.GetContract_MasterDetailsByID(Convert.ToInt32(HdnId.Value));
                Pjctlist                    = cmlist.pjctmList.ToList();
                TxtProjTitle.Text           = Pjctlist.ListToDatatable().Rows[0]["s_Project_Title"].ToString();
                TxtAlias1.Text              = Pjctlist.ListToDatatable().Rows[0]["s_Project_Alias1"].ToString();
                TxtAlias2.Text              = Pjctlist.ListToDatatable().Rows[0]["s_Project_Alias2"].ToString();
                TxtShortTitle.Text          = Pjctlist.ListToDatatable().Rows[0]["s_Short_Title"].ToString();
                TxtIrbNo.Text               = Pjctlist.ListToDatatable().Rows[0]["s_IRB_No"].ToString();
                TxtprojCategory.Text        = Pjctlist.ListToDatatable().Rows[0]["Project_Category_Name"].ToString();
                HdnProject_Id.Value         = Pjctlist.ListToDatatable().Rows[0]["i_ID"].ToString();
                DispProjectId.InnerText     = Pjctlist.ListToDatatable().Rows[0]["s_Display_Project_ID"].ToString();
                pi_mlist                    = cmlist.pmlist.ToList();
                rptrPIDetails.DataSource    = pi_mlist; rptrPIDetails.DataBind();
                TxtContAssignDate.Text      = cmlist.dt_Contract_AssignDate;
                TxtContractReqDate.Text     = cmlist.dt_Contract_ReqDate;
                ccmlist                     = cmlist.ccdlist.ToList();
                RptrCollaborator.DataSource = ccmlist; RptrCollaborator.DataBind();
                FillReviewdBy();
                DdlReviewedBy.SelectedIndex = DdlReviewedBy.Items.IndexOf(DdlReviewedBy.Items.FindByValue(Convert.ToString(cmlist.i_ReviewedBy_ID)));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool SaveContractDetail()
        {
            TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
            Contract_Master cm = new Contract_Master();
            List<Contract_Collaborator_Details> lst = new List<Contract_Collaborator_Details>();
            DataTable dt = (DataTable)ViewState["dt"]; string result = string.Empty;
            try
            {
                string[] collaboratorValues = HdnContract_Collaborator_Details.Value.Replace("^", "").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.ToString()).ToArray();
                for (int i = 0; i < collaboratorValues.Length; i++)
                {
                    lst.Add(new Contract_Collaborator_Details
                    {
                        i_Contract_Master_ID = Convert.ToInt32("1"),
                        i_Contract_Collaborator_ID = Convert.ToInt32(collaboratorValues[i].Split(',')[0]),
                        s_InitialContract_ID = Convert.ToString(collaboratorValues[i].Split(',')[1]),
                        dt_Contract_Request_Date = (collaboratorValues[i].Split(',')[2])
                    });
                }
                cm.i_ID = Convert.ToInt32(HdnId.Value);
                cm.i_Project_ID = Convert.ToInt32(HdnProject_Id.Value);//project Id
                cm.dt_Contract_AssignDate = TxtContAssignDate.Text;
                cm.i_ReviewedBy_ID = Convert.ToString(DdlReviewedBy.SelectedValue);
                cm.S_ReviewedByName = DdlReviewedBy.SelectedItem.Text;

                cm.s_Short_Title = TxtShortTitle.Text;
                cm.s_Project_Alias1 = TxtAlias1.Text;
                cm.s_Project_Alias2 = TxtAlias2.Text;
                cm.s_IRB_No = TxtIrbNo.Text;

                //--------UID and UName----
                cm.UName = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserName"]), "").ToString();
                cm.UID = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserID"]), "").ToString();
                //----------- END ------------

                result = cl.Contract_Master_DML(cm, lst.ToArray(), HdnMode.Value.ToLower());
                if (result.Split('|')[0].ToLower().Trim() == "success" && result.Split('|')[1].ToLower().Trim().CheckInt() == true)
                {

                    switch (HdnMode.Value.ToLower())
                    {
                        //case "update": this.PopUpMsg("Contract Application Details Updated  Successfully", "PerformCancel();"); break;
                        //case "delete": this.PopUpMsg("Contract Application Details Deleted  Successfully", "PerformCancel();"); break;
                        //case "insert": this.PopUpMsg("Contract Application Details Saved    Successfully", "PerformCancel();"); break;

                        case "update": this.MsgBox("Contract Application Details Updated  Successfully"); break;
                        case "delete": this.MsgBox("Contract Application Details Deleted  Successfully"); break;
                        case "insert": this.MsgBox("Contract Application Details Saved    Successfully"); break;
                    }

                }
                else
                {
                    this.MsgBox(result.Split('|')[1]);
                    return false;
                }
            }
            catch (Exception ex)
            {
                this.MsgBox(ex.Message);
                return false;
            }
            return true;
        }
        protected void FillControl()
        {
            TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
            List<Project_Master> Pjctlist = new List<Project_Master>();
            List<Contract_Collobrator_Master> ccmlist = new List<Contract_Collobrator_Master>();
            List<PI_Master> pi_mlist = new List<PI_Master>();
            Contract_Master cmlist = new Contract_Master();
            try
            {
                cmlist = cl.GetContract_MasterDetailsByID(Convert.ToInt32(HdnId.Value));
                Pjctlist = cmlist.pjctmList.ToList();
                TxtProjTitle.Text = Pjctlist.ListToDatatable().Rows[0]["s_Project_Title"].ToString();
                TxtAlias1.Text = Pjctlist.ListToDatatable().Rows[0]["s_Project_Alias1"].ToString();
                TxtAlias2.Text = Pjctlist.ListToDatatable().Rows[0]["s_Project_Alias2"].ToString();
                TxtShortTitle.Text = Pjctlist.ListToDatatable().Rows[0]["s_Short_Title"].ToString();
                TxtIrbNo.Text = Pjctlist.ListToDatatable().Rows[0]["s_IRB_No"].ToString();
                TxtprojCategory.Text = Pjctlist.ListToDatatable().Rows[0]["Project_Category_Name"].ToString();
                HdnProject_Id.Value = Pjctlist.ListToDatatable().Rows[0]["i_ID"].ToString();
                DispProjectId.InnerText = Pjctlist.ListToDatatable().Rows[0]["s_Display_Project_ID"].ToString();
                pi_mlist = cmlist.pmlist.ToList();
                rptrPIDetails.DataSource = pi_mlist; rptrPIDetails.DataBind();
                TxtContAssignDate.Text = cmlist.dt_Contract_AssignDate;
                TxtContractReqDate.Text = cmlist.dt_Contract_ReqDate;
                ccmlist = cmlist.ccdlist.ToList();
                RptrCollaborator.DataSource = ccmlist; RptrCollaborator.DataBind();
                FillReviewdBy();
                DdlReviewedBy.SelectedIndex = DdlReviewedBy.Items.IndexOf(DdlReviewedBy.Items.FindByValue(Convert.ToString(cmlist.i_ReviewedBy_ID)));
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public bool SaveContractDetail()
        {
            TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
            Contract_Master      cm = new Contract_Master();
            List <Contract_Collaborator_Details> lst = new List <Contract_Collaborator_Details>();
            DataTable dt = (DataTable)ViewState["dt"]; string result = string.Empty;

            try
            {
                string[] collaboratorValues = HdnContract_Collaborator_Details.Value.Replace("^", "").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.ToString()).ToArray();
                for (int i = 0; i < collaboratorValues.Length; i++)
                {
                    lst.Add(new Contract_Collaborator_Details
                    {
                        i_Contract_Master_ID       = Convert.ToInt32("1"),
                        i_Contract_Collaborator_ID = Convert.ToInt32(collaboratorValues[i].Split(',')[0]),
                        s_InitialContract_ID       = Convert.ToString(collaboratorValues[i].Split(',')[1]),
                        dt_Contract_Request_Date   = (collaboratorValues[i].Split(',')[2])
                    });
                }
                cm.i_ID                   = Convert.ToInt32(HdnId.Value);
                cm.i_Project_ID           = Convert.ToInt32(HdnProject_Id.Value);//project Id
                cm.dt_Contract_AssignDate = TxtContAssignDate.Text;
                cm.i_ReviewedBy_ID        = Convert.ToString(DdlReviewedBy.SelectedValue);
                cm.S_ReviewedByName       = DdlReviewedBy.SelectedItem.Text;

                cm.s_Short_Title    = TxtShortTitle.Text;
                cm.s_Project_Alias1 = TxtAlias1.Text;
                cm.s_Project_Alias2 = TxtAlias2.Text;
                cm.s_IRB_No         = TxtIrbNo.Text;

                //--------UID and UName----
                cm.UName = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserName"]), "").ToString();
                cm.UID   = Common.iffBlank(Convert.ToString(HttpContext.Current.Session["UserID"]), "").ToString();
                //----------- END ------------

                result = cl.Contract_Master_DML(cm, lst.ToArray(), HdnMode.Value.ToLower());
                if (result.Split('|')[0].ToLower().Trim() == "success" && result.Split('|')[1].ToLower().Trim().CheckInt() == true)
                {
                    switch (HdnMode.Value.ToLower())
                    {
                    //case "update": this.PopUpMsg("Contract Application Details Updated  Successfully", "PerformCancel();"); break;
                    //case "delete": this.PopUpMsg("Contract Application Details Deleted  Successfully", "PerformCancel();"); break;
                    //case "insert": this.PopUpMsg("Contract Application Details Saved    Successfully", "PerformCancel();"); break;

                    case "update": this.MsgBox("Contract Application Details Updated  Successfully"); break;

                    case "delete": this.MsgBox("Contract Application Details Deleted  Successfully"); break;

                    case "insert": this.MsgBox("Contract Application Details Saved    Successfully"); break;
                    }
                }
                else
                {
                    this.MsgBox(result.Split('|')[1]);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                this.MsgBox(ex.Message);
                return(false);
            }
            return(true);
        }