protected void btnSabtEditkartabl_Click(object sender, EventArgs e)
        {
            Karmand          stu = new Karmand();
            SchoolDBEntities db  = new SchoolDBEntities();

            Karmand stuu = db.Karmands.Where(p => p.UserName == "karim").Single();

            stu.EID          = lblID.InnerText.ToInt();
            stu.FirstName    = stuu.FirstName;
            stu.LastName     = stuu.LastName;
            stu.PersonalCode = lblPersonalCode.InnerText;
            stu.UserName     = stuu.UserName;
            stu.UserPass     = stuu.UserPass;

            stu.BirthDate = string.Format("{0}{1}{2}", tbxBirthYear.Value, stuu.BirthDate.Substring(4, 2), stuu.BirthDate.Substring(6, 2));

            stu.PhoneNumber = tbxFixTel.Value;
            stu.Mobile      = tbxMobile.Value;

            stu.Email = tbxEmail.Value;

            KarmandRepository sr = new KarmandRepository();

            sr.SaveEmployees(stu);
            Response.Redirect("http://localhost:4911/Dashboard/Admin/Kartabl.aspx");
        }
        protected void btnSabtEditProfile_Click(object sender, EventArgs e)
        {
            string id = Request.QueryString["userid"];

            if (id != "" || id != null)
            {
                Karmand stuu = rep.FindByEmployeeID(id);
                Karmand kar  = new Karmand();

                kar.PersonalCode = id;
                kar.EID          = stuu.EID;;
                kar.UserName     = tbxUserName.Value;
                kar.UserPass     = tbxPassword.Value;

                kar.FirstName = tbxFirstName.Value;
                kar.LastName  = tbxLastName.Value;
                kar.BirthDate = string.Format("{0}{1}{2}", tbxBirthDay.Value.Substring(0, 4), tbxBirthDay.Value.Substring(5, 2), tbxBirthDay.Value.Substring(8, 2));

                kar.PhoneNumber = tbxFixTel.Value;
                kar.Mobile      = tbxMobile.Value;

                //stu.Email = tbxEmail.Value;

                rep.SaveEmployees(kar);
                Response.Redirect("http://localhost:4911/Dashboard/Admin/Employees.aspx");
            }
        }
Beispiel #3
0
        protected void btnSabtEditProfile_Click(object sender, EventArgs e)
        {
            if (Session["useridForEditEmployee"] != null)
            {
                string  id   = Session["useridForEditEmployee"].ToString();
                Karmand stuu = rep.FindByEmployeeID(id);
                Karmand kar  = new Karmand();

                kar.PersonalCode = id;
                kar.EID          = stuu.EID;;
                kar.UserName     = tbxUserName.Value;
                kar.UserPass     = tbxPassword.Value;

                kar.FirstName = tbxFirstName.Value;
                kar.LastName  = tbxLastName.Value;
                kar.BirthDate = string.Format("{0}{1}{2}", tbxBirthDay.Value.Substring(0, 4), tbxBirthDay.Value.Substring(5, 2), tbxBirthDay.Value.Substring(8, 2));

                kar.PhoneNumber = tbxFixTel.Value;
                kar.Mobile      = tbxMobile.Value;

                //stu.Email = tbxEmail.Value;

                rep.SaveEmployees(kar);
                Response.Redirect("http://localhost:4911/Dashboard/Admin/Employees.aspx");
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Admin/News.aspx'", true);
            }
        }
        public void LoadEmployees()
        {
            KarmandRepository sr = new KarmandRepository();

            gvEmployees.DataSource = sr.GetAllEmployees();
            gvEmployees.DataBind();
            Karmand st = new Karmand();

            tbxSearch.Value = "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SchoolDBEntities db = new SchoolDBEntities();

                Karmand stuu = db.Karmands.Where(p => p.UserName == "moosa").Single();
                imgUserPic.Src = stuu.Image;
            }
        }
        public void DeleteEmployee(string EID)
        {
            SchoolDBEntities pb = conn.GetContext();

            Karmand selectedEmployee = pb.Karmands.Where(p => p.PersonalCode == EID).Single();

            if (selectedEmployee != null)
            {
                pb.Karmands.Remove(selectedEmployee);
                pb.SaveChanges();
            }
        }
        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            SchoolDBEntities db = new SchoolDBEntities();

            Karmand stuu = db.Karmands.Where(p => p.UserName == "karim").Single();

            if (tbxCurrentPassword.Value == stuu.UserPass)
            {
                stuu.UserPass = tbxNewPassword.Value;
                db.SaveChanges();
            }
        }
        private void LoadKrmand()
        {
            Karmand stu = kr.FindByUserName("karim");

            lblID.InnerText           = stu.EID.ToString();
            lblPersonalCode.InnerText = stu.PersonalCode.ToString();
            lblFirstName.InnerText    = stu.FirstName;
            lblLastName.InnerText     = stu.LastName;

            tbxBirthYear.Value = stu.BirthDate.Substring(0, 4);

            tbxFixTel.Value = stu.PhoneNumber;
            tbxMobile.Value = stu.Mobile;
            tbxEmail.Value  = stu.Email;
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Karmand stu = kr.FindByUserName("moosa");

            lblID.InnerText           = stu.EID.ToString();
            lblPersonalCode.InnerText = stu.PersonalCode.ToString();
            lblFirstName.InnerText    = stu.FirstName;
            lblLastName.InnerText     = stu.LastName;

            lblBirthYear.InnerText = stu.BirthDate.Substring(0, 4);

            lblFixTel.InnerText = stu.PhoneNumber;
            lblMobile.InnerText = stu.Mobile;
            lblEmail.InnerText  = stu.Email;

            imgUserPic.Src = stu.Image;
        }
        public void load()
        {
            string id = Request.QueryString["userid"];

            if (id != "" || id != null)
            {
                Karmand lo = rep.FindByEmployeeID(id);
                tbxFirstName.Value    = lo.FirstName;
                tbxLastName.Value     = lo.LastName;
                lblPersonalCode.Value = lo.PersonalCode;
                tbxBirthDay.Value     = string.Format("{0}/{1}/{2}", lo.BirthDate.Substring(0, 4), lo.BirthDate.Substring(4, 2), lo.BirthDate.Substring(6, 2));
                tbxUserName.Value     = lo.UserName;
                tbxPassword.Value     = lo.UserPass;
                tbxFixTel.Value       = lo.PhoneNumber;
                tbxMobile.Value       = lo.Mobile;

                //tbxEmail.Value = lo.Email;
            }
        }
        public void SaveEmployees(Karmand kramand)
        {
            using (SchoolDBEntities pb = conn.GetContext())
            {
                if (kramand.EID > 0)
                {
                    //==== UPDATE ====
                    pb.Karmands.Attach(kramand);
                    pb.Entry(kramand).State = EntityState.Modified;
                }
                else
                {
                    //==== INSERT ====
                    pb.Karmands.Add(kramand);
                }

                pb.SaveChanges();
            }
        }
        protected void btnSabtEditProfile_Click(object sender, EventArgs e)
        {
            Karmand kar = new Karmand();

            kar.UserName = tbxUserName.Value;
            kar.UserPass = tbxPassword.Value;

            kar.PersonalCode = tbxPersonalCode.Value;

            kar.FirstName = tbxFirstName.Value;
            kar.LastName  = tbxLastName.Value;
            kar.BirthDate = string.Format("{0}{1}{2}", tbxBirthDay.Value.Substring(0, 4), tbxBirthDay.Value.Substring(5, 2), tbxBirthDay.Value.Substring(8, 2));

            kar.PhoneNumber = tbxFixTel.Value;
            kar.Mobile      = tbxMobile.Value;

            // kar.Email = tbxEmail.Value;

            rep.SaveEmployees(kar);
            Response.Redirect("http://localhost:4911/Dashboard/Admin/Employees.aspx");
        }
Beispiel #13
0
        public void load()
        {
            if (Session["useridForEditEmployee"] != null)
            {
                string  id = Session["useridForEditEmployee"].ToString();
                Karmand lo = rep.FindByEmployeeID(id);
                tbxFirstName.Value    = lo.FirstName;
                tbxLastName.Value     = lo.LastName;
                lblPersonalCode.Value = lo.PersonalCode;
                tbxBirthDay.Value     = string.Format("{0}/{1}/{2}", lo.BirthDate.Substring(0, 4), lo.BirthDate.Substring(4, 2), lo.BirthDate.Substring(6, 2));
                tbxUserName.Value     = lo.UserName;
                tbxPassword.Value     = lo.UserPass;
                tbxFixTel.Value       = lo.PhoneNumber;
                tbxMobile.Value       = lo.Mobile;

                //tbxEmail.Value = lo.Email;
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('شما با آدرس اشتباه وارد شده اید ! ');window.location ='http://localhost:4911/Dashboard/Admin/News.aspx'", true);
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {//D:\Projects\SchoolSmartSystem\New folder\OnlineSchool\WebPages\Dashboard\Images\3408.jpg
                string strname = FileUpload1.FileName.ToString();

                string FileName = System.IO.Path.GetFileName(FileUpload1.FileName);
                string path     = Server.MapPath("/Dashboard/Images/") + FileName;
                FileUpload1.PostedFile.SaveAs(path);
                imgUserPic.Src = "/Dashboard/Images/" + FileName;
                KarmandRepository sr = new KarmandRepository();

                SchoolDBEntities db = new SchoolDBEntities();

                Karmand stuu = db.Karmands.Where(p => p.UserName == "moosa").Single();

                stuu.Image = "/Dashboard/Images/" + strname;
                db.SaveChanges();
            }
            else
            {
            }
        }
        protected void gvEmployees_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                // Retrieve the row index stored in the
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                // Retrieve the row that contains the button
                // from the Rows collection.
                GridViewRow row = gvEmployees.Rows[index];

                Response.Redirect("http://*****:*****@"<script type='text/javascript'>");
                    sb.Append("$('#modalShowDetails').modal('show');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript", sb.ToString(), false);
                }
            }
            if (e.CommandName == "Delet")
            {
                // Retrieve the row index stored in the
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                // Retrieve the row that contains the button
                // from the Rows collection.
                GridViewRow row = gvEmployees.Rows[index];

                // KarmandRepository rep = new KarmandRepository();

                //rep.DeleteEmployee(row.Cells[0].Text);
                SchoolDBEntities db = new SchoolDBEntities();
                Karmand          k  = new Karmand();
                string           a  = row.Cells[0].Text;
                k = db.Karmands.Where(p => p.PersonalCode == a).Single();
                db.Karmands.Remove(k);
                db.SaveChanges();
                LoadEmployees();
            }
        }