Ejemplo n.º 1
0
        protected void EditAction(string eventType, object record)
        {
            try
            {
                partiDB.GetUsers            claUsers = new partiDB.GetUsers();
                Dictionary <string, object> KeyVal   = record as Dictionary <string, object>;

                Parallel.ForEach(KeyVal, key =>
                {
                    if (key.Key == "id")
                    {
                        claUsers.id = (int)key.Value;
                    }
                    else if (key.Key == "username")
                    {
                        claUsers.username = (string)key.Value;
                    }
                    else if (key.Key == "passwd")
                    {
                        claUsers.passwd = (string)key.Value;
                    }
                    else if (key.Key == "rules")
                    {
                        claUsers.rules = (string)key.Value;
                    }
                });

                if (eventType == "endAdd")
                {
                    //wcf add users
                    wcf.parti.Service1 _parti = new wcf.parti.Service1();
                    var result = _parti.EditUsers("add", claUsers.id, true, claUsers.username, enCoding.SetEncryptData(claUsers.passwd), claUsers.rules);
                    ReloadData(result);
                }
                else if (eventType == "endEdit")
                {
                    //wcf update data
                    wcf.parti.Service1 _parti = new wcf.parti.Service1();
                    var result = _parti.EditUsers("edit", claUsers.id, true, claUsers.username, enCoding.SetEncryptData(claUsers.passwd), claUsers.rules);
                    ReloadData(result);
                }
                else if (eventType == "endDelete")
                {
                    //delete data
                    wcf.parti.Service1 _parti = new wcf.parti.Service1();
                    var result = _parti.EditUsers("del", claUsers.id, true, claUsers.username, enCoding.SetEncryptData(claUsers.passwd), claUsers.rules);
                    ReloadData(result);
                }
            }
            catch (Exception ex)
            {
                MessageBox.swalModal(this.Page, "error", "en:internal error[" + ex.Message.Replace("'", "") + "]", "");
            }
        }
Ejemplo n.º 2
0
        protected void btnChangePWD_ServerClick(object sender, EventArgs e)
        {
            string rResult = "";
            string rAction = "";

            try
            {
                wcf.parti.Service1 _parti = new wcf.parti.Service1();
                var result = _parti.EditUsers("edit", Convert.ToInt32(Session["tid"].ToString()), true, Session["username"].ToString(),
                                              enCoding.SetEncryptData(txtPWDNew2.Value), Session["rules"].ToString());
                if (result == "e5")
                {
                    rResult = "ລະຫັດຜ່ານຂອງທ່ານໄດ້ຖືກປ່ຽນແປງຮຽບຮ້ອຍແລ້ວ..., ກະລຸນາອອກຈາກລະບົບແລ້ວເຂົ້າໃຫມ່.";
                    rAction = "success";
                }
                else if (result == "e2")
                {
                    rResult = "e2:ບໍ່ສາມາດເຊື່ອມຕໍ່ຖານຂໍ້ມູນໄດ້.";
                    rAction = "error";
                }
                else if (result == "e1")
                {
                    rResult = "e1:ບໍ່ມີຂໍ້ມູນທີ່ຈະສະແດງ.";
                    rAction = "info";
                }
                else if (result == "e0")
                {
                    rResult = "e0:ລະບົບຂັດຂ້ອງຕິດຕໍ່ຜູ້ເບີ່ງແຍ່ງດ່ວນ.";
                    rAction = "error";
                }
                MessageBox.swalModal(this.Page, rAction, rResult, "");
            }
            catch (Exception ex)
            {
                MessageBox.swalModal(this.Page, "error", "en:internal error[" + ex.Message.Replace("'", "") + "]", "");
            }
        }