private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     if (data.Id == 0 && !BLL.UserAccount.AllowInsert(Common.Forms.frmUserType))
     {
         MessageBox.Show(string.Format(Message.PL.DenyInsert, FormName));
     }
     else if (data.Id != 0 && !BLL.UserAccount.AllowUpdate(Common.Forms.frmUserType))
     {
         MessageBox.Show(string.Format(Message.PL.DenyUpdate, FormName));
     }
     else if (data.TypeOfUser == "")
     {
         MessageBox.Show(string.Format(Message.PL.Empty_Record, "User type"));
     }
     else
     {
         Common.AppLib.WriteLog(string.Format("User type save=>Begins=>Id=>{0}", data.Id));
         if (data.Save() == true)
         {
             Common.AppLib.WriteLog(string.Format("User type Saved Successfully=>Id=>{0}", data.Id));
             MessageBox.Show("Saved");
             this.Close();
         }
     }
 }
Exemplo n.º 2
0
        public static void SaveList(List <UserType> list)
        {
            BLL.UserType bv = new BLL.UserType();
            foreach (UserType v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                {
                    bv.ID = v.ID.Value;
                }
                if (v.Type != "" && v.Type != null)
                {
                    bv.Type = v.Type;
                }
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
Exemplo n.º 3
0
 public static void DeleteList(List <int> list)
 {
     BLL.UserType bv = new BLL.UserType();
     foreach (int v in list)
     {
         // try to load by primary key
         bv.LoadByPrimaryKey(v);
         // if the entry doesn't exist, create it
         if (bv.RowCount > 0)
         {
             bv.MarkAsDeleted();
             bv.Save();
         }
         // populate the contents of v on the to the database list
     }
 }
Exemplo n.º 4
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     if (data.Id == 0 && !BLL.UserAccount.AllowInsert(FormName))
     {
         MessageBox.Show(string.Format(Message.PL.DenyInsert, FormName));
     }
     else if (data.Id != 0 && !BLL.UserAccount.AllowUpdate(FormName))
     {
         MessageBox.Show(string.Format(Message.PL.DenyUpdate, FormName));
     }
     else
     {
         if (data.Save() == true)
         {
             MessageBox.Show("Saved");
             data.Clear();
         }
     }
 }
        public static void DeleteList(List<int> list)
        {
            BLL.UserType bv = new BLL.UserType();
            foreach (int v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v);
                // if the entry doesn't exist, create it
                if (bv.RowCount > 0)
                {
                    bv.MarkAsDeleted();
                    bv.Save();
                }
                // populate the contents of v on the to the database list

            }
        }
        public static void SaveList(List<UserType> list)
        {
            BLL.UserType bv = new BLL.UserType();
            foreach (UserType v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
              if( v.ID.HasValue )
                   bv.ID = v.ID.Value;
              if( v.Type != "" && v.Type != null )
                   bv.Type = v.Type;
              //if( v.IsDeleted.HasValue )
              //     bv.IsDeleted = v.IsDeleted.Value;
              //if( v.UpdateTime.HasValue )
              //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }