Exemplo n.º 1
0
 // Called by UserObject when it changes
 internal void UserObjectChanged(UserObject user)
 {
     try
     {
         int index = List.IndexOf(user);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 2
0
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         UserObject user = new UserObject();
         List.Add(user);
         return user;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 3
0
 public void Remove(UserObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 4
0
 public PopupObjectCollection GetAllActiveByEmployee(UserObject user)
 {
     PopupObjectCollection popups = new PopupObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(PopupUserObject.USER_ID, user.UsrID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + PopupUserObject.USER_ID + " is not null ");
         builder.Append("AND " + PopupUserObject.POPUP_ID + " is not null ");
         builder.AppendWhereBoolean(PopupObject.ACTIVE, true, QueryBuilder.ParameterLocation.LAST);
         popups = PopupConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return popups;
 }
Exemplo n.º 5
0
 public int Add(UserObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 6
0
 public UserObject GetUserByLogin(string login)
 {
     UserObject user = new UserObject();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(UserObject.LOGIN, DBFunctions.FixStringValue(login), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST_LAST);
         user = UserConvertor.UserRowToObject(DBFunctions.FillDataRow(builder.Query
                          , true, "Generic", 30));
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return user;
 }
Exemplo n.º 7
0
        public void SetUnknownSecurityParameters(UserObject user)
        {
            SqlCommand cmd = null;
            try
            {
                //user.Security = new UserSecurityObject();
                if (user.Security.Application.AuthSettings == null | user.Security.Application.AuthSettings == "")
                    user.Security.Application.AuthSettings = "000";
                if (user.Security.Application.AuthUser == null | user.Security.Application.AuthUser == "")
                    user.Security.Application.AuthUser = "******";
                if (user.Security.Main.AuthTask == null | user.Security.Main.AuthTask == "")
                    user.Security.Main.AuthTask = "000";
                if (user.Security.Main.AuthCustomer == null | user.Security.Main.AuthCustomer == "")
                    user.Security.Main.AuthCustomer = "000";
                if (user.Security.Main.AuthEmployee == null | user.Security.Main.AuthEmployee == "")
                    user.Security.Main.AuthEmployee = "000";
                if (user.Security.Costing.AuthCosting == null | user.Security.Costing.AuthCosting == "")
                    user.Security.Costing.AuthCosting = "000";
                if (user.Security.Costing.AuthFuel == null | user.Security.Costing.AuthFuel == "")
                    user.Security.Costing.AuthFuel = "000";
                if (user.Security.Costing.AuthFuelDelivery == null | user.Security.Costing.AuthFuelDelivery == "")
                    user.Security.Costing.AuthFuelDelivery = "000";
                if (user.Security.Costing.AuthFuelCorrection == null | user.Security.Costing.AuthFuelCorrection == "")
                    user.Security.Costing.AuthFuelCorrection = "000";
                if (user.Security.Vehicle.AuthVehicle == null | user.Security.Vehicle.AuthVehicle == "")
                    user.Security.Vehicle.AuthVehicle = "000";
                //user.Security.Material
                if (user.Security.Material == null)
                    user.Security.Material = new UserSecurityMaterial();
                if (user.Security.Material.AuthMaterial == null | user.Security.Material.AuthMaterial == "")
                    user.Security.Material.AuthMaterial = "000";
                if (user.Security.Material.AuthMaterialMaintenance == null | user.Security.Material.AuthMaterialMaintenance == "")
                    user.Security.Material.AuthMaterialMaintenance = "000";
                if (user.Security.Material.AuthMaterialMemo == null | user.Security.Material.AuthMaterialMemo == "")
                    user.Security.Material.AuthMaterialMemo = "000";
                if (user.Security.Material.AuthMaterialCategory == null | user.Security.Material.AuthMaterialCategory == "")
                    user.Security.Material.AuthMaterialCategory = "000";
                if(user.Security.Planning == null)
                    user.Security.Planning = new UserSecurityPlanning();
                if (user.Security.Planning.AuthPlanning == null | user.Security.Planning.AuthPlanning == "")
                    user.Security.Planning.AuthPlanning = "000";

                this.Save(user);

            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
                cmd = null;
            }
        }
Exemplo n.º 8
0
 public void Save(UserObject user)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Users_SAVE",
             CreateParameter("@usrID", SqlDbType.UniqueIdentifier, user.UsrID, ParameterDirection.InputOutput),
             CreateParameter("@empID", SqlDbType.UniqueIdentifier,  user.Employee == null ? Guid.Empty : user.Employee.EmpID),
             CreateParameter("@Surname", SqlDbType.VarChar, user.Surname),
             CreateParameter("@Name", SqlDbType.VarChar, user.Name),
             CreateParameter("@Login", SqlDbType.VarChar, user.Login),
             CreateParameter("@Password", SqlDbType.VarChar, user.Password),
             CreateParameter("@Active", SqlDbType.Bit, user.Active),
             CreateParameter("@Security",SqlDbType.VarBinary, PROF_IT.Common.Convert.Byte.ObjectToByteArray(user.Security)),
             CreateParameter("@HasPopups",SqlDbType.Bit,user.HasPopups)
             );
         user.UsrID = (Guid)cmd.Parameters["@usrID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Exemplo n.º 9
0
 public bool Remove(UserObject user)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Users_DELETE",
             CreateParameter("@usrID", SqlDbType.UniqueIdentifier, user.UsrID, ParameterDirection.Input)
             );
         return true;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Exemplo n.º 10
0
 public Boolean HasDependencies(UserObject user)
 {
     bool flag;
     try
     {
         flag = false;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return flag;
 }