protected void Button1_Click(object sender, EventArgs e)
    {
        DBmanager         dm    = new DBmanager();
        encryptionmanager em    = new encryptionmanager();
        string            epass = em.encryptmydata(txtpass.Text);
        string            code  = "select * from tbl_login where userid='" + txtuid.Text + "' and pass='******' and status=true";
        DataTable         dt    = dm.executemyselect(code);

        if (dt.Rows.Count > 0)
        {
            code = "update tbl_login set lcount=(lcount+1) , logintime='" + DateTime.Now.ToString() + "' where userid='" + txtuid.Text + "' and pass='******'";
            bool x = dm.executemyinsertupdateordelete(code);
            if (x == true)
            {
                Session["userid"] = txtuid.Text;
                Response.Redirect("~/UserZone/Home.aspx");
            }
            else
            {
                Response.Write("<script>alert('Unable to login!');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('Invalid UserID or Password!');</script>");
        }
    }
        public ActionResult AddStudent(StudentView ViewStudent)
        {
            string    strSQL;
            DBmanager db = new DBmanager();
            bool      booRet;
            DataTable dt = new DataTable();

            strSQL  = " Select * from GUI_Subject ";
            strSQL += " Where SubjectName = " + db.SQL_SetString(ViewStudent.View_Subject.SubjectName);

            booRet = db.SQL_Query(strSQL, ref dt);
            if (booRet == false)
            {
                log = "stop";
            }
            ViewStudent.View_Students.SubjectCode = dt.Rows[0].Field <string>("SubjectCode");


            booRet = db.SQL_ExeGui_Student(ViewStudent.View_Students);
            if (booRet == false)
            {
                log = "stop";
            }
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// ExecuteProcedure spLocal_CJLR_LogAction
        /// </summary>
        /// <param name="statement"></param>
        /// <param name="inputParameters"></param>
        /// <returns></returns>
        public string LogAction(string cFunction, string cDescription, DateTime dDate)
        {
            var result = "";
            List <Parameter> parInputs = new List <Parameter>()
            {
                new Parameter()
                {
                    Name = "@cFunction", Value = new CrudItem(0, cFunction)
                },
                new Parameter()
                {
                    Name = "@cDescription", Value = new CrudItem(0, cDescription)
                },
                new Parameter()
                {
                    Name = "@dDate", Value = new CrudItem(0, dDate)
                }
            };

            try
            {
                DBmanager.ExecuteProcedure("spLocal_CJLR_LogAction", parInputs);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
            return(result);
        }
        public IEnumerable <string> GetProductionLines(string plantName)
        {
            List <string> productionLines = new List <string>();

            try
            {
                string           storedProcedureName = "uspWip_GetProductionLines";
                List <Parameter> inputParams         = new List <Parameter>();
                inputParams.Add(new Parameter("@plantName", new CrudItem(1, plantName)));
                var spResult = DBmanager.ExecuteProcedure(storedProcedureName, inputParams);
                if (spResult != null)
                {
                    for (var i = 0; i < spResult.FirstTable.Rows.Count; i++)
                    {
                        productionLines.Add(spResult.FirstTable.Rows[i]["S95Id"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                this.ServiceDirManager.ILog.Error("Error at GetProductionLines: \n" + ex.Message);
            }

            return(productionLines);
        }
Example #5
0
        public ActionResult EditEducations(Educations education)
        {
            DBmanager dBmanager = new DBmanager();

            dBmanager.UpdateEducations(education);
            return(RedirectToAction("EditExperiences"));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["userid"] != null)
     {
         if (IsPostBack == false)
         {
             string                cmd = "select uname,profilepic from tbl_registration where emailid='" + Session["userid"].ToString() + "'";
             DBmanager             dm  = new DBmanager();
             System.Data.DataTable dt  = dm.executemyselect(cmd);
             if (dt.Rows.Count > 0)
             {
                 lbltext.Text = "WELCOME!";
                 if (dt.Rows[0][0] != "")
                 {
                     lbluser.Text = dt.Rows[0][0].ToString();
                 }
             }
             else
             {
                 lbluser.Text = "User";
             }
             if (dt.Rows[0][1] != "")
             {
                 imgpro.ImageUrl = "~/useruploads/" + dt.Rows[0][1].ToString();
             }
         }
     }
     else
     {
         Response.Redirect("~/login.aspx");
     }
 }
Example #7
0
        private void btnCreateNew_Click(object sender, EventArgs e)
        {
            SaveFileDialog sd = new SaveFileDialog();

            sd.Title = "Creazione nuovo database ingressi RBM21";
            //sd.InitialDirectory = @"C:\";
            sd.DefaultExt      = ".sqlite";
            sd.OverwritePrompt = false;
            sd.Filter          = "RBM21 database (*.sqlite)|*.sqlite";
            if (sd.ShowDialog() == DialogResult.OK)
            {
                if (!File.Exists(sd.FileName))
                {
                    //if file didn't exists, open a new database there (DBmanager constructor will handle that)
                    DBmanager dbm = new DBmanager(sd.FileName);
                    dbm.Close();
                    MessageBox.Show("Operazione completata con successo.\r\nIl database " + sd.FileName + " è stato creato. Per utilizzarlo, utilizzare il pulsante \"cambia\".",
                                    "Operazione completata",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                //if file aleady exists, do nothing and warn the user.
                else
                {
                    MessageBox.Show("Esiste gia un database nella posizione " + sd.FileName + "\r\nPer creare un nuovo database, specificare un nuovo nome.",
                                    "Operazione non riuscita",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
        public IActionResult Index(string message)
        {
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            DBmanager.AddMessageInfo(message, userId);
            return(RedirectToAction(nameof(Index)));
        }
Example #9
0
        public ActionResult DetailExp(int id)
        {
            DBmanager   manager    = new DBmanager();
            Experiences experience = manager.GetByExp(id);

            return(View(experience));
        }
    protected void btnchange_Click(object sender, EventArgs e)
    {
        encryptionmanager em       = new encryptionmanager();
        string            ecurpass = em.encryptmydata(txtcurrpass.Text);
        string            enewpass = em.encryptmydata(txtnewpass.Text);
        string            cmd      = "update tbl_login set pass='******' where userid='" + Session["userid"].ToString() + "' and pass='******'";
        DBmanager         dm       = new DBmanager();
        bool x = dm.executemyinsertupdateordelete(cmd);

        if (x == true)
        {
            Response.Write("<script>alert('Password updated successfully!')</script>");

            txtconpass.Text  = " ";
            txtnewpass.Text  = " ";
            txtcurrpass.Text = " ";
        }
        else
        {
            Response.Write("<script>alert('Password not changed.')</script>");
            txtconpass.Text  = " ";
            txtnewpass.Text  = " ";
            txtcurrpass.Text = " ";
        }
    }
Example #11
0
        public ActionResult DetailEdu(int id)
        {
            DBmanager  manager   = new DBmanager();
            Educations education = manager.GetByEdu(id);

            return(View(education));
        }
Example #12
0
        public ActionResult EditExperiences(Experiences experience)
        {
            DBmanager dBmanager = new DBmanager();

            dBmanager.UpdateExperiences(experience);
            return(RedirectToAction("Index"));
        }
Example #13
0
        public ActionResult CreateExperience()
        {
            DBmanager        dBmanager        = new DBmanager();
            BasicInformation basicInformation = dBmanager.GetBasicInformationID();

            return(View(basicInformation));
        }
Example #14
0
        public ActionResult CreateExperience(Experiences basicInformation)
        {
            DBmanager dBmanager = new DBmanager();

            dBmanager.CreateExperience(basicInformation);
            return(RedirectToAction("Index"));
        }
Example #15
0
        public ActionResult DeleteCard(int id)
        {
            DBmanager dBmanager = new DBmanager();

            dBmanager.DeleteCardById(id);
            return(RedirectToAction("Index"));
        }
Example #16
0
        public ActionResult CreateEducation(Educations BasicInformation)
        {
            DBmanager dB = new DBmanager();

            dB.CreateEducation(BasicInformation);
            return(RedirectToAction("CreateExperience"));
        }
Example #17
0
        public ActionResult EditCard(BasicInformation basicInformation)
        {
            DBmanager dBmanager = new DBmanager();

            dBmanager.UpdateCard(basicInformation);
            return(RedirectToAction("Index"));
        }
Example #18
0
        public ActionResult DeleteLeave(int 序號)
        {
            DBmanager dbmanager = new DBmanager();

            dbmanager.DeleteLeaveById(序號);
            return(RedirectToAction("Index"));
        }
Example #19
0
        public ActionResult EditLeave(int 序號)
        {
            DBmanager  dbmanager = new DBmanager();
            LeaveTable leave     = dbmanager.GetLeaveById(序號);

            return(View(leave));
        }
Example #20
0
        public ActionResult SearchLeaveView(string 員編)
        {
            DBmanager         dbmanager   = new DBmanager();
            List <LeaveTable> leaveTables = dbmanager.SearchLeaveById(員編);

            ViewBag.leaveTables = leaveTables;
            return(View(leaveTables));
        }
Example #21
0
        public ActionResult Index()
        {
            DBmanager         dbmanager   = new DBmanager();
            List <LeaveTable> leaveTables = dbmanager.GetLeaveTable();

            ViewBag.leaveTables = leaveTables;
            return(View());
        }
Example #22
0
 // TODO: шифрование.
 // TODO: регистрация пользователей в бд.
 // TODO: ещё одна форма для входа.
 // TODO: переписать под эвенты.
 static void Main(string[] args)
 {
     Console.WriteLine("ver 0.4.1");
     // Создаём возможно отсутствующие объекты в бд.
     DBmanager.Initialize();
     // Ждём пользователей в бесконечном цикле.
     ServerEngine.Listen();
 }
Example #23
0
        // GET: DbTest
        public ActionResult Index()
        {
            DBmanager     dBmanager = new DBmanager();
            List <Member> members   = dBmanager.GetMembers();

            ViewBag.members = members;
            return(View());
        }
Example #24
0
        public void TestMethod_removeManager()
        {
            Setup();
            DBmanager checkDB = db.Db;

            checkDB.addNewManager(manager);
            db.removeManagerDB(manager.User.Id);
            List <KeyValuePair <int, string> > output = checkDB.getManegerByUserID(manager.User.Id);
        }
Example #25
0
        public void TestMethod_AddProductToCart()
        {
            Setup();

            db.AddProductToCart(admin.Basket.ShoppingCarts[store.Id].Products, admin.Id);
            DBmanager checkDB = new DBmanager(false);

            Assert.AreEqual(1, checkDB.getProductInCartquntity(admin.Id, store.Id, p1.Id));
        }
Example #26
0
        public void TestMethod_register()
        {
            Setup();
            db.registerNewUserDB(admin);
            DBmanager checkDB = db.Db;

            Assert.AreEqual("guti", checkDB.getUser(admin.Id).UserName);
            Assert.AreEqual(1, checkDB.getProductInCartquntity(admin.Id, store.Id, p1.Id));
        }
Example #27
0
        public void TestMethod_assignOwner()
        {
            Setup();
            db.assignOwner(adminOwner);
            DBmanager checkDB = db.Db;

            Assert.AreEqual(store.Id, checkDB.getAllOwnerDBbyUserID(admin.Id)[0]);
            checkDB.removeOwner(admin.Id);
        }
Example #28
0
        public void TestMethod_removeUser()
        {
            Setup();
            DBmanager checkDB = db.Db;

            checkDB.addNewUser(admin);
            db.removeUserDB(admin.Id);
            Assert.AreEqual(null, checkDB.getUser(admin.Id));
        }
Example #29
0
    protected void imgregister_Click(object sender, ImageClickEventArgs e)
    {
        string gender = "";

        if (rdbmale.Checked == true)
        {
            gender = "Male";
        }
        else
        {
            gender = "Female";
        }
        if (txtcaptcha.Text == ccode)
        {
            DBmanager dm   = new DBmanager();
            string    code = "select * from tbl_login where userid='" + txtemail.Text + "' ";
            DataTable dt   = dm.executemyselect(code);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('Email ID already REGISTERED!');</script>");
                txtemail.Text = "";
            }
            else
            {
                string            epass, nullcode = "no value";
                encryptionmanager em = new encryptionmanager();
                epass = em.encryptmydata(txtpass.Text);

                string mycommand = "insert into tbl_registration values('" + txtname.Text + "','" + gender + "','" + txtcontact.Text + "','" + txtemail.Text + "','" + txtaddress.Text + "','" + txtqual.Text + "','" + txtcollege.Text + "','" + ddlyear.SelectedValue + "','" + txtcurrjob.Text + "','" + epass + "','" + profilepic.FileName + "','" + DateTime.Now.ToLongDateString() + "','" + DateTime.Now.ToLongTimeString() + "','" + nullcode + "','" + nullcode + "','" + nullcode + "')";
                bool   b         = dm.executemyinsertupdateordelete(mycommand);
                if (b == true)
                {
                    mycommand = "insert into tbl_login values('" + txtemail.Text + "','" + epass + "',true,0,'')";
                    b         = dm.executemyinsertupdateordelete(mycommand);
                    if (b == true)
                    {
                        profilepic.SaveAs(Server.MapPath("~/useruploads/" + profilepic.FileName));
                        Response.Write("<script>alert('You Are Registered Successfully!');</script>");
                        Response.Redirect("Detail.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('Unable To Set Login Details!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('Sorry! Unable To Register.');</script>");
                }
            }
        }
        else
        {
            Response.Write("<script>alert('INVALID Captcha Code!');</script>");
        }
    }
Example #30
0
        public ActionResult Index(int page = 1)
        {
            DBmanager          dBmanager = new DBmanager();
            List <PTTDATAtype> cards     = dBmanager.GetPTTDATA();

            ViewBag.MyPageList = cards.ToPagedList(page, 25);


            return(View());
        }