Beispiel #1
0
        public void Insert(string UserName, int?RoleId, string UserCode)
        {
            LUser item = new LUser();

            item.UserName = UserName;

            item.RoleId = RoleId;

            item.UserCode = UserCode;


            item.Save(UserName);
        }
Beispiel #2
0
 public static void UpdateDoctor(LUser pitems)
 {
     try
     {
         if (LUser.FetchByID(pitems.UserId) != null)
         {
             pitems.IsNew = false;
             pitems.Save();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
        public void Update(decimal UserId, string UserName, int?RoleId, string UserCode)
        {
            LUser item = new LUser();

            item.MarkOld();
            item.IsLoaded = true;

            item.UserId = UserId;

            item.UserName = UserName;

            item.RoleId = RoleId;

            item.UserCode = UserCode;

            item.Save(UserName);
        }
Beispiel #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                {
                    switch (vAction)
                    {
                    case action.Insert:
                        var obj = new LUser();
                        obj.UserName = Utility.sDbnull(txtName.Text);
                        obj.UserCode = Utility.sDbnull(cboUserName.Text);
                        obj.IsNew    = true;
                        obj.Save();

                        drList = dtList.NewRow();
                        drList[LUser.Columns.UserId] = LUser.CreateQuery().GetMax(LUser.Columns.UserId);
                        ApplyData2Datarow();
                        dtList.Rows.InsertAt(drList, 0);
                        dtList.AcceptChanges();

                        txtID.Text = Utility.sDbnull(drList[LUser.Columns.UserId]);
                        vAction    = action.Update;
                        break;

                    case action.Update:
                        new Update(LUser.Schema.Name).Set(LUser.Columns.UserName).EqualTo(txtName.Text).
                        Set(LUser.Columns.UserCode).EqualTo(Utility.sDbnull(cboUserName.Text)).
                        Where(LUser.Columns.UserId).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).
                        Execute();
                        ApplyData2Datarow();
                        drList.AcceptChanges();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                    switch (vAction)
                    {
                        case action.Insert:
                            var obj = new LUser();
                            obj.UserName = Utility.sDbnull(txtName.Text);
                            obj.UserCode = Utility.sDbnull(cboUserName.Text);
                            obj.IsNew = true;
                            obj.Save();

                            drList = dtList.NewRow();
                            drList[LUser.Columns.UserId] = LUser.CreateQuery().GetMax(LUser.Columns.UserId);
                            ApplyData2Datarow();
                            dtList.Rows.InsertAt(drList, 0);
                            dtList.AcceptChanges();

                            txtID.Text = Utility.sDbnull(drList[LUser.Columns.UserId]);
                            vAction = action.Update;
                            break;
                        case action.Update:
                            new Update(LUser.Schema.Name).Set(LUser.Columns.UserName).EqualTo(txtName.Text).
                                Set(LUser.Columns.UserCode).EqualTo(Utility.sDbnull(cboUserName.Text)).
                                Where(LUser.Columns.UserId).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).
                                Execute();
                            ApplyData2Datarow();
                            drList.AcceptChanges();
                            break;
                    }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Beispiel #6
0
        public static string InsertDoctor(LUser pitems)
        {
            int   i        = 0;
            Query _QueryRS = LUser.CreateQuery();

            try
            {
                if (!LUser.FetchByParameter(LUser.Columns.UserId, Comparison.Equals, pitems.UserId).Read())
                {
                    pitems.IsNew = true;
                    pitems.Save(i);
                    return(_QueryRS.GetMax(LUser.Columns.UserId).ToString());
                }
                else
                {
                    return("-1");
                    //throw new Exception(string.Format("Name:{0} Đã tồn tại", pitems.IPAddress));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #7
0
        public void Insert(string UserName,int? RoleId,string UserCode)
        {
            LUser item = new LUser();

            item.UserName = UserName;

            item.RoleId = RoleId;

            item.UserCode = UserCode;

            item.Save(UserName);
        }
Beispiel #8
0
        public void Update(decimal UserId,string UserName,int? RoleId,string UserCode)
        {
            LUser item = new LUser();
            item.MarkOld();
            item.IsLoaded = true;

            item.UserId = UserId;

            item.UserName = UserName;

            item.RoleId = RoleId;

            item.UserCode = UserCode;

            item.Save(UserName);
        }