Example #1
0
        protected void SubmitProject(string projNo)
        {
            try
            {
                var usNm = Session["username"].ToString();

                var credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"],
                                                        ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                Portals sup = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;
                bool isSubmitted = sup.FnFinalSubmission(usNm, projNo);

                switch (isSubmitted)
                {
                case true:
                    KCDFAlert.ShowAlert("Your Application is Successfully submitted!" + isSubmitted);
                    //send Email Here
                    SendEmail(usNm, projNo);
                    // loadIncompleteApplication();
                    break;

                case false:
                    KCDFAlert.ShowAlert("Your Application could not submitted!" + isSubmitted);
                    break;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
            }
        }
Example #2
0
        protected void ddlSelCounty_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            int selIndex = ddlSelCounty.SelectedIndex;

            switch (selIndex)
            {
            case 0:
                KCDFAlert.ShowAlert("Invalid County selection");
                break;

            default:
                var sbCntysplit00 = ddlSelCounty.SelectedValue;
                //var sbcoutysplit = new StringBuilder(sbCntysplit00);
                //sbcoutysplit.Remove(0, 2); //Trim two characters from position 1
                //sbCntysplit00 = sbcoutysplit.ToString();
                var subCnty = nav.mysubCountyIs.Where(sc => sc.County_Code == sbCntysplit00).ToList();
                ddlConstituency.Enabled        = true;
                ddlConstituency.DataSource     = subCnty;
                ddlConstituency.DataTextField  = "Sub_County_Name";
                ddlConstituency.DataValueField = "Sub_County_Name";
                ddlConstituency.DataBind();
                ddlConstituency.Items.Insert(0, "--Select your Sub County--");
                KCDFAlert.ShowAlert(sbCntysplit00);
                break;
            }
        }
Example #3
0
        protected void btnGrantLogin_OnClick(object sender, EventArgs e)
        {
            captchaGrantee.ValidateCaptcha(txtCaptcha2.Text.Trim());
            if (captchaGrantee.UserValidated)
            {
                string userName     = txtorgUsn.Text.Trim().Replace("'", "");
                string userPassword = txtorgPsw.Text.Trim().Replace("'", "");
                string enP          = EncryptP(userPassword);

                //try
                //{
                if (string.IsNullOrWhiteSpace(userPassword))
                {
                    lblError.Text = "Password Empty!";
                    KCDFAlert.ShowAlert("Password Empty!");
                    return;
                }
                //OK
                CheckExistsSql(userName, userPassword);
                //}
                //catch (Exception exception)
                //{
                //    lblError.Text = exception.Message;
                //    return;
                //}
            }
            else
            {
                lblError.Text = "Invalid Captcha. Try again!";
            }
        }
Example #4
0
        protected void LoadProfPic()
        {
            try
            {
                var pic =
                    nav.profile_Pics.ToList()
                    .Where(sn => sn.Username == Session["username"].ToString())
                    .Select(l => l.Filename)
                    .SingleOrDefault();

                if (pic == null)
                {
                    KCDFAlert.ShowAlert("Upload a profile picture");
                }
                else
                {
                    profPic.ImageUrl = "ProfilePics/Consultants/" + pic;
                    HttpResponse.RemoveOutputCacheItem("/Consultancy_Page.aspx");
                    // KCDFAlert.ShowAlert("ProfilePics/ "+pic);
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #5
0
        protected void CopyFilesToDir()
        {
            // Impersonate, automatically release the impersonation.
            using (new Impersonator("KCDFFOUNDATION", @"KCDFFOUNDATION\Administrator", "Admin987654321"))
            {
                //try
                //{
                string uploadsFolder = Request.PhysicalApplicationPath + "Uploaded Documents/" + Session["grant_no"] + @"\";
                string uriUploads    = new Uri(uploadsFolder).LocalPath;

                string destPath = @"http://192.168.0.249:801/";
                //string uriPath = @"E:\AdvancedPortals\KCDF_P\KCDF_P\All Uploads\";
                string uriPath = new Uri(destPath).LocalPath;
                foreach (string dirPath in Directory.GetDirectories(uriUploads, " * ",
                                                                    SearchOption.AllDirectories))
                {
                    Directory.CreateDirectory(dirPath.Replace(uriUploads, uriPath));
                }

                //Copy all the files & Replaces any files with the same name
                foreach (string newPath in Directory.GetFiles(uriUploads, "*.*",
                                                              SearchOption.AllDirectories))
                {
                    File.Copy(newPath, newPath.Replace(uriUploads, uriPath), true);
                }
                KCDFAlert.ShowAlert("Copied from " + uriUploads + " to " + uriPath);
                //}
                //catch (Exception em)
                //{
                //  KCDFAlert.ShowAlert(em.Message);

                //}
            }
        }
Example #6
0
        //protected void FtpUpload()
        //{
        //    //FTP Server URL.
        //    string ftp = "ftp://192.168.0.249/";

        //    //FTP Folder name. Leave blank if you want to upload to root folder.
        //    string ftpFolder = "";

        //    byte[] fileBytes = null;

        //    //Read the FileName and convert it to Byte array.
        //    string fileName = Path.GetFileName(FileUploadBudget.FileName);
        //    using (StreamReader fileStream = new StreamReader(FileUploadBudget.PostedFile.InputStream))
        //    {
        //        fileBytes = Encoding.UTF8.GetBytes(fileStream.ReadToEnd());
        //        fileStream.Close();
        //    }

        //    //try
        //    //{
        //        //Create FTP Request.
        //        FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftp + ftpFolder + fileName);
        //        request.Method = WebRequestMethods.Ftp.UploadFile;

        //        //Enter FTP Server credentials.
        //        request.Credentials = new NetworkCredential("Administrator", "Admin7654321");
        //        request.ContentLength = fileBytes.Length;
        //        request.UsePassive = true;
        //        request.UseBinary = true;
        //        request.ServicePoint.ConnectionLimit = fileBytes.Length;
        //        request.EnableSsl = false;

        //        using (Stream requestStream = request.GetRequestStream())
        //        {
        //            requestStream.Write(fileBytes, 0, fileBytes.Length);
        //            requestStream.Close();
        //        }

        //        FtpWebResponse response = (FtpWebResponse)request.GetResponse();

        //        //lblMessage.Text += fileName + " uploaded.<br />";
        //        KCDFAlert.ShowAlert("Uploaded");
        //        response.Close();
        //    //}
        //    //catch (WebException ex)
        //    //{
        //    //    KCDFAlert.ShowAlert((ex.Response as FtpWebResponse).StatusDescription);
        //    //}
        //}
        protected void CopyFilesToDir()
        {
            try
            {
                string       uploadsFolder   = Request.PhysicalApplicationPath + "Uploaded Documents\\" + Session["consultant_no"] + @"\";
                const string destPathserver1 = @"\\192.168.0.250\All Uploads\";

                foreach (string dirPath in Directory.GetDirectories(uploadsFolder, " * ",
                                                                    SearchOption.AllDirectories))
                {
                    Directory.CreateDirectory(dirPath.Replace(uploadsFolder, destPathserver1));
                }

                //Copy all the files & Replaces any files with the same name

                // string destPathserver2 = @"\\192.168.0.249\All_Portal_Uploaded\";
                foreach (string newPath in Directory.GetFiles(uploadsFolder, "*.*",
                                                              SearchOption.AllDirectories))
                {
                    File.Copy(newPath, newPath.Replace(uploadsFolder, destPathserver1), true);
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
            }
        }
Example #7
0
        protected void ToPNG()
        {
            string extn          = ".jpg";
            string uploadsFolder = Request.PhysicalApplicationPath + "ProfilePics\\";
            string filenameO     = User.Identity.Name + extn;

            System.Drawing.Image image = System.Drawing.Image.FromFile(uploadsFolder + filenameO);
            image.Save(uploadsFolder + "dre2.png", System.Drawing.Imaging.ImageFormat.Png);
            KCDFAlert.ShowAlert("Converted to png");
        }
Example #8
0
        protected void UploadFile(object sender, EventArgs e)
        {
            try
            {
                var documentKind = "POCA TOOL";
                var refNoIs      = txtPrefNo.Text;

                string uploadsFolder = Request.PhysicalApplicationPath + "Uploaded Documents\\" + Session["grant_no"] + @"\";

                // string uploadsFolder = @"\\KCDFSVR\All_Portal_Uploaded\";  //@"\\192.168.0.249\All_Portal_Uploaded\";
                string fileName = Path.GetFileName(FileUploadPOCA.PostedFile.FileName);
                string ext      = Path.GetExtension(FileUploadPOCA.PostedFile.FileName);
                if (!Directory.Exists(uploadsFolder))
                {
                    //if the folder doesnt exist create it
                    Directory.CreateDirectory(uploadsFolder);
                }

                if (FileUploadPOCA.PostedFile.ContentLength > 5000000)
                {
                    KCDFAlert.ShowAlert("Select a file less than 5MB!");
                    return;
                }
                if ((ext == ".xls") || (ext == ".xlsx"))
                {
                    string filename = Session["grant_no"] + "_" + fileName;
                    FileUploadPOCA.SaveAs(uploadsFolder + filename);
                    // file path to read file
                    string filePath = uploadsFolder + filename;

                    FileStream file   = File.OpenRead(filePath);
                    byte[]     buffer = new byte[file.Length];
                    file.Read(buffer, 0, buffer.Length);
                    file.Close();
                    string attachedDoc = Convert.ToBase64String(buffer);

                    SaveAttachment(filename, ext, documentKind, refNoIs, attachedDoc);
                    LoadMyMatrixUploads();
                }
                else
                {
                    KCDFAlert.ShowAlert("File Format is : " + ext + "; - Allowed picture formats are: XLS XLSX only!");
                }
                if (!FileUploadPOCA.HasFile)
                {
                    KCDFAlert.ShowAlert("Select Document before uploading");
                    return;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert("Unkown Error Occured!");
                // KCDFAlert.ShowAlert(ex.Message);
            }
        }
Example #9
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            cptCaptcha.ValidateCaptcha(txtCaptcha.Text.Trim());
            if (cptCaptcha.UserValidated)
            {
                string userName     = txtUsername.Text.Trim().Replace("'", "");
                string userPassword = txtPassword.Text.Trim().Replace("'", "");

                string mypassencrypt = EncryptP(userPassword);

                if (string.IsNullOrWhiteSpace(userPassword))
                {
                    lblError.Text = "Password Empty!";
                    KCDFAlert.ShowAlert("Password Empty!");
                    return;
                }

                try
                {
                    //if (nav.studentsRegister.Where(r => r.Username == userName && r.Activated == true && r.Password == mypassencrypt).FirstOrDefault() != null)
                    //{
                    //    //Change the Session called "Logged" value into "Yes"
                    //    Session["Logged"] = "Yes";
                    //    Session["username"] = userName;
                    //    Session["pwd"] = userPassword;
                    //    rememberMeYeah(userName, userPassword);
                    //    Session["reportformUser"] = "******";
                    //    CheckStudentsProfile(userName);
                    //    Response.Redirect("~/Dashboard.aspx");

                    //}
                    //else if (nav.studentsRegister.Where(r => r.Username == userName && r.Activated == false && r.Password == userPassword).FirstOrDefault() != null)
                    //{
                    //    //HotelFactory.ShowAlert("You Ain't Active!!");
                    //    lblError.Text = "Account not active, please activate!";
                    //    return;
                    //}
                    //else
                    //{
                    //    lblError.Text = "Authentication failed!";
                    //    return;
                    //}
                    ValidateScholar(userName, userPassword);
                }
                catch (Exception exception)
                {
                    lblError.Text = exception.Message;
                    return;
                }
            }
            else
            {
                lblError.Text = "Invalid Captcha. Try again!";
            }
        }
Example #10
0
        protected void btnProjEdit_OnClick(object sender, EventArgs e)
        {
            int      projectlength = 0;
            var      usn           = Session["username"].ToString();
            string   projTt        = TextBoxtitle.Text.Trim();
            var      pstartD       = txtDateofStart.Value.Trim();
            DateTime projTDt       = DateTime.Parse(pstartD);
            string   county        = ddlSelCountry.SelectedItem.Text;
            string   constituency  = ddlConstituency.SelectedItem.Text;
            string   urbantarget   = txtAreaTargetSettmnt.Text.Trim();

            string  scale     = ddlEstScale.SelectedItem.Text;
            decimal projCost  = Convert.ToDecimal(TextBoxcost.Text);
            decimal contrib   = Convert.ToDecimal(TextBoxcont.Text);
            decimal kcdffunds = Convert.ToDecimal(TextBoxrequested.Text);
            string  projectNm = lblProjNo.Text;

            if (ddlMonths.SelectedItem.Text == "..Select project Length..")
            {
                KCDFAlert.ShowAlert("Select valid project duration!");
                return;
            }
            else
            {
                projectlength = Convert.ToInt32(ddlMonths.SelectedItem.Text);
            }

            try
            {
                var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                Portals sup         = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;
                sup.FnEditProject(projectNm, county, constituency, urbantarget,
                                  projectlength, projCost, contrib, kcdffunds, projTDt, scale);

                KCDFAlert.ShowAlert("Data Updated Successfully!");

                TextBoxtitle.Text             = "";
                txtDateofStart.Value          = "";
                ddlSelCountry.SelectedIndex   = 0;
                ddlConstituency.SelectedIndex = 0;
                txtAreaTargetSettmnt.Text     = "";
                ddlMonths.SelectedIndex       = 0;
                ddlEstScale.SelectedIndex     = 0;
                TextBoxcost.Text      = "";
                TextBoxcont.Text      = "";
                TextBoxrequested.Text = "";
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
            }
        }
Example #11
0
        protected void ValidateScholar(string userName, string password)
        {
            try
            {
                var myUID = "";

                using (SqlConnection con = new SqlConnection(strSQLConn))
                {
                    using (SqlCommand cmd = new SqlCommand("Validate_UserScholar"))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@Username", userName);
                        cmd.Parameters.AddWithValue("@Password", EncryptP(password));
                        cmd.Connection = con;

                        con.Open();
                        myUID = Convert.ToString(cmd.ExecuteScalar());
                        con.Close();
                    }
                    switch (myUID)
                    {
                    case "invalid":
                        KCDFAlert.ShowAlert("Aunthentication Failed!");
                        lblError.Text = "Aunthentication Failed!";
                        break;

                    case "deactivated":
                        KCDFAlert.ShowAlert("Account has not been activated!");
                        lblError.Text = "Account has not been activated";
                        break;

                    default:
                        Session.Clear();
                        FormsAuthentication.RedirectFromLoginPage(userName, chkRememberMe.Checked);
                        //Change the Session called "Logged" value into "Yes"
                        Session["Logged"]   = "Yes";
                        Session["username"] = userName;
                        FormsAuthentication.GetAuthCookie(userName, true);
                        FormsAuthentication.SetAuthCookie(userName, true);

                        Session["pwd"] = password;
                        GetStudentNoSession(userName);
                        rememberMeYeah(userName, password);
                        Session["reportformUser"] = "******";
                        CheckStudentsProfile(userName);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
            }
        }
Example #12
0
        protected void LoadProfPic()
        {
            try
            {
                var pic =
                    nav.profile_Pics.ToList()
                    .Where(sn => sn.Username == Session["username"].ToString())
                    .Select(l => l.Filename)
                    .SingleOrDefault();

                if (pic == null)
                {
                    KCDFAlert.ShowAlert("Upload a profile picture");
                }
                else
                {
                    profPic.ImageUrl = "ProfilePics/Grantees/" + pic;
                    HttpResponse.RemoveOutputCacheItem("/Grantee_Dashboard.aspx");
                    // KCDFAlert.ShowAlert("ProfilePics/ "+pic);
                }

                //string picture = string.Empty;
                //WSConfig.ObjNav.FnRetrieveSavedPic(Session["username"].ToString(), ref picture);

                //if (picture == string.Empty)
                //{
                //    KCDFAlert.ShowAlert("No Profile Photo yet!");
                //    return;
                //}
                //else
                //{
                //    byte[] buffer = Convert.FromBase64String(picture);

                //    FileStream file = File.Create("ProfilePics/Grantees/ "  + Grantees.No + ".png");

                //    file.Write(buffer, 0, buffer.Length);
                //    file.Close();
                //    profPic.ImageUrl = "ProfilePics/Grantees/" + Grantees.No + ".png";
                //    KCDFAlert.ShowAlert(picture);

                //    FileStream file = File.OpenRead(filePath);
                //    byte[] buffer = new byte[file.Length];
                //    file.Read(buffer, 0, buffer.Length);
                //    file.Close();
                //    string attachedDoc = Convert.ToBase64String(buffer);
                //    saveProfToNav(uploadsFolder + filenameO, filenameO, attachedDoc);
                //}
            }
            catch (Exception ex)
            {
            }
        }
Example #13
0
        protected void btnLogConsultant_OnClick(object sender, EventArgs e)
        {
            cptCaptcha.ValidateCaptcha(txtCaptcha3.Text.Trim());
            if (cptCaptcha.UserValidated)
            {
                try
                {
                    string userName     = txtConsUsernameIS.Text.Trim().Replace("'", "");
                    string userPassword = txtConsPasswordIS.Text.Trim().Replace("'", "");

                    if (string.IsNullOrWhiteSpace(userPassword))
                    {
                        lblError.Text = "Password Empty!";
                        KCDFAlert.ShowAlert("Password Empty!");
                        return;
                    }
                    if (nav.myConsultants.Where(r => r.Organization_Username == userName && r.Active == true && r.Password == EncryptP(userPassword)).FirstOrDefault() != null)
                    {
                        //Change the Session called "Logged" value into "Yes"
                        Session["Logged"]   = "Yes";
                        Session["username"] = userName;
                        Session["pwd"]      = EncryptP(userPassword);
                        rememberMeYeah(userName, EncryptP(userPassword));
                        Session["reportformUser"] = "******";
                        GetConsultantNoSession(userName);
                        FormsAuthentication.GetAuthCookie(userName, true);
                        FormsAuthentication.SetAuthCookie(userName, true);
                        Response.Redirect("~/Consultancy_Page.aspx");
                    }
                    else if (nav.myConsultants.Where(r => r.Organization_Username == userName && r.Active == false && r.Password == EncryptP(userPassword)).FirstOrDefault() != null)
                    {
                        lblError.Text = "Account not active, please activate!";
                        return;
                    }
                    else
                    {
                        lblError.Text = "Authentication failed!";
                        return;
                    }
                }
                catch (Exception exception)
                {
                    lblError.Text = exception.Message;
                    return;
                }
            }
            else
            {
                lblError.Text = "Invalid Captcha. Try again!";
            }
        }
Example #14
0
        protected void FinalSubmitApplication(string usname, string refNoPrj)
        {
            try
            {
                var approvedyeah =
                    nav.myConsultations.ToList()
                    .Where(a => a.No == refNoPrj)
                    .Select(ast => ast.Approval_Status)
                    .SingleOrDefault();

                switch (approvedyeah)
                {
                case "Approved":
                    KCDFAlert.ShowAlert("You cannot Submit an Appproved application!!");
                    break;

                case "Declined":
                    KCDFAlert.ShowAlert("Your application was declined!, You cannot submit");
                    break;

                case "Open":
                    var credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"],
                                                            ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                    Portals sup = new Portals();
                    sup.Credentials     = credentials;
                    sup.PreAuthenticate = true;
                    bool isSubmitted = sup.FnSubmitConsultApp(usname, refNoPrj);

                    switch (isSubmitted)
                    {
                    case true:
                        KCDFAlert.ShowAlert("Your Application is Successfully submitted!" + isSubmitted);
                        LoadmyApplications();
                        SendEmail(usname, refNoPrj);
                        Session.Remove("validOR");
                        break;

                    case false:
                        KCDFAlert.ShowAlert("Your Application could not submitted!" + isSubmitted);
                        Session.Remove("validOR");
                        break;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert("Error Loading!");
            }
        }
Example #15
0
        protected void CheckExistsSql(string myUserName, string passMyass)
        {
            var iamThere = nav.grantees_Register.ToList().Where(usN => usN.Organization_Username == myUserName).SingleOrDefault();

            if (iamThere == null)
            {
                KCDFAlert.ShowAlert("Username not registered yet!");
                return;
            }
            else
            {
                GetGranteePassword(myUserName, passMyass);
                // KCDFAlert.ShowAlert("I see u");
            }
        }
Example #16
0
        protected void lnkConfirm_OnClick(object sender, EventArgs e)
        {
            try
            {
                string editId     = (sender as LinkButton).CommandArgument;
                var    usernameIs = Session["username"].ToString();

                IsAGoPostIt(usernameIs, editId);
            }
            catch (Exception rt)
            {
                //  KCDFAlert.ShowAlert(rt.Message);
                KCDFAlert.ShowAlert("Could not submit! Check if everything is uploaded!");
            }
        }
Example #17
0
 protected void tblMyProjects_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         var     del_id      = tblMyProjects.DataKeys[e.RowIndex].Values[0].ToString();
         var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
         Portals sup         = new Portals();
         sup.Credentials     = credentials;
         sup.PreAuthenticate = true;
         sup.FnDeleteProject(del_id);
         LoadMyProjects();
         KCDFAlert.ShowAlert("Project Deleted Successfully!");
     }
     catch (Exception ex)
     {
         KCDFAlert.ShowAlert(ex.Message);
     }
 }
Example #18
0
 protected void LoadUploads()
 {
     try
     {
         string[]        filePaths = Directory.GetFiles(Server.MapPath("~/Downloads_Consultants/"));
         List <ListItem> files     = new List <ListItem>();
         foreach (string filePath in filePaths)
         {
             files.Add(new ListItem(Path.GetFileName(filePath), filePath));
         }
         gridViewUploads.DataSource = files;
         gridViewUploads.DataBind();
     }
     catch (Exception ex)
     {
         KCDFAlert.ShowAlert("No Uploads!");
     }
 }
Example #19
0
        protected void btnValidateInfo_OnClick(object sender, EventArgs e)
        {
            try
            {
                var tobevalidated = Session["edit_id"].ToString();
                //KCDFAlert.ShowAlert(tobevalidated);var prj = ddlAccountType.SelectedItem.Text;
                var     usNM        = Session["username"].ToString();
                var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                Portals sup         = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;
                bool myValid = sup.FnValidateSubmission(usNM, tobevalidated);
                switch (myValid)
                {
                case true:
                    txtValidate.Text      = "ALL UPLOADS AVAILABLE";
                    txtValidate.ForeColor = Color.GhostWhite;
                    txtValidate.BackColor = Color.ForestGreen;
                    //  btnFinalSubmit.Enabled = true;
                    btnValidateInfo.Enabled = false;
                    hdnTxtValidit.Value     = "isValid";
                    KCDFAlert.ShowAlert("All Uploads available, you can submit your application: " + hdnTxtValidit.Value);
                    break;

                case false:
                    txtValidate.Text      = "PLEASE COMPLETE THE APPLICATION FIRST";
                    txtValidate.BackColor = Color.Red;
                    txtValidate.ForeColor = Color.GhostWhite;
                    //  btnFinalSubmit.Enabled = false;
                    hdnTxtValidit.Value = "isInValid";
                    sup.FnChangeSubmitStatus(tobevalidated, usNM);
                    KCDFAlert.ShowAlert("No uploads yet!, you cannot submit anything: " + hdnTxtValidit.Value);
                    break;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
                txtValidate.Text      = "PLEASE UPLOAD ALL DOCUMENTS";
                txtValidate.BackColor = Color.Red;
                txtValidate.ForeColor = Color.GhostWhite;
                //btnFinalSubmit.Enabled = false;
            }
        }
Example #20
0
        protected void gridViewUploads_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                var delId = gridViewUploads.DataKeys[e.RowIndex].Values[0].ToString();
                Session["delMeID"] = delId;

                var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                Portals sup         = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;

                var uploadsGrantNo =
                    nav.myConsultsUploads.ToList()
                    .Where(rU => rU.Id == Session["delMeID"].ToString() &&
                           rU.Username == Session["username"].ToString())
                    .Select(gN => gN.Scholarship_No).SingleOrDefault();
                bool confirmsubmit =
                    nav.myConsultations.ToList()
                    .Where(ri => ri.No == uploadsGrantNo)
                    .Select(sb => Convert.ToBoolean(sb.Application_Submitted))
                    .SingleOrDefault();
                switch (confirmsubmit)
                {
                case true:
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('You CANT delete Upload for a submitted project, Replace it by Uploading again!');", true);
                    break;

                case false:
                    if (sup.FnDeleteUploadConsult(Session["delMeID"].ToString()) == true)
                    {
                        KCDFAlert.ShowAlert("Deleted Successfully!" + uploadsGrantNo + " &&" + delId);
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('Deleted Successfully!" + uploadsGrantNo + " &&" + delId + "');", true);
                        LoadUploads();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                //KCDFAlert.ShowAlert(ex.Message);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('" + ex.Message + "');", true);
            }
        }
Example #21
0
        protected void ResetmyConsultantPassword()
        {
            var myEmailIs = txtIforgotPassword.Text.Trim();

            try
            {
                var nPassword = NewPassword();
                var CompEmail = WSConfig.ObjNav.FnConsultantPasswordReset(myEmailIs, EncryptP(nPassword));
                if (WSConfig.MailFunction(string.Format("Dear Member,\n Your New password is: {0}", nPassword), CompEmail,
                                          "Grantee Portal password reset successful") && !String.IsNullOrEmpty(CompEmail))
                {
                    KCDFAlert.ShowAlert("A New Password has been generated and sent to your registered E-mail Address.");
                }
            }
            catch (Exception exception)
            {
                KCDFAlert.ShowAlert(exception.Message);
            }
        }
Example #22
0
        private void GetGranteePassword(string mYusNm, string myPassWd)
        {
            var myPass =
                nav.grantees_Register.ToList()
                .Where(or => or.Organization_Username == mYusNm)
                .Select(p => p.Password)
                .SingleOrDefault();

            if (myPass != EncryptP(myPassWd))
            {
                KCDFAlert.ShowAlert("Wrong Password!");
                lblError.Text = "Wrong Password!!";
                return;
            }
            else
            {
                ValidateGrantee(mYusNm, myPassWd);
            }
        }
Example #23
0
        protected void IsAGoPostIt(string usNme, string refId)
        {
            var subStatus = Session["validOR"].ToString();

            switch (subStatus)
            {
            case "isValid":
                FinalSubmitApplication(usNme, refId);
                break;

            case "isInValid":
                KCDFAlert.ShowAlert("You can't Submit this application, because you have not uploaded all documents!");
                break;

            default:
                KCDFAlert.ShowAlert("Please Confirm attachemnts first! " + subStatus);
                break;
            }
        }
Example #24
0
        protected void btnValidateInfo_OnClick(object sender, EventArgs e)
        {
            try
            {
                var tobevalidated = Session["edit_id"].ToString();
                //KCDFAlert.ShowAlert(tobevalidated);
                var usNM = Session["username"].ToString();

                var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                Portals sup         = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;
                bool myValid = sup.FnValidatSubmitConsultant(usNM, tobevalidated);
                switch (myValid)
                {
                case true:
                    txtValidate.Text        = "ALL UPLOADS AVAILABLE";
                    txtValidate.ForeColor   = Color.GhostWhite;
                    txtValidate.BackColor   = Color.ForestGreen;
                    btnValidateInfo.Enabled = false;
                    // hdnTxtValidit.Value = "isValid";
                    Session["validOR"] = "isValid";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('All Uploads available, you can submit your application: " + hdnTxtValidit.Value + "');", true);
                    break;

                case false:
                    txtValidate.Text      = "PLEASE COMPLETE THE APPLICATION FIRST";
                    txtValidate.BackColor = Color.Red;
                    txtValidate.ForeColor = Color.GhostWhite;
                    // hdnTxtValidit.Value = "isInValid";
                    Session["validOR"] = "isInValid";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('No uploads yet!, you cannot submit anything: " + hdnTxtValidit.Value + "');", true);
                    break;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
                txtValidate.Text      = "PLEASE UPLOAD ALL DOCUMENTS";
                txtValidate.BackColor = Color.Red;
                txtValidate.ForeColor = Color.GhostWhite;
            }
        }
Example #25
0
        private void LoadUploads()
        {
            try
            {
                var userNm = Session["username"].ToString();
                var openP  = nav.myConsultations.ToList().Where(up => up.Consultant_Username == userNm && up.Approval_Status == "Open").Select(pn => pn.No).SingleOrDefault();

                //KCDFAlert.ShowAlert(openP);
                var upsFiles = nav.myConsultsUploads.ToList().Where(un => un.Username == userNm && un.Scholarship_No == openP);
                gridViewUploads.AutoGenerateColumns = false;
                gridViewUploads.DataSource          = upsFiles;
                gridViewUploads.DataBind();
            }
            catch (Exception ex) {
                // KCDFAlert.ShowAlert("You have not uploaded documents yet!");
                KCDFAlert.ShowAlert(ex.Message);
                //gridViewUploads.EmptyDataText = "No Uploads found!";
            }
        }
Example #26
0
        protected void loadUploads()
        {
            try
            {
                //string[] filePaths = Directory.GetFiles(Server.MapPath("~/Uploaded Documents/" + Grantees.No + "/"));
                //List<ListItem> files = new List<ListItem>();
                //foreach (string filePath in filePaths)
                //{
                //    files.Add(new ListItem(Path.GetFileName(filePath), filePath));
                //}

                //  gridViewUploads.DataSource = files;
                gridViewUploads.DataBind();
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert("You have not uploaded documents yet!");
            }
        }
Example #27
0
        protected void UploadFile(object sender, EventArgs e)
        {
            try
            {
                string uploadsFolder = Request.PhysicalApplicationPath + "Uploaded Documents\\" + Session["grant_no"] + "\\";
                string fileName      = Path.GetFileName(FileUpload.PostedFile.FileName);
                string ext           = Path.GetExtension(FileUpload.PostedFile.FileName);
                if (!Directory.Exists(uploadsFolder))
                {
                    //if the folder doesnt exist create it
                    Directory.CreateDirectory(uploadsFolder);
                }

                if (FileUpload.PostedFile.ContentLength > 5000000)
                {
                    KCDFAlert.ShowAlert("Select a file less than 5MB!");
                    return;
                }
                if ((ext == ".jpeg") || (ext == ".jpg") || (ext == ".png") || (ext == ".pdf") || (ext == ".docx") || (ext == ".doc") || (ext == ".xlsx"))
                {
                    string filename = Session["grant_no"] + "_" + fileName;
                    FileUpload.SaveAs(uploadsFolder + filename);
                    CopyFilesToDir();
                    loadUploads();
                    saveAttachment(filename, ext);
                    KCDFAlert.ShowAlert("Document: " + filename + " uploaded and Saved successfully!");
                }
                else
                {
                    KCDFAlert.ShowAlert("File Format is : " + ext + "; - Allowed picture formats are: JPG, JPEG, PNG, PDF, DOCX, DOC, XLSX only!");
                }
                if (!FileUpload.HasFile)
                {
                    KCDFAlert.ShowAlert("Select Document before uploading");
                    return;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert("Unkown Error Occured!");
            }
        }
Example #28
0
        protected void lnkConfirm_OnClick(object sender, EventArgs e)
        {
            var subStatus  = hdnTxtValidit.Value;
            var projectRfN = (sender as LinkButton).CommandArgument;

            switch (subStatus)
            {
            case "isValid":
                SubmitProject(projectRfN);
                break;

            case "isInValid":
                KCDFAlert.ShowAlert("You can't submit this application, because you have not uploaded all documents!");
                break;

            default:
                KCDFAlert.ShowAlert("Please Confirm attachments first! " + hdnTxtValidit.Value);
                break;
            }
        }
Example #29
0
        protected void lnkEdit_OnClick(object sender, EventArgs e)
        {
            try
            {
                string edit_id = (sender as LinkButton).CommandArgument;
                var    prjnm   =
                    nav.projectOverview.ToList().Where(i => i.No == edit_id).Select(pn => pn.Project_Name).SingleOrDefault();
                var CallRefNo =
                    nav.projectOverview.ToList().Where(i => i.No == edit_id).Select(pn => pn.Call_Ref_Number).SingleOrDefault();

                var approvedyeah =
                    nav.projectOverview.ToList()
                    .Where(a => a.No == edit_id)
                    .Select(ast => ast.Approval_Status)
                    .SingleOrDefault();

                switch (approvedyeah)
                {
                case "Approved":
                    KCDFAlert.ShowAlert("You cannot Edit an Appproved application!!");
                    break;

                case "Pending Approval":
                    KCDFAlert.ShowAlert("Your application is pending approval, you cannot edit");

                    break;

                case "Open":
                    Session["projectname"]     = prjnm;
                    Session["projectidnumber"] = edit_id;
                    Session["prjCallrefNo"]    = CallRefNo;
                    Response.Redirect("EditMyProject.aspx");
                    break;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert("Error Loading!");
            }
        }
Example #30
0
        private void CheckIfActive(string usnUsername, string passWord)
        {
            try
            {
                var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                Portals sup         = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;

                if (sup.FnCheckIfActive_Grantee(usnUsername))
                {
                    // KCDFAlert.ShowAlert("Active Member");
                    GetGranteePassword(usnUsername, passWord);
                    LoginFn(usnUsername, passWord);
                    return;
                }
            }
            catch (Exception ex)
            {
                KCDFAlert.ShowAlert(ex.Message);
            }
        }