protected void btnRegister_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in gvCourseRegistration.Rows)
        {
            CheckBox cb = (CheckBox)row.FindControl("RegisterThis");
            if (cb != null && cb.Checked)
            {
                int             id    = Convert.ToInt32(gvCourseRegistration.DataKeys[row.RowIndex].Value);
                int             cid   = Convert.ToInt32(row.Cells[1].Text);
                RegistrationDAL rdal  = new RegistrationDAL();
                string          email = Session["Course_Key"].ToString();
                DataSet         sid   = rdal.getStudent(email);


                DataTable dt = sid.Tables[0];
                DataRow   dr = dt.Rows[0];

                int    stdid = (int)dr["Student_id"];
                string fname = dr["first_name"].ToString();
                string lname = dr["last_name"].ToString();
                string name  = fname + ' ' + lname;
                try
                {
                    rdal.RegisterCourse(cid, stdid, name);
                    gvCourseRegistration.Visible = false;
                    btnRegister.Visible          = false;
                    heading1.InnerText           = "Course has been Successfully registered";
                }
                catch (Exception ex)
                {
                    lblAlready.Text = "  Course Already Registered";
                }
            }
        }
    }
Beispiel #2
0
        public bool GetById()
        {
            bool res = false;

            res = RegistrationDAL.GetById(this);
            return(res);
        }
Beispiel #3
0
        public bool Delete()
        {
            bool res = false;

            res = RegistrationDAL.Delete(this);
            return(res);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Console.SetWindowSize((int)(Console.WindowWidth * 1.2), Console.WindowHeight);
            Console.Title = "Workshop 2";
            var menu = new Menu();

            var db        = new RegistrationDAL();
            var reg       = new Registration(db);
            var V_console = new ConsoleView(menu);

            var C_app = new Application(V_console, reg);

            V_console.DisplayMenu(Menu.MenuItems.Main);

            //Simple error handling. Application starts over if an exception is thrown.
Start:
            try
            {
                while (C_app.Run())
                {
                    ;
                }
            }
            catch
            {
                Console.Clear();
                V_console.DisplayMenu(Menu.MenuItems.Main);
                Console.Write("Something went wrong. Please try again");
                goto Start;
            }
        }
Beispiel #5
0
        public string NewRegistration(string registrationString) //Want to change in this service as enc and dec algo
        {
            try
            {
                if (registrationString != null && !String.IsNullOrEmpty(registrationString) && !String.IsNullOrWhiteSpace(registrationString))
                {
                    String[] dataArray = registrationString.Split(new char[] { '*' });
                    if (dataArray.Length == 8)
                    {
                        //insert into database
                        Random          otpGenerator    = new Random();
                        string          otpNumber       = otpGenerator.Next(1000, 9999).ToString();
                        RegistrationDAL registrationDal = new RegistrationDAL();
                        CommonCode      commonCode      = new CommonCode();
                        // string password = commonCode.DESEncrypt(dataArray[3]);

                        //string password = dataArray[3];
                        string password = dataArray[3];
                        string userName = dataArray[2];

                        userName = EncryptDecrypt.DecodeAndDecrypt(userName);
                        password = EncryptDecrypt.DecodeAndDecrypt(password);


                        string pw = password.Substring(0, password.Length - 12);
                        password = commonCode.DESEncrypt(pw);

                        string dt1 = userName.Substring(userName.Length - 12);
                        userName = userName.Substring(0, userName.Length - 12);

                        string retVal = objenc.DateTimeDec(dt1);

                        if (retVal == "0")
                        {
                            return(CommonCode.SQL_ERROR.ToString());
                        }

                        //string result = registrationDal.newRegistration(dataArray[0], dataArray[1], dataArray[2], password, otpNumber, dataArray[4], dataArray[5], dataArray[6], dataArray[7]);
                        string   result = registrationDal.newRegistration(dataArray[0], dataArray[1], userName, password, otpNumber, dataArray[4], dataArray[5], dataArray[6], dataArray[7]);
                        string[] r      = result.Split(new Char[] { '*' });
                        if (r[0] == CommonCode.OK.ToString())
                        {
                            //string message = "Dear " + dataArray[2] + " thanks to Register your Voter Profile in True Voter app. OTP for profile confirmation is " + otpNumber + "";
                            string message = "Dear " + userName + " thanks to Register your Voter Profile in True Voter app. OTP for profile confirmation is " + otpNumber + "";
                            SendSMS(dataArray[1], message);
                        }
                        return(result.ToString());
                    }
                    else
                    {
                        return(CommonCode.WRONG_INPUT.ToString());
                    }
                }
                return(CommonCode.WRONG_INPUT.ToString());
            }
            catch (Exception)
            {
                return(CommonCode.ERROR.ToString());
            }
        }
        public User Register(User user)
        {
            User            u = new User();
            RegistrationDAL registrationDAL = new RegistrationDAL();

            u = registrationDAL.CreateNewUser(user);
            return(u);
        }
Beispiel #7
0
 public static void CreateTables()
 {
     ClassDAL.CreateTable();
     ClientDAL.CreateTable();
     CoachDAL.CreateTable();
     RegistrationDAL.CreateTable();
     RoomDAL.CreateTable();
 }
Beispiel #8
0
        public bool Create()
        {
            bool res = false;

            if (!RegistrationDAL.GetByRef(this))
            {
                res = RegistrationDAL.Create(this);
            }
            return(res);
        }
 public void lbDRegister_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in gvCourse.Rows)
     {
         int             cid  = Convert.ToInt32(row.Cells[0].Text);
         RegistrationDAL cdal = new RegistrationDAL();
         cdal.DeRegisterCourse(cid);
         Response.Redirect(Request.Url.AbsoluteUri);
     }
 }
Beispiel #10
0
        //public DataTable GetAllActive()
        //{
        //    try
        //    {
        //        DataTable dtList = GetAll();
        //        var rows = dtList.AsEnumerable().Where(x => ((bool)x["IsActive"]) == true);
        //        DataTable dt = rows.Any() ? rows.CopyToDataTable() : dtList.Clone();

        //        if (dt != null)
        //            if (dt.Rows.Count > 0)
        //                return dt;
        //            else
        //                return null;
        //        else
        //            return null;
        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }
        //}

        public DataTable GetById(int id)
        {
            try
            {
                RegistrationDAL registrationDAL = new RegistrationDAL();
                return(registrationDAL.GetById(id));
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #11
0
 public bool Delete(Registrations registration)
 {
     try
     {
         RegistrationDAL registrationDAL = new RegistrationDAL();
         return(registrationDAL.Delete(registration));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #12
0
        public string checkOtp(string mobileNo, string otp) //Want to change in this service as enc and dec algo
        {
            RegistrationDAL registrationDal = new RegistrationDAL();

            string[] uregid = mobileNo.Split('$');
            string[] otpid  = otp.Split('$');

            mobileNo = objenc.DecryptInteger(uregid[0], uregid[1]);
            otp      = objenc.DecryptInteger(otpid[0], otpid[1]);

            return(registrationDal.checkOtp(mobileNo, otp));
        }
Beispiel #13
0
 public DataTable GetAll()
 {
     try
     {
         RegistrationDAL registrationDAL = new RegistrationDAL();
         return(registrationDAL.GetAll());
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #14
0
    public void Page_Load(object sender, EventArgs e)
    {
        try
        {
            this.Master.name.Text = Session["User"].ToString();
        }
        catch (Exception ex)
        {
            Response.Redirect("index.aspx");
        }
        d.getcount();
        count.Text = d.count.ToString();
        ins();
        venue();
        vol();
        hosp();
        course();
        registration();
        atmosphere();
        DataSet ds = cd.getOfferedCourse();

        gvCourseRegistration.DataSource = ds;
        gvCourseRegistration.DataBind();
        StringBuilder   htmlTable = new StringBuilder();
        RegistrationDAL rdal      = new RegistrationDAL();


        DataSet ds1 = rdal.getStudent();


        htmlTable.Append("<table border='1' id='Table1' class='table table-bordered table-hover table-responsive' width='500px' height='80'>");
        htmlTable.Append("<tr style='background-color:#591919; color: White; '><th  style='text-align:center'>Course ID</th><th style='text-align:center'>Course Name</th><th style='text-align:center'>Total Enrolled Students</th></tr>");
        int j = 1000;

        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
        {
            int cid    = Convert.ToInt32(ds1.Tables[0].Rows[i]["Course_id"]);
            int countt = rdal.getcount(cid);
            htmlTable.Append("<tr style='color: black;'>");
            htmlTable.Append("<td>" + ds1.Tables[0].Rows[i]["Course_id"] + "</td>");
            htmlTable.Append("<td>" + ds1.Tables[0].Rows[i]["Course_Name"] + "</td>");
            htmlTable.Append("<td>" + countt + "</td>");



            htmlTable.Append("</tr>");
        }
        htmlTable.Append("</table>");
        DBDataPlaceHolder.Controls.Add(new Literal {
            Text = htmlTable.ToString()
        });
    }
        public int gcmRegistration(string mobile, string regid, int userType)
        {
            try
            {
                RegistrationDAL reg = new RegistrationDAL();

                string[] uregid = mobile.Split('$');
                mobile = objenc.DecryptInteger(uregid[0], uregid[1]);

                return(reg.GCMRegistration(mobile, regid, userType));
            }
            catch
            {
                return(0);
            }
        }
Beispiel #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            this.Master.name.Text = Session["User"].ToString();
        }
        catch (Exception ex)
        {
            Response.Redirect("index.aspx");
        }
        StringBuilder   htmlTable = new StringBuilder();
        RegistrationDAL rdal      = new RegistrationDAL();


        DataSet ds = rdal.getStudent();


        htmlTable.Append("<table border='1' id='Table1' class='table table-bordered table-hover table-responsive' width='500px' height='80'>");
        htmlTable.Append("<tr style='background-color:#591919; color: White; '><th  style='text-align:center'>Course ID</th><th style='text-align:center'>Course Name</th><th style='text-align:center'>Total Enrolled Students</th></tr>");
        int j = 1000;

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            int cid   = Convert.ToInt32(ds.Tables[0].Rows[i]["Course_id"]);
            int count = rdal.getcount(cid);
            htmlTable.Append("<tr style='color: black;'>");
            htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["Course_id"] + "</td>");
            htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["Course_Name"] + "</td>");
            htmlTable.Append("<td>" + count + "</td>");



            htmlTable.Append("</tr>");
        }
        htmlTable.Append("</table>");
        DBDataPlaceHolder.Controls.Add(new Literal {
            Text = htmlTable.ToString()
        });
        lblNo.Visible = false;
        if (ds.Tables[0].Rows.Count == 0)
        {
            DBDataPlaceHolder.Visible = false;
            lblNo.Visible             = true;
        }
    }
Beispiel #17
0
        public string resendOtp(string mobileNo) //Want to change in this service as enc and dec algo
        {
            string[] uregid = mobileNo.Split('$');
            mobileNo = objenc.DecryptInteger(uregid[0], uregid[1]);

            RegistrationDAL registrationDal = new RegistrationDAL();
            string          result          = registrationDal.resendOTP(mobileNo);

            if (result != "" && result != CommonCode.WRONG_INPUT.ToString() && result != CommonCode.SQL_ERROR.ToString() && result != CommonCode.ERROR.ToString() && result != CommonCode.WRONG_INPUT.ToString())
            {
                CommonCode commoncode = new CommonCode();
                string     message    = "Dear " + mobileNo + " thanks to Register your Voter Profile in True Voter app. OTP for profile confirmation is " + result + "";
                commoncode.SMS(mobileNo, message);
                return(CommonCode.OK.ToString());
            }
            else
            {
                return(WRONG_INPUT.ToString());
            }
        }
        public List <Registration> GetRegistrationInfo(string productCode)
        {
            List <Registration> lstRegByProduct = new List <Registration>();
            DataTable           dtRegistration  = new DataTable();
            RegistrationDAL     regDAL          = new RegistrationDAL();

            dtRegistration = regDAL.RetrieveRegistrations(productCode);

            foreach (DataRow dr in dtRegistration.Rows)
            {
                Registration aRegistration = new Registration();
                aRegistration.CustomerID     = (int)dr["CustomerID"];
                aRegistration.Name           = dr["Name"].ToString(); //Name is not in Registration table, need to verify
                aRegistration.CustomerEmail  = dr["Email"].ToString();
                aRegistration.DateRegistered = (DateTime)dr["RegistrationDate"];
                lstRegByProduct.Add(aRegistration);
            }

            return(lstRegByProduct);
        }
Beispiel #19
0
        public bool Save(Registrations registration)
        {
            try
            {
                RegistrationDAL registrationDAL = new RegistrationDAL();

                if (IsContactNumberExist(registration))
                {
                    throw new Exception("Contact number already exist.");
                }
                else
                {
                    return(registrationDAL.Save(registration));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #20
0
        public bool AddNewRegistration(Registration aRegistration)
        {
            RegistrationDAL regDAL = new RegistrationDAL();

            //cast registration object into individual properties??
            int      cID   = aRegistration.CustomerID;
            string   pCode = aRegistration.ProductCode;
            DateTime rDate = aRegistration.RegistrationDate;


            bool registerProduct = regDAL.RegisterProduct(pCode, cID, rDate);

            if (registerProduct == true)
            {
                return(true);
            }
            else// if RegisterProduct() returns false, a record already exists!
            {
                return(false);
            }
        }
Beispiel #21
0
 public static ObservableCollection <Registration> ClienteRegistado()
 {
     return(RegistrationDAL.ClienteRegistado());
 }
Beispiel #22
0
        public int newProfile(string profileString, string photo)
        {
            try
            {
                string[] dataArray = profileString.Split(new char[] { '*' });
                if (dataArray.Length == 35)
                {
                    Profile userProfile = new Profile();

                    string[] uregid = dataArray[0].Split('$');
                    string   substr = uregid[0].Substring(0, 3);
                    string   ump    = uregid[0].ToString();
                    int      len    = ump.Length;
                    len = len - 3;
                    ump = ump.Substring(3, len);

                    userProfile.RegId = objenc.DecryptInteger(ump, uregid[1]);
                    userProfile.RegId = substr + userProfile.RegId;

                    //dataArray[0];
                    userProfile.dob                   = dataArray[1];
                    userProfile.email                 = dataArray[2];
                    userProfile.photo                 = photo;
                    userProfile.userType              = 1;
                    userProfile.imeiNo                = dataArray[3];
                    userProfile.registrationDate      = DateTime.Now.Date.ToString("yyyy-MM-dd");
                    userProfile.updationDate          = DateTime.Now.Date.ToString("yyyy-MM-dd");
                    userProfile.status                = 1;
                    userProfile.loginId               = "0";
                    userProfile.acno                  = dataArray[4];
                    userProfile.partNo                = dataArray[5];
                    userProfile.slnoinpart            = dataArray[6];
                    userProfile.houseNo               = dataArray[7];
                    userProfile.sectionno             = dataArray[8];
                    userProfile.fm_name_v1            = dataArray[9];
                    userProfile.Lastname_v1           = dataArray[10];
                    userProfile.RLN_TYPE              = dataArray[11];
                    userProfile.RLN_FM_NM_v1          = dataArray[12];
                    userProfile.RLN_L_NM_v1           = dataArray[13];
                    userProfile.IDCARD_NO             = dataArray[14];
                    userProfile.STATUSTYPE            = dataArray[15];
                    userProfile.SEX                   = dataArray[16];
                    userProfile.AGE                   = dataArray[17];
                    userProfile.FM_NAMEEN             = dataArray[18];
                    userProfile.LASTNAMEEN            = dataArray[19];
                    userProfile.RLN_FM_NMEN           = dataArray[20];
                    userProfile.RLN_L_NMEN            = dataArray[21];
                    userProfile.FULL_NAMEEN           = dataArray[22];
                    userProfile.EB_No                 = dataArray[23];
                    userProfile.Allocated_Ward        = dataArray[24];
                    userProfile.SerialNo_InWard       = dataArray[25];
                    userProfile.BoothNo               = dataArray[26];
                    userProfile.SerialNo_ForFinalList = dataArray[27];
                    userProfile.old_serialIn_ward     = dataArray[28];
                    userProfile.localBody             = dataArray[29];
                    userProfile.uid                   = dataArray[30];
                    userProfile.latitude              = dataArray[31];
                    userProfile.langitute             = dataArray[32];
                    userProfile.distritId             = dataArray[33];
                    userProfile.assemblyId            = dataArray[34];
                    userProfile.assemblyId            = dataArray[35]; //Added18-1-17
                    RegistrationDAL registrationDal = new RegistrationDAL();
                    return(registrationDal.addProfile(userProfile));
                }
                else
                {
                    return(CommonCode.WRONG_INPUT);
                }
            }
            catch (Exception)
            {
                return(CommonCode.ERROR);
            }
        }
Beispiel #23
0
 public RegistrationBLL(string connectionString)
 {
     data = new RegistrationDAL(connectionString);
 }
Beispiel #24
0
        public bool AddNewRegistration(Registration aRegistration)
        {
            RegistrationDAL regDAL = new RegistrationDAL();

            return(regDAL.RegisterProduct(aRegistration.ProductCode, aRegistration.CustomerID, aRegistration.RegistrationDate));
        }
        public XmlDocument GetProfile(string regId)
        {
            XmlDocument     xmlDocument     = new XmlDocument();
            RegistrationDAL registrationDal = new RegistrationDAL();

            try
            {
                string[] uregid = regId.Split('$');
                string   substr = uregid[0].Substring(0, 3);
                string   ump    = uregid[0].ToString();
                int      len    = ump.Length;
                len = len - 3;
                ump = ump.Substring(3, len);

                regId = objenc.DecryptInteger(ump, uregid[1]);
                regId = substr + regId;

                registrationDal.UserProfileData(regId);
                if (registrationDal.isError == CommonCode.OK)
                {
                    if (registrationDal.userData != null && registrationDal.userData.Tables[0].Rows.Count != 0)
                    {
                        registrationDal.userData.Tables[0].TableName = "UserProfile";
                        XmlDataDocument xmlDataDocument = new XmlDataDocument(registrationDal.userData);
                        XmlElement      element         = xmlDataDocument.DocumentElement;
                        return(xmlDataDocument);
                    }
                    else if (registrationDal.userData.Tables[0].Rows.Count == 0)
                    {
                        XmlDocument doc     = new XmlDocument();
                        XmlNode     docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
                        doc.AppendChild(docNode);

                        XmlNode errrorNode = doc.CreateElement("ErrorMainNode");
                        doc.AppendChild(errrorNode);

                        XmlNode nameNode = doc.CreateElement("Error");
                        nameNode.AppendChild(doc.CreateTextNode(CommonCode.DATA_NOT_FOUND.ToString()));
                        errrorNode.AppendChild(nameNode);
                        return(doc);
                    }
                }
                else
                {
                    XmlDocument doc     = new XmlDocument();
                    XmlNode     docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
                    doc.AppendChild(docNode);

                    XmlNode errrorNode = doc.CreateElement("ErrorMainNode");
                    doc.AppendChild(errrorNode);

                    XmlNode nameNode = doc.CreateElement("Error");
                    nameNode.AppendChild(doc.CreateTextNode(Convert.ToString(registrationDal.isError)));
                    errrorNode.AppendChild(nameNode);
                }
                return(xmlDocument);
            }
            catch
            {
                CommonCode commonCode = new CommonCode();
                return(commonCode.ErrorXml(CommonCode.SQL_ERROR));
            }
        }
Beispiel #26
0
 public static ObservableCollection <Registration> GetAll()
 {
     return(RegistrationDAL.GetAll());
 }
Beispiel #27
0
 public bool Update()
 {
     return(RegistrationDAL.Update(this));
 }
 public NinjectRegistrations()
 {
     _registrationDAL = new RegistrationDAL();
     _registrationBLL = new RegistrationBLL();
 }