Exemplo n.º 1
0
        protected Canon.Data.User CollectNewDataFromForm(int key, OrderedDictionary oldValues,
                                                         OrderedDictionary newValues, bool isNew)
        {
            Canon.Data.User cc = new Canon.Data.User();
            if (!isNew)
            {
                cc.UserId = key;
            }
            cc.UserName = newValues["UserName"].ToString();
            cc.FullName = newValues["FullName"].ToString();
            cc.Email    = newValues["Email"].ToString();
            if (!isNew)
            {
                string oldPassword = oldValues["Password"].ToString();
                string newPassword = newValues["Password"].ToString();
                if (oldPassword != newPassword)
                {
                    cc.Password = newValues["Password"].ToString();
                }
            }
            else
            {
                cc.Password = newValues["Password"].ToString();
            }

            // is active
            if (newValues["IsActive"] != null)
            {
                cc.IsActive = (bool)newValues["IsActive"];
            }
            else
            {
                cc.IsActive = false;
            }

            return(cc);
        }
Exemplo n.º 2
0
        protected Canon.Data.User CollectNewDataFromForm(int key, OrderedDictionary oldValues, 
                                              OrderedDictionary newValues, bool isNew)
        {
            Canon.Data.User cc = new Canon.Data.User();
            if (!isNew)
                cc.UserId = key;
            cc.UserName = newValues["UserName"].ToString();
            cc.FullName = newValues["FullName"].ToString();
            cc.Email = newValues["Email"].ToString();
            if (!isNew)
            {
                string oldPassword = oldValues["Password"].ToString();
                string newPassword = newValues["Password"].ToString();
                if (oldPassword != newPassword)
                    cc.Password = newValues["Password"].ToString();
            }
            else
            {
                cc.Password = newValues["Password"].ToString();
            }

            // is active
            if (newValues["IsActive"] != null)
                cc.IsActive = (bool)newValues["IsActive"];
            else
                cc.IsActive = false;

            return cc;
        }