Ejemplo n.º 1
0
        public static void TreeCategoryUpsert(int TreeId, GenericItemModel CategoryToUpsert)
        {
            LogManager.Models.LogModel oLog = GetGenericLogModel();
            try
            {
                DAL.Controller.CompanyDataController.Instance.TreeCategoryUpsert
                    (TreeId,
                    CategoryToUpsert.ParentItem != null && CategoryToUpsert.ParentItem.ItemId > 0 ? (int?)CategoryToUpsert.ParentItem.ItemId : null,
                    CategoryToUpsert.ItemId,
                    CategoryToUpsert.Enable);

                oLog.IsSuccess = true;
            }
            catch (Exception err)
            {
                oLog.IsSuccess = false;
                oLog.Message   = err.Message + " - " + err.StackTrace;

                throw err;
            }
            finally
            {
                oLog.LogObject = CategoryToUpsert;

                oLog.RelatedLogInfo.Add(new LogManager.Models.LogInfoModel()
                {
                    LogInfoType = "TreeId",
                    Value       = TreeId.ToString(),
                });

                LogManager.ClientLog.AddLog(oLog);
            }
        }
Ejemplo n.º 2
0
        public static GenericItemModel ModuleOptionInfoUpsert(GenericItemModel GenericItemToUpsert)
        {
            if (GenericItemToUpsert != null &&
                GenericItemToUpsert.ItemInfo != null &&
                GenericItemToUpsert.ItemInfo.Count > 0)
            {
                LogManager.Models.LogModel oLog = GetGenericLogModel();

                GenericItemToUpsert.ItemInfo.All(x =>
                {
                    try
                    {
                        x.ItemInfoId = DAL.Controller.CompanyDataController.Instance.ModuleOptionInfoUpsert(
                            GenericItemToUpsert.ItemId,
                            x.ItemInfoId,
                            x.ItemInfoType.ItemId,
                            x.Value,
                            x.LargeValue,
                            x.Enable);

                        oLog.IsSuccess = true;
                    }
                    catch (Exception err)
                    {
                        oLog.IsSuccess = false;
                        oLog.Message   = err.Message + " - " + err.StackTrace;

                        throw err;
                    }
                    finally
                    {
                        oLog.LogObject = x;

                        oLog.RelatedLogInfo.Add(new LogManager.Models.LogInfoModel()
                        {
                            LogInfoType = "ModuleOptionInfoId",
                            Value       = x.ItemInfoId.ToString(),
                        });

                        LogManager.ClientLog.AddLog(oLog);
                    }

                    return(true);
                });
            }

            return(GenericItemToUpsert);
        }
Ejemplo n.º 3
0
        public static GenericItemModel ContactInfoUpsert(GenericItemModel ContactToUpsert)
        {
            if (ContactToUpsert.ItemId > 0 &&
                ContactToUpsert.ItemInfo != null &&
                ContactToUpsert.ItemInfo.Count > 0)
            {
                ContactToUpsert.ItemInfo.All(ctinf =>
                {
                    LogManager.Models.LogModel oLog = GetGenericLogModel();
                    try
                    {
                        ctinf.ItemInfoId = DAL.Controller.CompanyDataController.Instance.ContactInfoUpsert
                                               (ContactToUpsert.ItemId,
                                               ctinf.ItemInfoId > 0 ? (int?)ctinf.ItemInfoId : null,
                                               ctinf.ItemInfoType.ItemId,
                                               ctinf.Value,
                                               ctinf.LargeValue,
                                               ctinf.Enable);

                        oLog.IsSuccess = true;
                    }
                    catch (Exception err)
                    {
                        oLog.IsSuccess = false;
                        oLog.Message   = err.Message + " - " + err.StackTrace;

                        throw err;
                    }
                    finally
                    {
                        oLog.LogObject = ctinf;

                        oLog.RelatedLogInfo.Add(new LogManager.Models.LogInfoModel()
                        {
                            LogInfoType = "ContactId",
                            Value       = ContactToUpsert.ItemId.ToString(),
                        });

                        LogManager.ClientLog.AddLog(oLog);
                    }

                    return(true);
                });
            }

            return(ContactToUpsert);
        }
Ejemplo n.º 4
0
        public static GenericItemModel CategoryUpsert(int?TreeId, GenericItemModel CategoryToUpsert)
        {
            LogManager.Models.LogModel oLog = GetGenericLogModel();

            try
            {
                CategoryToUpsert.ItemId = DAL.Controller.CompanyDataController.Instance.CategoryUpsert
                                              (CategoryToUpsert.ItemId,
                                              CategoryToUpsert.ItemName,
                                              CategoryToUpsert.Enable);

                CategoryInfoUpsert(CategoryToUpsert);

                if (TreeId != null && TreeId > 0)
                {
                    TreeCategoryUpsert((int)TreeId, CategoryToUpsert);
                }

                oLog.IsSuccess = true;

                return(CategoryToUpsert);
            }
            catch (Exception err)
            {
                oLog.IsSuccess = false;
                oLog.Message   = err.Message + " - " + err.StackTrace;

                throw err;
            }
            finally
            {
                oLog.LogObject = CategoryToUpsert;

                if (TreeId != null)
                {
                    oLog.RelatedLogInfo.Add(new LogManager.Models.LogInfoModel()
                    {
                        LogInfoType = "TreeId",
                        Value       = TreeId.ToString(),
                    });
                }

                LogManager.ClientLog.AddLog(oLog);
            }
        }