Esempio n. 1
0
    private static void Insert(string Data, string Message, string Source, string TargetSite, string StackTrace, string ExtraData, DateTime?OccuredTime, string ClientIP, string ServerDomain, string CertificateThumbPrint, int UserCode, int?SyncStatusType, int?DataSourceType, string MyVersion)
    {
        try
        {
            Exceptions           ObjTable    = new Exceptions();
            ErrorLogsDataContext dataContext = new ErrorLogsDataContext();
            dataContext.Exceptions.InsertOnSubmit(ObjTable);

            ObjTable.CertificateThumbPrint = CertificateThumbPrint;
            ObjTable.ClientIP       = ClientIP;
            ObjTable.Data           = Data;
            ObjTable.DataSourceType = DataSourceType;
            ObjTable.ExtraData      = ExtraData;
            ObjTable.Message        = Message;
            ObjTable.MyVersion      = MyVersion;
            ObjTable.OccuredTime    = OccuredTime;
            ObjTable.ServerDomain   = ServerDomain;
            ObjTable.Source         = Source;
            ObjTable.StackTrace     = StackTrace;
            ObjTable.SyncStatusType = SyncStatusType;
            ObjTable.TargetSite     = TargetSite;
            ObjTable.UserCode       = UserCode;

            dataContext.SubmitChanges();
        }
        catch (Exception exp)
        {
            throw exp;
        }
    }
    public int SaveChanges(bool IsNewRecord)
    {
        ErrorLogs ObjTable;

        if (IsNewRecord)
        {
            ObjTable = new ErrorLogs();
            dataContext.ErrorLogs.InsertOnSubmit(ObjTable);
        }
        else
        {
            ObjTable = dataContext.ErrorLogs.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", "ErrorLogs"))
            {
                dataContext.SubmitChanges();
            }
        }
        catch (Exception exp)
        {
            throw exp;
        }

        return(ObjTable.Code);
    }