Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string result = string.Empty;
            List <Project_Dept_PI> pdlist = new List <Project_Dept_PI>();

            string mode = "";

            try
            {
                mode = HdnMode.Value.ToString().ToLower().Trim();
                Grant_Master grant_master = new Grant_Master();
                if (mode != "delete")
                {
                    string[] PiIds = HdnPi_ID.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.ToString()).ToArray();
                    for (int i = 0; i < PiIds.Length; i++)
                    {
                        pdlist.Add(new Project_Dept_PI {
                            i_PI_ID = Convert.ToInt32(PiIds[i])
                        });
                    }
                    grant_master = Newtonsoft.Json.JsonConvert.DeserializeObject <Grant_Master>(HidenGrantMaster.Value.ToString());
                }


                if (mode == "update" || mode == "delete")
                {
                    grant_master.i_ID = Convert.ToInt32(HdnGrantId.Value.ToString());
                }
                grant_master.s_Created_By     = LoginUserId;
                grant_master.s_CreatedBy_Name = LoginUser;

                TTSHWCFServiceClient servcl = new TTSHWCFServiceClient();
                result = servcl.Grant_Application(grant_master, pdlist.ToArray(), HdnMode.Value);
                if (Convert.ToString(result.Split('|')[0]).ToLower().Trim() == "success".ToLower() && result.Split('|')[1].CheckInt() == true)
                {
                    if (mode == "update")
                    {
                        this.MsgBox("Grant Applications Details Updated  Successfully..!!");
                    }
                    if (mode == "insert")
                    {
                        this.MsgBox("Grant Applications Details Added  Successfully..!!");
                    }
                    if (mode == "delete")
                    {
                        this.MsgBox("Grant Applications Details Deleted  Successfully..!!");
                    }
                    ShowPanel();
                    FillGridMain();
                }
                else
                {
                    this.MsgBox(result.Split('|')[1]);
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        private void FillControl()
        {
            TTSHWCFServiceClient  cl                 = new TTSHWCFServiceClient();
            Grant_Master          grant_Master       = new Grant_Master();
            List <PI_Master>      piLst              = new List <PI_Master>();
            List <Project_Master> pjmasterlist       = new List <Project_Master>();
            GrantMasterDetails    grantmasterdetails = new GrantMasterDetails();

            try
            {
                grantmasterdetails           = cl.GetGrantApplicationDetails(Convert.ToInt32(HdnGrantId.Value));
                grant_Master                 = grantmasterdetails.grant_Master;
                txtparentprojectamount.Text  = "0";
                txtRemainingAmount.Text      = "0";
                HdnParentProjectDurId.Value  = "0";
                HdnParentProjectAmount.Value = "0";
                HdnMaxChildDurationId.Value  = "0";
                HdnMaxChildduration.Value    = "";
                if (grant_Master != null)
                {
                    HdnProjectId.Value         = grant_Master.i_Project_ID.ToString();
                    TxtApplicationId.Text      = grant_Master.s_Application_ID.ToString();
                    ddlGrantType.SelectedValue = grant_Master.i_GrantType_ID.ToString();
                    ddlGrantType_SelectedIndexChanged(null, EventArgs.Empty);
                    ddlGrantSubType1.SelectedValue = grant_Master.i_Grant_SubType_ID.ToString();
                    ddlGrantSubType1_SelectedIndexChanged(null, EventArgs.Empty);
                    ddlGrantSubType2.SelectedValue = grant_Master.i_Grant_Sub_SubType_ID.ToString();
                    ddlGrantSubType2_SelectedIndexChanged(null, EventArgs.Empty);
                    ddlGrantSubType3.SelectedValue = grant_Master.i_Grant_Sub_Sub_SubType_ID.ToString();
                    TxtAmountRequested.Text        = grant_Master.i_Amount_Requested.ToString();
                    TxtClolsingDate.Text           = grant_Master.dt_Closing_Date.HasValue? grant_Master.dt_Closing_Date.Value.ToString("dd-MMM-yyyy"):"";
                    TxtMentor.Text = grant_Master.s_Mentor.ToString();
                    ddlGrantAwardOrgan.SelectedValue = grant_Master.i_AwardOrganization.ToString();
                    ddlOutCome.SelectedValue         = grant_Master.i_Outcome.ToString();
                    if (grant_Master.dt_AwardDate.HasValue)
                    {
                        TxtAwardLetter.Text  = grant_Master.dt_AwardDate.Value.ToString("dd-MMM-yyyy");
                        hidAwardLetter.Value = TxtAwardLetter.Text;
                    }
                    if (grant_Master.dt_ApplicationDate.HasValue)
                    {
                        TxtGrantAppDate.Text = grant_Master.dt_ApplicationDate.Value.ToString("dd-MMM-yyyy");
                    }
                    TxtOldApplicationId.Text          = grant_Master.s_Old_Application_ID.ToString();
                    ddlSubmissionStatus.SelectedValue = grant_Master.i_SubmissionStatus.ToString();
                    if (grant_Master.s_Duration.CheckInt())
                    {
                        ddlDuration.SelectedValue = grant_Master.s_Duration.ToString();
                    }
                    txtFTe.Text = grant_Master.i_FTE.ToString();
                    txtReviewersComments.Text = grant_Master.s_Reviewers_Comments.ToString();
                    piLst = grantmasterdetails.Pilisst.ToList();
                    pjmasterlist.Add(grantmasterdetails.project);
                    txtGrantrName.Text = grant_Master.s_Grant_Name.ToString();
                    if (grant_Master.i_AwardCountryID > 0)
                    {
                        txtCountryName.Text = grant_Master.CountryName.ToString();
                        HdnCountryId.Value  = grant_Master.i_AwardCountryID.ToString();
                    }
                    if (Convert.ToDecimal(grant_Master.Total_ChildAmount.ToString()) > 0)
                    {
                        HdnParentProjectAmount.Value = grant_Master.Total_ChildAmount.ToString();
                    }

                    TxtProjTitle.Text  = pjmasterlist.ListToDatatable().Rows[0]["s_Project_Title"].ToString();
                    TxtAlias1.Text     = pjmasterlist.ListToDatatable().Rows[0]["s_Project_Alias1"].ToString();
                    TxtAlias2.Text     = pjmasterlist.ListToDatatable().Rows[0]["s_Project_Alias2"].ToString();
                    TxtShortTitle.Text = pjmasterlist.ListToDatatable().Rows[0]["s_Short_Title"].ToString();
                    TxtIrbNo.Text      = pjmasterlist.ListToDatatable().Rows[0]["s_IRB_No"].ToString();
                    //ddlProjCategory.SelectedItem.Text = pjmasterlist.ListToDatatable().Rows[0]["Project_Category_Name"].ToString();
                    txtProjCategory.Text     = pjmasterlist[0].Project_Category_Name.ToString();
                    DispProjectId.InnerText  = pjmasterlist.ListToDatatable().Rows[0]["s_Display_Project_ID"].ToString();
                    rptrPIDetails.DataSource = piLst;
                    rptrPIDetails.DataBind();
                    HdnUpdateMode.Value = "1";
                    if (pjmasterlist[0].b_Ischild == true && pjmasterlist[0].i_Parent_ProjectID > 0)
                    {
                        if (grantmasterdetails.parentProject.GrantApplied)
                        {
                            TxtParentProjectId.Text       = grantmasterdetails.parentProject.s_Display_Project_ID.ToString();
                            TxtParentProjectName.Text     = grantmasterdetails.parentProject.s_Project_Title.ToString();
                            txtparentprojectamount.Text   = grantmasterdetails.parentProject.Total_Amount.ToString();
                            txtRemainingAmount.Text       = grantmasterdetails.parentProject.Remaining_Amount.ToString();
                            txtparentprojectduration.Text = grantmasterdetails.parentProject.s_Duration.ToString();
                            HdnParentProjectDurId.Value   = grantmasterdetails.parentProject.i_DurationID.ToString();
                            txtRemainingAmount.Text       = Convert.ToString(Convert.ToDouble(grantmasterdetails.parentProject.Remaining_Amount) + Convert.ToDouble(grant_Master.i_Amount_Requested));
                        }
                        else
                        {
                            CallJS("MessageBox('Parent project Not Applied For The Grant.');");
                            ShowPanel();
                            FillGridMain();
                        }
                    }
                    HdnMaxChildDurationId.Value = grant_Master.i_Child_DurationID.ToString();
                    HdnMaxChildduration.Value   = grant_Master.s_Child_Duration.ToString();
                    SHowParentInformation(pjmasterlist[0].b_Ischild);
                    //this.CallJs("$('.s_Old_Application_ID').attr('disabled', !($('.i_SubmissionStatus').find('option:selected').text().toLowerCase() == 'Re-Submission'.toLowerCase()));$('#' + getclientId('txtReviewersComments')).attr('disabled', !($('.i_Outcome').find('option:selected').text().toLowerCase() == 'Not-Successful'.trim().toLowerCase()));SetAwardDate();SetAwardDatePicker();");
                    this.CallJs("$('.s_Old_Application_ID').attr('disabled', !($('.i_SubmissionStatus').find('option:selected').text().toLowerCase() == 'Re-Submission'.toLowerCase()));SetAwardDate();SetAwardDatePicker();");
                    if (grantmasterdetails.grant_Master != null)
                    {
                        HdnParentProjectAmount.Value = grantmasterdetails.grant_Master.Total_ChildAmount.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                this.MsgBox(ex.Message.ToString());
            }
        }
        private void FillControl()
        {
            TTSHWCFServiceClient cl = new TTSHWCFServiceClient();
            Grant_Master grant_Master = new Grant_Master();
            List<PI_Master> piLst = new List<PI_Master>();
            List<Project_Master> pjmasterlist = new List<Project_Master>();
            GrantMasterDetails grantmasterdetails = new GrantMasterDetails();
            try
            {
                grantmasterdetails = cl.GetGrantApplicationDetails(Convert.ToInt32(HdnGrantId.Value));
                grant_Master = grantmasterdetails.grant_Master;
                txtparentprojectamount.Text = "0";
                txtRemainingAmount.Text = "0";
                HdnParentProjectDurId.Value = "0";
                HdnParentProjectAmount.Value = "0";
                HdnMaxChildDurationId.Value = "0";
                HdnMaxChildduration.Value = "";
                if (grant_Master != null)
                {
                    HdnProjectId.Value = grant_Master.i_Project_ID.ToString();
                    TxtApplicationId.Text = grant_Master.s_Application_ID.ToString();
                    ddlGrantType.SelectedValue = grant_Master.i_GrantType_ID.ToString();
                    ddlGrantType_SelectedIndexChanged(null, EventArgs.Empty);
                    ddlGrantSubType1.SelectedValue = grant_Master.i_Grant_SubType_ID.ToString();
                    ddlGrantSubType1_SelectedIndexChanged(null, EventArgs.Empty);
                    ddlGrantSubType2.SelectedValue = grant_Master.i_Grant_Sub_SubType_ID.ToString();
                    ddlGrantSubType2_SelectedIndexChanged(null, EventArgs.Empty);
                    ddlGrantSubType3.SelectedValue = grant_Master.i_Grant_Sub_Sub_SubType_ID.ToString();
                    TxtAmountRequested.Text = grant_Master.i_Amount_Requested.ToString();
                    TxtClolsingDate.Text =grant_Master.dt_Closing_Date.HasValue? grant_Master.dt_Closing_Date.Value.ToString("dd-MMM-yyyy"):"";
                    TxtMentor.Text = grant_Master.s_Mentor.ToString();
                    ddlGrantAwardOrgan.SelectedValue = grant_Master.i_AwardOrganization.ToString();
                    ddlOutCome.SelectedValue = grant_Master.i_Outcome.ToString();
                    if (grant_Master.dt_AwardDate.HasValue)
                    {
                        TxtAwardLetter.Text = grant_Master.dt_AwardDate.Value.ToString("dd-MMM-yyyy");
                        hidAwardLetter.Value = TxtAwardLetter.Text;
                    }
                    if (grant_Master.dt_ApplicationDate.HasValue)
                    {
                        TxtGrantAppDate.Text = grant_Master.dt_ApplicationDate.Value.ToString("dd-MMM-yyyy");
                    }
                    TxtOldApplicationId.Text = grant_Master.s_Old_Application_ID.ToString();
                    ddlSubmissionStatus.SelectedValue = grant_Master.i_SubmissionStatus.ToString();
                    if (grant_Master.s_Duration.CheckInt())
                        ddlDuration.SelectedValue = grant_Master.s_Duration.ToString();
                    txtFTe.Text = grant_Master.i_FTE.ToString();
                    txtReviewersComments.Text = grant_Master.s_Reviewers_Comments.ToString();
                    piLst = grantmasterdetails.Pilisst.ToList();
                    pjmasterlist.Add(grantmasterdetails.project);
                    txtGrantrName.Text = grant_Master.s_Grant_Name.ToString();
                    if (grant_Master.i_AwardCountryID>0){
                        txtCountryName.Text = grant_Master.CountryName.ToString();
                        HdnCountryId.Value =  grant_Master.i_AwardCountryID.ToString();
                    }
                    if (Convert.ToDecimal(grant_Master.Total_ChildAmount.ToString()) > 0)
                        HdnParentProjectAmount.Value = grant_Master.Total_ChildAmount.ToString();

                    TxtProjTitle.Text = pjmasterlist.ListToDatatable().Rows[0]["s_Project_Title"].ToString();
                    TxtAlias1.Text = pjmasterlist.ListToDatatable().Rows[0]["s_Project_Alias1"].ToString();
                    TxtAlias2.Text = pjmasterlist.ListToDatatable().Rows[0]["s_Project_Alias2"].ToString();
                    TxtShortTitle.Text = pjmasterlist.ListToDatatable().Rows[0]["s_Short_Title"].ToString();
                    TxtIrbNo.Text = pjmasterlist.ListToDatatable().Rows[0]["s_IRB_No"].ToString();
                    //ddlProjCategory.SelectedItem.Text = pjmasterlist.ListToDatatable().Rows[0]["Project_Category_Name"].ToString();
                    txtProjCategory.Text = pjmasterlist[0].Project_Category_Name.ToString();
                    DispProjectId.InnerText = pjmasterlist.ListToDatatable().Rows[0]["s_Display_Project_ID"].ToString();
                    rptrPIDetails.DataSource = piLst;
                    rptrPIDetails.DataBind();
                    HdnUpdateMode.Value = "1";
                    if (pjmasterlist[0].b_Ischild == true && pjmasterlist[0].i_Parent_ProjectID > 0)
                    {
                        if (grantmasterdetails.parentProject.GrantApplied)
                        {
                            TxtParentProjectId.Text = grantmasterdetails.parentProject.s_Display_Project_ID.ToString();
                            TxtParentProjectName.Text = grantmasterdetails.parentProject.s_Project_Title.ToString();
                            txtparentprojectamount.Text = grantmasterdetails.parentProject.Total_Amount.ToString();
                            txtRemainingAmount.Text = grantmasterdetails.parentProject.Remaining_Amount.ToString();
                            txtparentprojectduration.Text = grantmasterdetails.parentProject.s_Duration.ToString();
                            HdnParentProjectDurId.Value = grantmasterdetails.parentProject.i_DurationID.ToString();
                            txtRemainingAmount.Text = Convert.ToString(Convert.ToDouble(grantmasterdetails.parentProject.Remaining_Amount) + Convert.ToDouble(grant_Master.i_Amount_Requested));

                        }
                        else
                        {
                            CallJS("MessageBox('Parent project Not Applied For The Grant.');");
                            ShowPanel();
                            FillGridMain();
                        }
                    }
                    HdnMaxChildDurationId.Value = grant_Master.i_Child_DurationID.ToString();
                    HdnMaxChildduration.Value = grant_Master.s_Child_Duration.ToString();
                    SHowParentInformation(pjmasterlist[0].b_Ischild);
                    //this.CallJs("$('.s_Old_Application_ID').attr('disabled', !($('.i_SubmissionStatus').find('option:selected').text().toLowerCase() == 'Re-Submission'.toLowerCase()));$('#' + getclientId('txtReviewersComments')).attr('disabled', !($('.i_Outcome').find('option:selected').text().toLowerCase() == 'Not-Successful'.trim().toLowerCase()));SetAwardDate();SetAwardDatePicker();");
                    this.CallJs("$('.s_Old_Application_ID').attr('disabled', !($('.i_SubmissionStatus').find('option:selected').text().toLowerCase() == 'Re-Submission'.toLowerCase()));SetAwardDate();SetAwardDatePicker();");
                    if (grantmasterdetails.grant_Master != null)
                        HdnParentProjectAmount.Value = grantmasterdetails.grant_Master.Total_ChildAmount.ToString();
                }

            }
            catch (Exception ex)
            {
                this.MsgBox(ex.Message.ToString());
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string result = string.Empty;
            List<Project_Dept_PI> pdlist = new List<Project_Dept_PI>();

            string mode = "";

            try
            {
                mode = HdnMode.Value.ToString().ToLower().Trim();
                Grant_Master grant_master = new Grant_Master();
                if (mode != "delete")
                {
                    string[] PiIds = HdnPi_ID.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.ToString()).ToArray();
                    for (int i = 0; i < PiIds.Length; i++)
                    {
                        pdlist.Add(new Project_Dept_PI { i_PI_ID = Convert.ToInt32(PiIds[i]) });
                    }
                    grant_master = Newtonsoft.Json.JsonConvert.DeserializeObject<Grant_Master>(HidenGrantMaster.Value.ToString());
                }

                if (mode == "update" || mode == "delete")
                {
                    grant_master.i_ID = Convert.ToInt32(HdnGrantId.Value.ToString());
                }
                grant_master.s_Created_By = LoginUserId;
                grant_master.s_CreatedBy_Name = LoginUser;

                TTSHWCFServiceClient servcl = new TTSHWCFServiceClient();
                result = servcl.Grant_Application(grant_master, pdlist.ToArray(), HdnMode.Value);
                if (Convert.ToString(result.Split('|')[0]).ToLower().Trim() == "success".ToLower() && result.Split('|')[1].CheckInt() == true)
                {
                    if (mode == "update")
                        this.MsgBox("Grant Applications Details Updated  Successfully..!!");
                    if (mode == "insert")
                        this.MsgBox("Grant Applications Details Added  Successfully..!!");
                    if (mode == "delete")
                        this.MsgBox("Grant Applications Details Deleted  Successfully..!!");
                    ShowPanel();
                    FillGridMain();
                }
                else
                {
                    this.MsgBox(result.Split('|')[1]);
                }
            }
            catch (Exception ex)
            {
            }
        }