Esempio n. 1
0
        public bool Insert_Staff(System_DTO account, Staff_DTO staff)
        {
            string query = "exec USP_AddStaff @username , @password , @role , @displayname , @sex , @birthday , @address , @phone , @email , @image";
            int    x     = (int)Connect.Instance.ExecuteOutPut(query, new object[] { account.Username, account.Password, account.Id_type, staff.Name, staff.Sex, staff.Birthday, staff.Address, staff.Phone, staff.Email, staff.Image });

            return(x == 2);
        }
Esempio n. 2
0
 public int InsertByTableName(string tablename, System_DTO entity)
 {
     sysRep.AddInputParameters("@tablename", tablename);
     sysRep.AddInputParameters("@code", entity.code);
     sysRep.AddInputParameters("@title", entity.title);
     if (tablename == "tbl_Position")
     {
         sysRep.AddInputParameters("@status", entity.status);
     }
     return(sysRep.IUD("sp_Rows_InsertByTableName", CommandType.StoredProcedure));
 }
Esempio n. 3
0
 public ActionResult SaveChanges(string tableName, System_DTO entity)
 {
     if (ModelState.IsValid)
     {
         sysServ.UpdateByTableName(tableName, entity);
         return(Json(new { mesaj = "Redaktə edildi" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { mesaj = "Məlumatları düzgün doldurun!!!" }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 4
0
 public ActionResult SaveRecord(string tableName, System_DTO entity)
 {
     if (ModelState.IsValid)
     {
         sysServ.InsertByTableName(tableName, entity);
         return(Json(new { mesaj = "Əlavə olundu" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { mesaj = "Məlumatları düzgün doldurun!!!" }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 5
0
 public bool Insert_Staff(System_DTO account, Staff_DTO staff)
 {
     try
     {
         MD5    md5          = MD5.Create();
         string password_md5 = Function_Other.Instance.GetMd5Hash(md5, account.Password);
         account.Password = password_md5;
         return(Staff_DAO.Instance.Insert_Staff(account, staff));
     }
     catch (System.Data.SqlClient.SqlException e)
     {
         throw new Exception("Error!");
     }
 }
Esempio n. 6
0
 public bool Check_pass_old(string username, string pass_old)
 {
     try
     {
         System_DTO account      = System_DAO.Instance.Get_Account(username);
         MD5        md5          = MD5.Create();
         string     password_md5 = GetMd5Hash(md5, pass_old);
         return(password_md5 == account.Password);
     }
     catch
     {
         throw new Exception("Error!");
     }
 }
Esempio n. 7
0
        public System_DTO Get_Account(string username)
        {
            string query = "exec USP_GetAccount @username";

            DataTable account_info = Connect.Instance.ExecuteQuery(query, new object[] { username });

            System_DTO account = null;

            foreach (DataRow item in account_info.Rows)
            {
                account = new System_DTO(item);
            }

            return(account);
        }
Esempio n. 8
0
        public List <System_DTO> Get_List_Staff_Service()
        {
            string query = "exec USP_GetList_Staff_Service";

            DataTable list = Connect.Instance.ExecuteQuery(query);

            List <System_DTO> list_staff = new List <System_DTO>();

            foreach (DataRow item in list.Rows)
            {
                System_DTO account = new System_DTO(item);
                list_staff.Add(account);
            }

            return(list_staff);
        }
Esempio n. 9
0
        public System_DTO GetSingleRecord(string tablename, int id)
        {
            sysRep.AddInputParameters("@tablename", tablename);
            sysRep.AddInputParameters("@id", id);
            DataTable  dt        = sysRep.GetList("sp_SingleRow_GetByID", CommandType.StoredProcedure);
            System_DTO singleRow = new System_DTO();

            singleRow.id    = Convert.ToInt32(dt.Rows[0]["id"]);
            singleRow.title = dt.Rows[0]["title"].ToString();
            singleRow.code  = dt.Rows[0]["code"].ToString();
            singleRow.table = tablename;
            if (tablename == "tbl_Position")
            {
                singleRow.status = Convert.ToInt32(dt.Rows[0]["status"]);
            }
            return(singleRow);
        }
Esempio n. 10
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            bool flat = true;

            if (txt_password.Text == "" || cb_role.SelectedIndex == -1 || txt_name.Text == "" || txt_phone.Text == "" || txt_address.Text == "" || txt_email.Text == "" || cb_sex.SelectedIndex == -1)
            {
                MessageBox.Show("Error!");
                flat = false;
                return;
            }
            try
            {
                var addr = new System.Net.Mail.MailAddress(txt_email.Text);
                flat = true;
            }
            catch
            {
                MessageBox.Show("Email is not exists", "Error validate", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                flat = false;
                return;
            }


            if (txt_phone.Text.Length != 11 && txt_phone.Text.Length != 10)
            {
                MessageBox.Show("Phone is not exist!", "Error validate", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                flat = false;
                return;
            }

            System_DTO account = new System_DTO();

            account.Username = txt_username.Text;
            account.Password = txt_password.Text;
            account.Id_type  = cb_role.SelectedIndex;

            Staff_DTO staff = new Staff_DTO();

            staff.Username = txt_username.Text;
            staff.Name     = txt_name.Text;
            if (cb_sex.SelectedIndex == 1)
            {
                staff.Sex = true;
            }
            else
            {
                staff.Sex = false;
            }
            staff.Birthday = dtp_birthday.Value;
            staff.Address  = txt_address.Text;
            staff.Phone    = txt_phone.Text;
            staff.Email    = txt_email.Text;

            if (this.filename != null)
            {
                staff.Image = this.CovertImage();
            }
            else
            {
                MessageBox.Show("You must upload image!");
                return;
            }

            if (Staff_BUS.Instance.Check_Email(txt_email.Text) == false)
            {
                if (Staff_BUS.Instance.Insert_Staff(account, staff))
                {
                    MessageBox.Show("Add satff is success!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Error!");
                }
            }
            else
            {
                MessageBox.Show("Email was exists in system!");
                return;
            }
        }
Esempio n. 11
0
 private void fChange_pass_Load(object sender, EventArgs e)
 {
     txt_username.Text = this.Username;
     txt_pass_old.Focus();
     this.account = System_BUS.Instance.Get_Account(this.Username);
 }