Exemple #1
0
    void IBaseBOL.DeleteRecord(params string[] DelParam)
    {
        Resources ObjTable = dataContext.Resources.Single(p => p.Code.Equals(DelParam[0]));

        dataContext.Resources.DeleteOnSubmit(ObjTable);
        dataContext.SubmitChanges();
    }
Exemple #2
0
    public int SaveChanges(bool IsNewRecord)
    {
        Users ObjTable;

        if (IsNewRecord)
        {
            ObjTable            = new Users();
            ObjTable.LoginTimes = 0;
            ObjTable.CreateDate = DateTime.Now;
            dataContext.Users.InsertOnSubmit(ObjTable);

            Tools tool1 = new Tools();
            ObjTable.ID = tool1.GetRandNumber(20);
        }
        else
        {
            ObjTable = dataContext.Users.Single(p => p.Code.Equals(this.Code));
        }
        try
        {
            #region Save Controls
            string BaseID = this.ToString().Substring(3, this.ToString().Length - 3);
            Tools  tools  = new Tools();
            tools.AccessList = tools.GetAccessList(BaseID);
            foreach (WebControl wc in ObjectList)
            {
                if ((wc as AKP.Web.Controls.Common.ICustomControlsBase).DisplayMode == AKP.Web.Controls.Common.EnmDisplayMode.EditMode)
                {
                    string       Property     = wc.ID.Substring(3, wc.ID.Length - 3);
                    PropertyInfo pi           = ObjTable.GetType().GetProperty(Property);
                    string       FullPropName = BaseID + "." + Property;
                    if (tools.HasAccess("Edit", BaseID + "." + Property))
                    {
                        pi.SetValue(ObjTable, Tools.GetControlValue(wc), new object[] { });
                    }
                }
            }
            #endregion

            if (tools.HasAccess("Edit", "Users"))
            {
                dataContext.SubmitChanges();
            }
        }
        catch (Exception exp)
        {
            throw exp;
        }

        return(ObjTable.Code);
    }
Exemple #3
0
    public void InsertNew()
    {
        ForgotPasswords ObjTable;

        ObjTable = new ForgotPasswords();
        dataContext.ForgotPasswords.InsertOnSubmit(ObjTable);
        ObjTable.Code     = this.Code;
        ObjTable.UserCode = this.UserCode;
        ObjTable.Email    = this.Email;
        ObjTable.GenKey   = this.GenKey;
        ObjTable.GenTime  = this.GenTime;
        ObjTable.Used     = this.Used;
        dataContext.SubmitChanges();
    }
Exemple #4
0
    public int SaveChanges(bool IsNewRecord)
    {
        HttpSessionState Session = HttpContext.Current.Session;
        UserGroups       ObjTable;

        if (IsNewRecord)
        {
            ObjTable = new UserGroups();
            dataContext.UserGroups.InsertOnSubmit(ObjTable);
        }
        else
        {
            ObjTable = dataContext.UserGroups.Single(p => p.Code.Equals(this.Code));
        }
        try
        {
            #region Save Detail Controls
            PropertyInfo piMasterCode = ObjTable.GetType().GetProperty("UserCode");
            piMasterCode.SetValue(ObjTable, MasterCode, new object[] { });

            Tools tools = new Tools();
            tools.AccessList = tools.GetAccessList(BaseID);
            foreach (WebControl wc in ObjectList)
            {
                string       Property     = wc.ID.Substring(3, wc.ID.Length - 3);
                PropertyInfo pi           = ObjTable.GetType().GetProperty(Property);
                string       FullPropName = BaseID + "." + Property;
                if (tools.HasAccess("Edit", BaseID + "." + Property))
                {
                    pi.SetValue(ObjTable, Tools.GetControlValue(wc), new object[] { });
                }
            }
            #endregion

            if (tools.HasAccess("Edit", "UserGroups"))
            {
                dataContext.SubmitChanges();
            }
        }
        catch (Exception exp)
        {
            throw exp;
        }

        return(ObjTable.Code);
    }
Exemple #5
0
    public int SaveChanges(bool IsNewRecord)
    {
        GuestUserBuys ObjTable;

        if (IsNewRecord)
        {
            ObjTable = new GuestUserBuys();
            dataContext.GuestUserBuys.InsertOnSubmit(ObjTable);
        }
        else
        {
            ObjTable = dataContext.GuestUserBuys.Single(p => p.Code.Equals(this.Code));
        }
        try
        {
            #region Save Controls
            string BaseID = this.ToString().Substring(3, this.ToString().Length - 3);
            Tools  tools  = new Tools();
            tools.AccessList = tools.GetAccessList(BaseID);
            foreach (WebControl wc in ObjectList)
            {
                string       Property     = wc.ID.Substring(3, wc.ID.Length - 3);
                PropertyInfo pi           = ObjTable.GetType().GetProperty(Property);
                string       FullPropName = BaseID + "." + Property;
                if (tools.HasAccess("Edit", BaseID + "." + Property))
                {
                    pi.SetValue(ObjTable, Tools.GetControlValue(wc), new object[] { });
                }
            }
            #endregion

            if (tools.HasAccess("Edit", "GuestUserBuys"))
            {
                dataContext.SubmitChanges();
            }
        }
        catch (Exception exp)
        {
            throw exp;
        }

        return(ObjTable.Code);
    }
Exemple #6
0
    public int SaveChanges(bool IsNewRecord)
    {
        HttpSessionState Session = HttpContext.Current.Session;
        GroupResources   ObjTable;

        if (IsNewRecord)
        {
            ObjTable = new GroupResources();
            dataContext.GroupResources.InsertOnSubmit(ObjTable);
        }
        else
        {
            ObjTable = dataContext.GroupResources.Single(p => p.Code.Equals(this.Code));
        }
        try
        {
            #region Save Detail Controls
            PropertyInfo piMasterCode = ObjTable.GetType().GetProperty("GroupCode");
            piMasterCode.SetValue(ObjTable, MasterCode, new object[] { });

            string BaseID = this.ToString().Substring(3, this.ToString().Length - 3);
            Tools  tools  = new Tools();
            tools.AccessList      = tools.GetAccessList(BaseID);
            ObjTable.GroupCode    = this.GroupCode;
            ObjTable.ResourceCode = this.ResourceCode;
            ObjTable.AccessType   = this.AccessType;


            #endregion

            dataContext.SubmitChanges();
        }
        catch (Exception exp)
        {
            throw exp;
        }

        return(ObjTable.Code);
    }