示例#1
0
        private async Task <int> UpdateUserAsync(dlgUser dlg, string login)
        {
            User.UserRole R = User.UserRole.Rodzic; // = (User.UserRole)Enum.Parse(typeof(User.UserRole), dlg.cbRola.SelectedValue.ToString());
            Enum.TryParse(dlg.cbRola.SelectedValue.ToString(), out R);
            var sqlParamWithValue = new Dictionary <string, object>()
            {
                { "@Login", login },
                { "@Nazwisko", dlg.txtNazwisko.Text.Trim() },
                { "@Imie", dlg.txtImie.Text.Trim() },
                { "@Rola", R },
                { "@Email", dlg.txtEmail.Text.Trim() },
                { "@Status", dlg.chkStatus.Checked },
                { "@Sex", dlg.chkSex.Checked },
                { "@User", UserSession.User.Login },
                { "@IP", AppSession.HostIP }
            };

            using (var scope = AppSession.TypeContainer.BeginLifetimeScope())
            {
                var dbs = scope.Resolve <IDataBaseService>();
                return(await dbs.UpdateRecordAsync(UserSQL.UpdateUser(), sqlParamWithValue));
            }
        }