public ActionResult Delete(List <string> tokens) { if (tokens != null) { foreach (var token in tokens) { var dGrantData = new GrantData { Token = token }; _ticketManage.RemoveTicketValue(ref dGrantData); } } return(Json("success")); }
protected void AgencyTextChanged(object sender, EventArgs e) { GrantData j = new GrantData(); Business obj = new Business(); j.FundingAgencyId = null; j = obj.selectExisitingAgency(txtFAId.Text.Trim()); if (j.FundingAgencyId != null) { txtFAId.Text = j.FundingAgencyId; txtFAname.Text = j.FundingAgencyName; DropDownAgentType.SelectedValue = j.AgentType; txtContactNo.Text = j.AgencyContact; txtPanNo.Text = j.Pan_No; txtEmailId.Text = j.EmailId; txtAddress.Text = j.Address; txtState.Text = j.State; txtCountry.Text = j.Country; popupselectNo.Visible = false; btninsert.Enabled = false; btnupdate.Enabled = true; ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert(' Agency exixts!')</script>"); txtFAId.Enabled = false; txtFAname.Enabled = false; DropDownAgentType.Enabled = false; } else { //txtFAId.Text = ""; txtFAname.Text = ""; DropDownAgentType.ClearSelection(); txtContactNo.Text = ""; txtPanNo.Text = ""; txtEmailId.Text = ""; txtAddress.Text = ""; txtState.Text = ""; txtCountry.Text = ""; btnupdate.Enabled = false; btninsert.Enabled = true; } }
public override void Receive(AuthenticationTokenReceiveContext context) { GrantData grantData = new GrantData() { Token = context.Token }; if (RemoveWhenReceive) { TicketManage.RemoveTicketValue(ref grantData); context.DeserializeTicket(grantData.Ticket); } else { TicketManage.GetTicketValue(ref grantData); context.DeserializeTicket(grantData.Ticket); } context.OwinContext.Set("as:user_id", grantData.UserID); context.OwinContext.Set("as:user_name", grantData.UserName); context.OwinContext.Set("as:client_id", grantData.ClientID); }
public override void Create(AuthenticationTokenCreateContext context) { var startDate = DateTime.UtcNow; var endDate = DateTime.UtcNow.AddMinutes(GetExpiryMinutes()); GrantData grantData = new GrantData { GrantType = context.OwinContext.Get <string>("as:grant_type"), ResponseType = context.OwinContext.Get <string>("as:response_type"), TokenType = TokenType, UserID = context.OwinContext.Get <string>("as:user_id"), UserName = context.OwinContext.Get <string>("as:user_name"), ClientID = context.OwinContext.Get <string>("as:client_id"), IssuedUtc = startDate, ExpiresUtc = endDate, RoleScope = GetIdentityRole(context.Ticket.Identity) }; string tokenValue; if (TokenKeepingPredicate(grantData)) { if (TicketManage.GetToken(grantData)) { context.SetToken(grantData.Token); return; } } if (OldTokenRemovetPredicate(grantData)) { TicketManage.RemoveOldTicket(grantData); } tokenValue = Convert.ToBase64String(Encoding.Default.GetBytes(Guid.NewGuid().ToString("n"))).TrimEnd('=').Replace('+', '-').Replace('/', '_'); context.Ticket.Properties.IssuedUtc = startDate; context.Ticket.Properties.ExpiresUtc = endDate; grantData.Ticket = context.SerializeTicket(); grantData.Token = tokenValue; TicketManage.SetTicketValue(grantData); context.SetToken(tokenValue); }
protected void btnSaveUpdate_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } //check if update oe edit. try { ArrayList list = new ArrayList(); JournalValueObj.JournalID = txtboxID.Text; //JournalValueObj.year = txtboxYear.Text; // JournalValueObj.Category = dropdownCategory.SelectedValue; int saveOrUpdate = B.IFcheckSaveOrUpdate(JournalValueObj); if (saveOrUpdate == 3) // SAVE { JournalValueObj.Category = dropdownCategory.SelectedValue; JournalValueObj.JournalID = txtboxID.Text.Trim(); popupPanelJournal.Visible = false; if (txtboxTitle.Text == "") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Title')</script>"); return; } if (txtboxAbrivatedTitle.Text == "") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Abbreviated Title')</script>"); return; } if (txtboxComments.Text == "") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter the Remarks')</script>"); return; } //if (dropdownCategory.SelectedValue == "") //{ // ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Category')</script>"); // return; //} //if (txtboxYear.Text != "") //{ // //ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Year')</script>"); // //return; // if (txtboxImpactfactor.Text == "") // { // ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Impact Factor')</script>"); // return; // } // if (txtboxFiveYearImpactFactor.Text == "") // { // ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Five Year Impact Factor')</script>"); // return; // } //} //if (txtboxImpactfactor.Text == "") //{ // ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Impact Factor')</script>"); // return; //} //if (txtboxFiveYearImpactFactor.Text == "") //{ // ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Enter the Five Year Impact Factor')</script>"); // return; //} //JournalValueObj.year = txtboxYear.Text.Trim(); JournalValueObj.Comments = txtboxComments.Text.ToString(); //int year1 = Convert.ToInt32(txtboxYear.Text) - 1; //JournalValueObj.year = year1.ToString(); //if (txtboxFiveYearImpactFactor.Text != "") //{ // JournalValueObj.fiveimpcrfact = Convert.ToDouble(txtboxFiveYearImpactFactor.Text.Trim()); //} //if (txtboxImpactfactor.Text != "") //{ // JournalValueObj.impctfact = Convert.ToDouble(txtboxImpactfactor.Text.Trim()); //} JournalValueObj.Title = txtboxTitle.Text.Trim(); JournalValueObj.AbbTitle = txtboxAbrivatedTitle.Text.Trim(); int applicableYear = Convert.ToInt32(JournalValueObj.year) + 1; string applicableYear1 = applicableYear.ToString(); //JournalValueObj.ApplicableYear =applicableYear+06+01; string Applicable1 = applicableYear1 + "-" + "06" + "-01"; JournalValueObj.ApplicableYear = Applicable1; //int applicableYear2 = Convert.ToInt32(JournalValueObj.year) -1 ; //string applicableYear3 = applicableYear2.ToString(); //JournalValueObj.Year1 = applicableYear3; //string Applicable2 = year1 + "-" + "06" + "-01"; //JournalValueObj.ApplicableYear1 = Applicable2; //DateTime Applicable=Convert. Applicable1 for (int i = 0; i < cblActiveyear.Items.Count; i++) { if (cblActiveyear.Items[i].Selected == true) { JournalValueObj.ActiveYear = Convert.ToInt32(cblActiveyear.Items[i].Text.ToString()); list.Add(JournalValueObj.ActiveYear); } } if (list.Count == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please select the Active year')</script>"); return; } DataTable dtCurrentTableProjectOutcome = (DataTable)ViewState["ImpactFactorDetails"]; JournalData[] JDP = null; GrantData journalbank = new GrantData(); //insert Fund Reciept JDP = new JournalData[dtCurrentTableProjectOutcome.Rows.Count]; int rowIndex2 = 0; if (dtCurrentTableProjectOutcome.Rows.Count > 0) { for (int i = 0; i < dtCurrentTableProjectOutcome.Rows.Count; i++) { JDP[i] = new JournalData(); TextBox impactYear = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[1].FindControl("txtYear"); TextBox OneImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[2].FindControl("txtImpactFactor"); TextBox FiveYearImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[3].FindControl("txtFiveYearImpactFactor"); if (dtCurrentTableProjectOutcome.Rows.Count > 0) { if (impactYear.Text == "") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter the Year!')</script>"); return; //string CloseWindow = "alert('Please enter the Year!')"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseWindow", CloseWindow, true); //return; } if (OneImpactFactor.Text == "") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter the Impact Factor!')</script>"); return; //string CloseWindow = "alert('Please enter the Impact Factor!')"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseWindow", CloseWindow, true); //return; } if (FiveYearImpactFactor.Text == "") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter Five Year Impact Factor!')</script>"); return; //string CloseWindow = "alert('Please enter Five Year Impact Factor!')"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseWindow", CloseWindow, true); //return; } JDP[i].year = impactYear.Text.Trim(); JDP[i].impctfact = Convert.ToDouble(OneImpactFactor.Text.Trim()); JDP[i].fiveimpcrfact = Convert.ToDouble(FiveYearImpactFactor.Text.Trim()); } rowIndex2++; } } int res = B.JournalEntrySaveImpactfactorChanges(JournalValueObj, list, JDP); if (res == 1) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Saved Successfully')</script>"); //log.Info("Saved Successfully , id: " + txtboxID.Text.Trim() + ", year: " + txtboxYear.Text.Trim()); } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Could Not Be Saved Successfully')</script>"); //log.Info("Could Not Be Saved Successfully , id: " + txtboxID.Text.Trim() + ", year: " + txtboxYear.Text.Trim()); } btnSaveUpdate.Enabled = false; } } catch (Exception ex) { log.Error("Inside Catch Block Of Manage Journal" + ex.Message); log.Error(ex.StackTrace); ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error!!!!!!!!!')</script>"); } }
protected void upload_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } log.Debug("Inside Ledger upload_Click page"); try { bindGridview(sender, e); if (ConfigurationManager.AppSettings["ProjectUploadLimit"].ToString() != "") { int uploadlimit = Convert.ToInt16(ConfigurationManager.AppSettings["ProjectUploadLimit"]); if (GridExcelDataProject.Rows.Count > uploadlimit) { Response.Write("<script language='javascript'>alert('Only " + uploadlimit + " records can be uploaded at a time')</script>"); return; } } string PID = null; string ProjectUnit = null; int result = 0; string uniqueid = null; string uniqueutnid = null; Business b = new Business(); // GridExcelDataProject.Visible = false; //int validExcel =1; // GridExcelDataInvestigator.Visible = false; //int validExcel = 1; int CheckRowsSkipped = 0; int rowindex = 0; int rowindex1 = 0; if (GridExcelDataProject.Visible == false && validExcel == 1) { GrantData[] jd = new GrantData[GridExcelDataProject.Rows.Count - 1]; for (int i = 1; i <= GridExcelDataProject.Rows.Count - 1; i++) { if (i == 1) { rowindex = 0; } else { rowindex++; } //foreach (GridViewRow gr in GridExcelDataProject.Rows) //{ GrantData v = new GrantData(); GrantData pd1 = new GrantData(); Business B = new Business(); GrantData obj = new GrantData(); ProjectUnit = GridExcelDataProject.Rows[i].Cells[1].Text.Trim(); if (ProjectUnit == "" || ProjectUnit == null || ProjectUnit == " ") { Response.Write("<script language='javascript'>alert('ProjectUnit value is empty in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } PID = GridExcelDataProject.Rows[i].Cells[2].Text.Trim(); if (PID == "" || PID == null || PID == " ") { Response.Write("<script language='javascript'>alert('ProjectID value is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string UTN = Convert.ToString(GridExcelDataProject.Rows[i].Cells[3].Text.Trim()); if (UTN != "") { obj = B.CheckUniqueUTN(UTN, PID, ProjectUnit); if (obj.UTN == UTN.Trim()) { if (uniqueutnid == null) { uniqueutnid = obj.UTN; } else { uniqueutnid = uniqueutnid + ',' + obj.UTN; } if (obj.GID != ProjectUnit + PID) { // ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Entered UTN already exists in the system for the Project " + ProjectUnit + " _ " + PID + " ')</script>"); //return; // CheckRowsSkipped++; //continue; Response.Write("<script language='javascript'>alert('Entered UTN already exists in the system : Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } } } string ProjectType = GridExcelDataProject.Rows[i].Cells[4].Text.Trim(); if (ProjectType == "" || ProjectType == null || ProjectType == " ") { Response.Write("<script language='javascript'>alert('ProjectType value is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string AppliedDate = (GridExcelDataProject.Rows[i].Cells[5].Text.Trim()); if (AppliedDate == "" || AppliedDate == null || AppliedDate == " ") { Response.Write("<script language='javascript'>alert('AppliedDate is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string AppliedAmount = (GridExcelDataProject.Rows[i].Cells[6].Text.Trim()); string Contact_No = (GridExcelDataProject.Rows[i].Cells[7].Text.Trim()); string SourceProject = (GridExcelDataProject.Rows[i].Cells[8].Text.Trim()); if (SourceProject == "" || SourceProject == null || SourceProject == " ") { Response.Write("<script language='javascript'>alert('SourceProject is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string DurationOfProject = (GridExcelDataProject.Rows[i].Cells[9].Text.Trim()); string ERFRealated = (GridExcelDataProject.Rows[i].Cells[10].Text.Trim()); string Title = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[11].Text.Trim()); if (Title == "" || Title == null || Title == " ") { Response.Write("<script language='javascript'>alert('Title value is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string Description = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[12].Text.Trim()); string Comments = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[13].Text.Trim()); string ProjectStatus = (GridExcelDataProject.Rows[i].Cells[14].Text.Trim()); string RevisedAppliedAmount = (GridExcelDataProject.Rows[i].Cells[15].Text.Trim()); string SanctionOrderDate = (GridExcelDataProject.Rows[i].Cells[16].Text.Trim()); if (SanctionOrderDate == "" || SanctionOrderDate == null || SanctionOrderDate == " ") { Response.Write("<script language='javascript'>alert('SanctionOrderDate is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string SanctionType = (GridExcelDataProject.Rows[i].Cells[17].Text.Trim()); if (SanctionType == "" || SanctionType == null || SanctionType == " ") { Response.Write("<script language='javascript'>alert('SanctionType is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string FundingAgency = (GridExcelDataProject.Rows[i].Cells[18].Text.Trim()); if (FundingAgency == "" || FundingAgency == null || FundingAgency == " ") { Response.Write("<script language='javascript'>alert('FundingAgency is empty: in Row No " + i.ToString() + " Please update the value and reupload it')</script>"); return; } string AgencyAddress = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[19].Text.Trim()); string AgencyContact = (GridExcelDataProject.Rows[i].Cells[20].Text.Trim()); string AgencyEmailId = (GridExcelDataProject.Rows[i].Cells[21].Text.Trim()); string AgencyPanNo = (GridExcelDataProject.Rows[i].Cells[22].Text.Trim()); string FundingSectorLevel = (GridExcelDataProject.Rows[i].Cells[23].Text.Trim()); string TypeofAgency = (GridExcelDataProject.Rows[i].Cells[24].Text.Trim()); string State = (GridExcelDataProject.Rows[i].Cells[25].Text.Trim()); string Country = (GridExcelDataProject.Rows[i].Cells[26].Text.Trim()); string UID = ProjectUnit + PID; if (PID != "") { obj = b.CheckUniquePID(PID, ProjectUnit); if (obj.PID == UID) { if (uniqueid == null) { uniqueid = obj.PID; } else { uniqueid = uniqueid + ',' + obj.PID; } //ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Entered Project " + uniqueid + " already exists in the system.Please correct the ID')</script>"); //return; CheckRowsSkipped++; continue; } } //string PIInstitutionID = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[11].Text.Trim()); //string PIDeptID = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[12].Text.Trim()); //string InstitutionID = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[16].Text.Trim()); //string DeptID = HttpUtility.HtmlDecode(GridExcelDataProject.Rows[i].Cells[17].Text.Trim()); //string ProjectCommencementDate = (GridExcelDataProject.Rows[i].Cells[26].Text.Trim()); //string ProjectCloseDate = (GridExcelDataProject.Rows[i].Cells[27].Text.Trim()); //string ExtendedDate = (GridExcelDataProject.Rows[i].Cells[28].Text.Trim()); //string AuditRequired = (GridExcelDataProject.Rows[i].Cells[29].Text.Trim()); //string ServiceTaxAppl = (GridExcelDataProject.Rows[i].Cells[30].Text.Trim()); //string InstitutionShare = (GridExcelDataProject.Rows[i].Cells[31].Text.Trim()); //string AccountHead = (GridExcelDataProject.Rows[i].Cells[32].Text.Trim()); jd[rowindex] = new GrantData(); jd[rowindex].ProjectUnit = ProjectUnit; Session["ProjectUnit"] = ProjectUnit; jd[rowindex].PID = PID; Session["PID"] = PID; Session["IDP"] = jd[rowindex].ID; jd[rowindex].UTN = UTN; jd[rowindex].ProjectType = ProjectType; if (AppliedDate != " ") { jd[rowindex].AppliedDate = Convert.ToDateTime(AppliedDate); } jd[rowindex].AppliedAmount = AppliedAmount; jd[rowindex].Contact_No = Contact_No; jd[rowindex].SourceProject = SourceProject; if (DurationOfProject != " ") { jd[rowindex].DurationOfProject = Convert.ToInt32(DurationOfProject); } jd[rowindex].ERFRealated = ERFRealated; jd[rowindex].Title = Title; jd[rowindex].Description = Description; jd[rowindex].Comments = Comments; jd[rowindex].ProjectStatus = ProjectStatus; jd[rowindex].RevisedAppliedAmount = RevisedAppliedAmount; if (SanctionOrderDate != " ") { jd[rowindex].SanctionOrderDate = Convert.ToDateTime(SanctionOrderDate); } jd[rowindex].SanctionType = SanctionType; jd[rowindex].FundingAgency = FundingAgency; jd[rowindex].AgencyAddress = AgencyAddress; jd[rowindex].AgencyContact = AgencyContact; jd[rowindex].AgencyEmailId = AgencyEmailId; jd[rowindex].AgencyPanNo = AgencyPanNo; jd[rowindex].FundingSectorLevel = FundingSectorLevel; jd[rowindex].TypeofAgency = TypeofAgency; jd[rowindex].State = State; jd[rowindex].Country = Country; //jd[rowindex].PIInstitutionID = PIInstitutionID; //jd[rowindex].PIDeptID = PIDeptID; //jd[rowindex].InstitutionID = InstitutionID; //jd[rowindex].DeptID = DeptID; //if (ProjectCommencementDate != " ") //{ // jd[rowindex].ProjectCommencementDate = Convert.ToDateTime(ProjectCommencementDate); //} //if (ProjectCloseDate != " ") //{ // jd[rowindex].ProjectCloseDate = Convert.ToDateTime(ProjectCloseDate); //} //if (ExtendedDate != " ") //{ // jd[rowindex].ExtendedDate = Convert.ToDateTime(ExtendedDate); //} //jd[rowindex].AuditRequired = AuditRequired; //jd[rowindex].ServiceTaxAppl = ServiceTaxAppl; //jd[rowindex].InstitutionShare = InstitutionShare; //jd[rowindex].AccountHead = AccountHead; if (GridExcelDataInvestigator.Visible == false && validExcel == 1) { GrantData[] jdi = new GrantData[GridExcelDataInvestigator.Rows.Count - 1]; int isleadPI = 0; int isleadPIS = 0; int isleadPIF = 0; int Investigatortype = 0; int InvestigatortypeF = 0; int InvestigatortypeS = 0; for (int j = 1; j <= GridExcelDataInvestigator.Rows.Count - 1; j++) { if (j == 1) { rowindex1 = 0; } else { rowindex1++; } string ProjectUnit1 = GridExcelDataInvestigator.Rows[j].Cells[1].Text.Trim(); string ID1 = GridExcelDataInvestigator.Rows[j].Cells[2].Text.Trim(); //jdi[j] = new GrantData(); jdi[rowindex1] = new GrantData(); jdi[rowindex1].ProjectUnit = ProjectUnit1; jdi[rowindex1].PID = ID1; if (jd[rowindex].ProjectUnit == jdi[rowindex1].ProjectUnit && jd[rowindex].PID == jdi[rowindex1].PID) { string InvestigatorName = GridExcelDataInvestigator.Rows[j].Cells[4].Text.Trim(); if (InvestigatorName == "" || InvestigatorName == null || InvestigatorName == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter Investigator Name for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } string MUNonMU = (GridExcelDataInvestigator.Rows[j].Cells[5].Text.Trim()); string EmployeeCode = (GridExcelDataInvestigator.Rows[j].Cells[6].Text.ToString()); string Institution = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[7].Text.Trim()); string Department = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[8].Text.Trim()); string EmailId = (GridExcelDataInvestigator.Rows[j].Cells[9].Text.Trim()); string InvestigatorType = (GridExcelDataInvestigator.Rows[j].Cells[10].Text.Trim()); if (InvestigatorType == "" || InvestigatorType == null || InvestigatorType == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please select Investigator Type for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } if (InvestigatorType == "P") { Investigatortype++; } string InstitutionName = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[11].Text.Trim()); string DepartmentName = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[12].Text.Trim()); string isLeadPI = (GridExcelDataInvestigator.Rows[j].Cells[15].Text.Trim()); if (isLeadPI == "Y") { isleadPI++; } if (MUNonMU == "M" || MUNonMU == "N") { if (Institution == "" || Institution == null || Institution == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter InstitutionID for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } if (Department == "" || Department == null || Department == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter DepartmentID for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } if (InstitutionName == "" || InstitutionName == null || InstitutionName == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter Institution Name for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } if (DepartmentName == "" || DepartmentName == null || DepartmentName == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter Department Name for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } } if (MUNonMU == "M" || MUNonMU == "S") { if (EmailId == "" || EmailId == null || EmailId == " ") { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Please enter MailId for the Project ID " + ID1 + " and ProjectUnit " + ProjectUnit1 + "')</script>"); return; } } if (isLeadPI == "Y") { if (MUNonMU == "S") { isleadPIS++; } else if (MUNonMU == "M") { isleadPIF++; } } if (InvestigatorType == "P") { if (MUNonMU == "S") { InvestigatortypeS++; } else if (MUNonMU == "M") { InvestigatortypeF++; } } } } if (Investigatortype == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Select atleast one Investigator Type as Primary Investigator for the Project ID " + jd[rowindex].PID + " and ProjectUnit" + jd[rowindex].ProjectUnit + "')</script>"); return; } if (isleadPI == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Select atleast one Lead PI for the Project ID " + jd[rowindex].PID + " and ProjectUnit" + jd[rowindex].ProjectUnit + "')</script>"); return; } if (isleadPI > 1) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Lead PI cannot be more than one for the Project ID " + jd[rowindex].PID + " and ProjectUnit" + jd[rowindex].ProjectUnit + "')</script>"); return; } if (jd[rowindex].ProjectType == "GS") { if (InvestigatortypeS == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Select atleast one Primary Investigator as Student!')</script>"); return; } if (isleadPIS == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Select atleast one Lead PI as Student!')</script>"); return; } } else if (jd[rowindex].ProjectType == "SG") { if (InvestigatortypeF == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Select atleast one Primary Investigator as Faculty!')</script>"); return; } if (isleadPIF == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Select atleast one Lead PI as Faculty!')</script>"); return; } } } if (GridExcelDataInvestigator.Visible == false && validExcel == 1) { GrantData[] jdi = new GrantData[GridExcelDataInvestigator.Rows.Count - 1]; for (int j = 1; j <= GridExcelDataInvestigator.Rows.Count - 1; j++) { if (j == 1) { rowindex1 = 0; } else { rowindex1++; } string ProjectUnit1 = GridExcelDataInvestigator.Rows[j].Cells[1].Text.Trim(); string ID1 = GridExcelDataInvestigator.Rows[j].Cells[2].Text.Trim(); string EntryNo = GridExcelDataInvestigator.Rows[j].Cells[3].Text.Trim(); string InvestigatorName = GridExcelDataInvestigator.Rows[j].Cells[4].Text.Trim(); string MUNonMU = (GridExcelDataInvestigator.Rows[j].Cells[5].Text.Trim()); //string EmployeeCode = (GridExcelDataInvestigator.Rows[j].Cells[6].Text.Trim()); string EmployeeCode = (GridExcelDataInvestigator.Rows[j].Cells[6].Text.ToString()); if (EmployeeCode == "" || EmployeeCode == null || EmployeeCode == " ") { EmployeeCode = ""; } else { EmployeeCode = (GridExcelDataInvestigator.Rows[j].Cells[6].Text.Trim()); } //if (MUNonMU == "M") //{ // if (EmployeeCode == "") // { // Response.Write("<script language='javascript'>alert('EmployeeCode does not exist for the Project" + ProjectUnit1 + "-" + ID1 + "')</script>"); // //return; // CheckRowsSkipped++; // continue; // } //} string Institution = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[7].Text.Trim()); string Department = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[8].Text.Trim()); string EmailId = (GridExcelDataInvestigator.Rows[j].Cells[9].Text.Trim()); string InvestigatorType = (GridExcelDataInvestigator.Rows[j].Cells[10].Text.Trim()); string InstitutionName = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[11].Text.Trim()); string DepartmentName = HttpUtility.HtmlDecode(GridExcelDataInvestigator.Rows[j].Cells[12].Text.Trim()); string NationalInternational = (GridExcelDataInvestigator.Rows[j].Cells[13].Text.Trim()); if (NationalInternational == "" || NationalInternational == null || NationalInternational == " ") { NationalInternational = ""; } else { NationalInternational = (GridExcelDataInvestigator.Rows[j].Cells[13].Text.Trim()); } string Continent = (GridExcelDataInvestigator.Rows[j].Cells[14].Text.Trim()); if (Continent == "" || Continent == null || Continent == " ") { Continent = ""; } else { Continent = (GridExcelDataInvestigator.Rows[j].Cells[14].Text.Trim()); } string isLeadPI = (GridExcelDataInvestigator.Rows[j].Cells[15].Text.Trim()); jdi[rowindex1] = new GrantData(); jdi[rowindex1].ProjectUnit = ProjectUnit1; jdi[rowindex1].PID = ID1; jdi[rowindex1].EntryNo = Convert.ToInt32(EntryNo); jdi[rowindex1].InvestigatorName = InvestigatorName; jdi[rowindex1].MUNonMU = MUNonMU; jdi[rowindex1].EmployeeCode = EmployeeCode; jdi[rowindex1].Institution = Institution; jdi[rowindex1].Department = Department; jdi[rowindex1].EmailId = EmailId; jdi[rowindex1].InvestigatorType = InvestigatorType; jdi[rowindex1].InstitutionName = InstitutionName; jdi[rowindex1].DepartmentName = DepartmentName; jdi[rowindex1].NationalInternational = NationalInternational; jdi[rowindex1].Continent = Continent; jdi[rowindex1].isLeadPI = isLeadPI; if (jdi[rowindex1].InvestigatorType == "P" && jdi[rowindex1].isLeadPI == "Y") { jd[rowindex].PIInstitutionID = jdi[rowindex1].Institution; jd[rowindex].PIDeptID = jdi[rowindex1].Department; //if (jdi[j].MUNonMU == "M") //{ // jd[rowindex].PIInstitutionID = jdi[j].Institution; // jd[rowindex].PIDeptID = jdi[j].Department; //} //else if (jdi[j].MUNonMU == "N") //{ // jd[rowindex].PIInstitutionID = jdi[j].Institution; // jd[rowindex].PIDeptID = jdi[j].Department; //} //else if (jdi[j].MUNonMU == "S") //{ // jd[rowindex].PIInstitutionID = jdi[j].Institution; // jd[rowindex].PIDeptID = jdi[j].Department; //} } if (jdi[rowindex1].EmployeeCode != "") { if (jdi[rowindex1].MUNonMU == "M") { jd[rowindex].InstitutionID = jdi[rowindex1].Institution; jd[rowindex].DeptID = jdi[rowindex1].Department; jd[rowindex].CreatedBy = jdi[rowindex1].EmployeeCode; } //else if (jdi[j].MUNonMU == "N") //{ // jd[rowindex].InstitutionID = jdi[j].Institution; // jd[rowindex].DeptID = jdi[j].Department; // jd[rowindex].CreatedBy = jdi[j].EmployeeCode; //} //else if (jdi[j].MUNonMU == "S") //{ // jd[rowindex].InstitutionID = jdi[j].Institution; // jd[rowindex].DeptID = jdi[j].Department; // jd[rowindex].CreatedBy = jdi[j].EmployeeCode; //} } //if (jdi[j].EmployeeCode != "") //{ // if (jdi[j].MUNonMU == "M") // { // if (jdi[j].InvestigatorType == "P" && jdi[j].isLeadPI == "Y") // { // jd[rowindex].CreatedBy = jdi[j].EmployeeCode; // } // else // { // jd[rowindex].CreatedBy = jdi[j].EmployeeCode; // } // } //} if (jd[rowindex].ProjectUnit != null && jd[rowindex].PID != null) { if (jd[rowindex].ProjectUnit == jdi[rowindex1].ProjectUnit && jd[rowindex].PID == jdi[rowindex1].PID) { result = b.Insertfileuploadprojets(jd[rowindex], jdi[rowindex1]); } if (jdi[rowindex1].ProjectUnit == null && jdi[rowindex1].PID == null) { Response.Write("<script language='javascript'>alert(' Project Investigator details doesnot exists for the project '" + ID + "'+ '" + ProjectUnit + "'')</script>"); } //if (jd[rowindex].ProjectUnit != jdi[j].ProjectUnit && jd[rowindex].PID == jdi[j].PID) //{ // Response.Write("<script language='javascript'>alert(' ProjectUnit is not matching for the project '" + ID + "'+ '" + ProjectUnit + "'')</script>"); //} } } } } if (CheckRowsSkipped == 0) { if (result >= 1) { log.Info("File uploaded Successfull"); Response.Write("<script language='javascript'>alert('File uploaded Successfully!')</script>"); upload.Enabled = false; } } else if (CheckRowsSkipped >= 1) { if (result >= 1) { log.Info("File uploaded Successfully "); Response.Write("<script language='javascript'>alert('File uploaded Successfullyand " + CheckRowsSkipped + " entries are skipped because project details already exists...')</script>"); upload.Enabled = false; } else { Response.Write("<script language='javascript'>alert(' " + CheckRowsSkipped + " entries are skipped because they were already exisiting...')</script>"); upload.Enabled = false; } } else if (CheckRowsSkipped >= 1) { Response.Write("<script language='javascript'>alert(' " + CheckRowsSkipped + " entries are skipped because they were already exisiting...')</script>"); upload.Enabled = false; } else { Response.Write("<script language='javascript'>alert('Error in File upload')</script>"); log.Info(" File upload :"); } } else { Response.Write("<script language='javascript'>alert('Invalid File!')</script>"); validExcel = 1; upload.Enabled = false; } } catch (Exception ex) { log.Error(ex.StackTrace); if (ex.Message.Contains("Violation of PRIMARY KEY constraint 'PK_Project'. Cannot insert duplicate key in object 'dbo.Project'.")) { Response.Write("<script language='javascript'>alert('Error..!This ID Already Exists!')</script>"); } else if (ex.Message.Contains("String was not recognized as a valid DateTime.")) { Response.Write("<script language='javascript'>alert('Date Format is not correct in the file..Please Check..')</script>"); } else if (ex.Message.Contains("SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.")) { Response.Write("<script language='javascript'>alert('Date is valid..Please Check..')</script>"); } else if (ex.Message.Contains("The UPDATE statement conflicted with the FOREIGN KEY constraint \"FK_Project_User_M\". The conflict occurred in database \"RMS\", table \"dbo.User_M\", column 'User_Id'.")) { Response.Write("<script language='javascript'>alert('The User does not does not exist in RMS..')</script>"); } else if (ex.Message.Contains("The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_Project_ProjectSource_M\". The conflict occurred in database \"RMS\", table \"dbo.ProjectSource_M\", column 'SourceId'.")) { Response.Write("<script language='javascript'>alert('The SourceProject does not does not exist in RMS..')</script>"); } else { Response.Write("<script language='javascript'>alert('Error in Uploading!')</script>"); } } }
public List <dynamic> GrantCodeOrderDetails(string strOrderID) { List <dynamic> objDynamic = new List <dynamic>(); Int64 OrderID = 0; OrderID = Convert.ToInt64(securityHelper.Decrypt(strOrderID, false)); DataSet ds = GetGrantOrderData(OrderID); var myEnumerable = ds.Tables[0].AsEnumerable(); var myEnumerableord = ds.Tables[1].AsEnumerable(); List <GrantDetail> GrantDetail = (from item in myEnumerable select new GrantDetail { GrantIdOrderID = item.Field <Int64>("GrantIdOrderID"), GrantOrderSerialId = item.Field <Int64>("GrantOrderSerialId"), GrantId = item.Field <Int64>("GrantId"), GrantTitle = item.Field <String>("GrantTitle"), Value = item.Field <String>("Value"), }).ToList(); objDynamic.Add(GrantDetail); List <GrantData> lstgrandata = new List <GrantData>(); var myEnumerableser = ds.Tables[2].AsEnumerable(); GrantData grantData = new GrantData(); grantData.SelAmount = 0; grantData.SelRate = 0; grantData.SelQty = 1; grantData.SelSubTotal = 0; grantData.Items = (from items in ds.Tables[1].AsEnumerable() select new GrantOrdrDetail { ODID = items.Field <Int64>("ODID"), ProductId = items.Field <Int64>("ProductId"), ProductName = items.Field <String>("ProdName"), Qty = items.Field <int>("Qty"), Rate = items.Field <Decimal>("Rate"), Amount = items.Field <Decimal>("Amount"), }).ToList(); lstgrandata.Add(grantData); List <GrantSerial> GrantSerial = (from item in myEnumerableser select new GrantSerial { GrantOrderSerial = item.Field <Int64>("GrantOrderSerialId"), Serial = item.Field <int>("Serial"), Data = lstgrandata, }).ToList(); objDynamic.Add(GrantSerial); List <OrderTotal> OrderTotal = (from item in ds.Tables[4].AsEnumerable() select new OrderTotal { TotalOrderAmount = item.Field <Decimal>("TotalOrderAmount"), }).ToList(); objDynamic.Add(OrderTotal); return(objDynamic); }
public List <dynamic> GetViewGrantOrderProductDetails(string strOrderID) { List <dynamic> objDynamic = new List <dynamic>(); Int64 OrderID = 0; OrderID = Convert.ToInt64(securityHelper.Decrypt(strOrderID, false)); DataSet ds = GetGrantOrderProductDetails(OrderID); var myEnumerable = ds.Tables[0].AsEnumerable(); // Grant List <GrantDetail> GrantDetail = (from item in myEnumerable select new GrantDetail { GrantIdOrderID = item.Field <Int64>("GrantIdOrderID"), GrantOrderSerialId = item.Field <Int64>("GrantOrderSerialId"), GrantId = item.Field <Int64>("GrantId"), GrantTitle = item.Field <String>("GrantTitle"), Value = item.Field <String>("Value"), }).ToList(); objDynamic.Add(GrantDetail); var myEnumerableser = ds.Tables[2].AsEnumerable(); List <GrantSerial> lstgrantSerials = new List <GrantSerial>(); for (int i = 0; i < ds.Tables[2].Rows.Count; i++) { GrantSerial grantSerial = new GrantSerial(); grantSerial.GrantOrderSerial = Convert.ToInt64(ds.Tables[2].Rows[i]["GrantOrderSerialId"].ToString()); grantSerial.Serial = Convert.ToInt32(ds.Tables[2].Rows[i]["Serial"].ToString()); grantSerial.Total = Convert.ToDecimal(ds.Tables[2].Rows[i]["Total"].ToString()); var rows = ds.Tables[3].Select("GrantOrderSerialId = '" + ds.Tables[2].Rows[i]["GrantOrderSerialId"].ToString() + "'"); List <GrantData> lstgrandata = new List <GrantData>(); if (rows.Length != 0) { foreach (var row in rows) { GrantData grantData = new GrantData(); grantData.ProductName = row["ProductName"].ToString(); grantData.ProductID = Convert.ToInt64(row["ProductId"].ToString()); grantData.SelAmount = Convert.ToDecimal(row["Amount"]); grantData.SelQty = int.Parse(row["Qty"].ToString()); grantData.SelRate = Convert.ToDecimal(row["Rate"]); grantData.GrantOrderserialItemId = Int64.Parse(row["GrantOrderserialItemId"].ToString()); lstgrandata.Add(grantData); // grantSerial.Data = lstgrandata; //lstgrantSerials.Add(grantSerial); } } else { GrantData grantData = new GrantData(); // List<GrantData> lstgrandata = new List<GrantData>(); grantData.ProductName = ""; grantData.ProductID = 0; grantData.SelAmount = 0; grantData.SelQty = 1; grantData.SelRate = 0; lstgrandata.Add(grantData); } grantSerial.Data = lstgrandata; lstgrantSerials.Add(grantSerial); } objDynamic.Add(lstgrantSerials); if (ds.Tables.Count > 5) { List <OrderTotal> OrderTotal = (from item in ds.Tables[5].AsEnumerable() select new OrderTotal { TotalOrderAmount = item.Field <Decimal>("TotalOrderAmount"), }).ToList(); objDynamic.Add(OrderTotal); } return(objDynamic); }