public CallContext DiePriceListDetailsSave(List<DiePriceListDetail> entities, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.DiePriceListDetailsSave;
            CallContext resContext = new DiePriceListDetailBL().EntitySave<DiePriceListDetail>(entities, resultContext);

            return resContext;
        }
Beispiel #2
0
        public CallContext NotificationSave(Notification entity, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.NotificationSave;
            CallContext resContext = new NotificationBL().EntitySave<Notification>(entity, resultContext);

            return resContext;
        }
Beispiel #3
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;
            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            this.ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();

            var existEntity = dbContext.Locations.Where(
                                                        e => e.Name == this.Name &&
                                                             e.idVillageType == this.idVillageType &&
                                                             e.idMunicipality == this.idMunicipality &&
                                                             e.idLocation != this.idLocation
                                                             ).FirstOrDefault();

            if (existEntity != null)
            {
                result.Add(BaseHelper.GetCaptionString("Entity_Location_VillageType_Municipality_Exist"));
            }

            this.ValidationErrorsAsString = string.Join(",", result.ToArray());

            if (!string.IsNullOrEmpty(ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #4
0
        public CallContext EmployeSave(ETEMModel.Models.Employe entity, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.EmployeSave;
            CallContext resContext = new EmployeBL().EntitySave<ETEMModel.Models.Employe>(entity, resultContext);

            return resContext;
        }
Beispiel #5
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();

            if (this.idRole == 0)
            {
                Role role = dbContext.Roles.FirstOrDefault(s => s.Name == this.Name);
                if (role != null)
                {
                    result.Add("Вече съществува роля с това име");
                }
            }


            ValidationErrorsAsString = string.Join(",", result.ToArray());

            if (!string.IsNullOrEmpty(ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #6
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();


            if (string.IsNullOrEmpty(this.IP))
            {
                result.Add(string.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_AllowIP_IP")));
            }

            var existIP = dbContext.AllowIPs.Where(u => u.IP == this.IP && u.idAllowIP != this.idAllowIP).FirstOrDefault();

            if (existIP != null)
            {
                result.Add(BaseHelper.GetCaptionString("Entity_AllowIP_IP_Exist"));
            }


            ValidationErrorsAsString = string.Join(",", result.ToArray());

            if (!string.IsNullOrEmpty(ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #7
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            List<string> result = new List<string>();
            ValidationErrorsAsString = string.Empty;

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            if (this.idVendor == Constants.INVALID_ID || this.idVendor == Constants.INVALID_ID_ZERO)
            {
                result.Add("The field `Vendor` is required!");
            }
            if (this.DateFrom == DateTime.MinValue)
            {
                result.Add("The field `Valid from` is required!");
            }
            if (this.DateTo.HasValue && this.DateTo.Value < this.DateFrom)
            {
                result.Add("The field `Valid to` must be grater than or equal the field `Date from`!");
            }

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            var checkDiePriceList = dbContext.DiePriceLists.Where(w => w.idDiePriceList != this.idDiePriceList &&
                                                                  w.idVendor == this.idVendor &&
                                                                  ((this.DateTo.HasValue && w.DateTo.HasValue &&
                                                                    (this.DateTo.Value >= w.DateFrom && this.DateTo.Value <= w.DateTo.Value ||
                                                                     this.DateFrom >= w.DateFrom && this.DateFrom <= w.DateTo.Value)) ||
                                                                   (!this.DateTo.HasValue && w.DateTo.HasValue &&
                                                                    (this.DateFrom <= w.DateTo.Value && this.DateFrom >= w.DateFrom ||
                                                                     this.DateFrom <= w.DateFrom)) ||
                                                                   (this.DateTo.HasValue && !w.DateTo.HasValue &&
                                                                    this.DateTo.Value >= w.DateFrom && this.DateFrom <= w.DateFrom) ||
                                                                   (!this.DateTo.HasValue && !w.DateTo.HasValue &&
                                                                    this.DateFrom == w.DateFrom))
                                                                 ).ToList();

            if (checkDiePriceList.Count > 0)
            {
                result.Add("Die price list with the same vendor and period already exists in the database!");
            }

            this.ValidationErrorsAsString = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, result.ToArray());

            if (!string.IsNullOrEmpty(this.ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            if (result.Count > 0)
            {
                outputContext.EntityID = "";
            }
            else
            {
                outputContext.EntityID = this.EntityID.ToString();
            }

            return result;
        }
Beispiel #8
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();
            if (string.IsNullOrEmpty(this.URL))
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"),
                    BaseHelper.GetCaptionString("Entity_NAV_URL")));
            }



            ValidationErrorsAsString = string.Join(",", result.ToArray());

            if (!string.IsNullOrEmpty(ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #9
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;
            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();



            var existEntity = dbContext.KeyValues.Where(
                e => e.KeyValueIntCode == this.KeyValueIntCode &&
                     e.idKeyType == this.idKeyType &&
                     e.idKeyValue != this.idKeyValue
                     ).FirstOrDefault();

            if (existEntity != null)
            {
                result.Add(BaseHelper.GetCaptionString("Entity_KeyValue_KeyValueIntCode_Exist"));
            }

            ValidationErrorsAsString = string.Join(",", result.ToArray());

            if (!string.IsNullOrEmpty(ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #10
0
        public CallContext UploadedFileSave(UploadedFile entity, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.UploadedFileSave;
            CallContext resContext = new UploadedFileBL().EntitySave<UploadedFile>(entity, resultContext);

            return resContext;
        }
 public void SetCreationData(CallContext outputContext)
 {
     int tmpValue = Constants.INVALID_ID;
     if (Int32.TryParse(outputContext.CurrentConsumerID, out tmpValue))
     {
         this.idCreateUser = tmpValue;
     }
     this.dCreate = DateTime.Now;
 }
Beispiel #12
0
        protected void btnSaveKeyValue_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hdnRowSlaveKey.Value))
            {
                this.currentKeyValue = new ETEMModel.Models.KeyValue();
            }
            else
            {
                this.currentKeyValue = this.ownerPage.AdminClientRef.GetKeyValueByKeyValueID(this.hdnRowSlaveKey.Value);

                if (this.currentKeyValue == null)
                {
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_KeyValue_Not_Found_By_ID"), this.hdnRowSlaveKey.Value);
                    this.ownerPage.FormLoad();
                    return;
                }
            }


            currentKeyValue.Name            = this.tbxKeyValueNameBG.Text.Trim();
            currentKeyValue.NameEN          = this.tbxKeyValueNameEN.Text.Trim();
            currentKeyValue.KeyValueIntCode = this.tbxKeyValueIntCode.Text.Trim();
            currentKeyValue.Description     = this.tbxKeyValueDescription.Text;
            currentKeyValue.V_Order         = BaseHelper.ConvertToInt(this.tbxKeyValueOrder.Text.Trim());

            currentKeyValue.DefaultValue1 = this.tbxDefaultValue1.Text.Trim();
            currentKeyValue.DefaultValue2 = this.tbxDefaultValue2.Text.Trim();
            currentKeyValue.DefaultValue3 = this.tbxDefaultValue3.Text.Trim();
            currentKeyValue.DefaultValue4 = this.tbxDefaultValue4.Text.Trim();
            currentKeyValue.DefaultValue5 = this.tbxDefaultValue5.Text.Trim();
            currentKeyValue.DefaultValue6 = this.tbxDefaultValue6.Text.Trim();
            //currentKeyValue.CodeAdminUNI = this.tbxCodeAdminUNI.Text.Trim();


            currentKeyValue.idKeyType = Int32.Parse(this.hdnRowMasterKey.Value);

            ETEMModel.Helpers.CallContext resultContext = this.ownerPage.AdminClientRef.KeyValueSave(currentKeyValue);

            this.lbResultKeyValueContext.Text = resultContext.Message;
            this.hdnRowSlaveKey.Value         = resultContext.EntityID;


            LoadKeyValues(currentKeyValue.idKeyType.ToString());



            currentCallerDropDownList = this.ownerPage.FindControl(this.hdnCurrentCallerDropDownListUniqueID.Value) as SMCDropDownList;

            if (this.currentCallerDropDownList != null)
            {
                currentCallerDropDownList.UserControlLoad();
                currentCallerDropDownList.SelectedValue = resultContext.EntityID;
            }

            this.ownerPage.ReloadKeyValueInApplication();
        }
        public List<string> ValidateEntity(CallContext outputContext)
        {
            List<string> result = new List<string>();

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ValidationErrorsAsString = string.Empty;

            return result;
        }
        public List<string> ValidateEntity(CallContext outputContext)
        {
            List<string> result = new List<string>();
            ValidationErrorsAsString = string.Empty;

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            if (this.DateFrom == DateTime.MinValue)
            {
                result.Add("The field `Valid from` is required!");
            }
            if (this.DateTo.HasValue && this.DateTo.Value < this.DateFrom)
            {
                result.Add("The field `Valid to` must be grater than or equal the field `Date from`!");
            }

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            var checkProductivityAndScrapList = dbContext.ProductivityAndScraps.Where(w => w.idProductivityAndScrap != this.idProductivityAndScrap &&
                                                                                       ((this.DateTo.HasValue && w.DateTo.HasValue &&
                                                                                         (this.DateTo.Value >= w.DateFrom && this.DateTo.Value <= w.DateTo.Value ||
                                                                                          this.DateFrom >= w.DateFrom && this.DateFrom <= w.DateTo.Value)) ||
                                                                                         (!this.DateTo.HasValue && w.DateTo.HasValue &&
                                                                                          (this.DateFrom <= w.DateTo.Value && this.DateFrom >= w.DateFrom ||
                                                                                           this.DateFrom <= w.DateFrom)) ||
                                                                                         (this.DateTo.HasValue && !w.DateTo.HasValue &&
                                                                                          this.DateTo.Value >= w.DateFrom && this.DateFrom <= w.DateFrom) ||
                                                                                         (!this.DateTo.HasValue && !w.DateTo.HasValue &&
                                                                                          this.DateFrom == w.DateFrom))
                                                                                       ).ToList();

            if (checkProductivityAndScrapList.Count > 0)
            {
                result.Add("Productivity & Scrap list with overlapping date from/to interval persist in the data base!");
            }

            this.ValidationErrorsAsString = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, result.ToArray());

            if (!string.IsNullOrEmpty(this.ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            if (result.Count > 0)
            {
                outputContext.EntityID = "";
            }
            else
            {
                outputContext.EntityID = this.EntityID.ToString();
            }            

            return result;
        }
Beispiel #15
0
        public override void UserControlLoad()
        {
            CallContext resultContext = new CallContext();

            if (CurrentCallerUniqueID != null)
            {
                this.hdnCurrentCallerUniqueID.Value = CurrentCallerUniqueID;
                this.hdnCurrentCallerValueUniqueID.Value = CurrentCallerValueUniqueID;
            }

            this.gvPerson.DataSource = listPerson;
            if (NewPageIndex.HasValue)
            {
                this.gvPerson.PageIndex = NewPageIndex.Value;
            }
            this.gvPerson.DataBind();
        }
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();

            ValidationErrorsAsString = string.Join(",", result.ToArray());


            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #17
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.GroupSave, false))
            {
                return;
            }

            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new Group();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetGroupByID(Convert.ToInt32(this.hdnRowMasterKey.Value));

                if (this.currentEntity == null)
                {
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Group_Not_Found_By_ID"), this.hdnRowMasterKey.Value);
                    string falseResult = String.Format(BaseHelper.GetCaptionString("Entity_is_not_update"));

                    this.ownerPage.FormLoad();
                    return;
                }
            }

            currentEntity.GroupName = this.tbxGroupName.Text;
            currentEntity.SharedAccess = this.chbxSharedAccess.Checked;

            CallContext resultContext = new CallContext();
            resultContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;
            resultContext = this.ownerPage.AdminClientRef.GroupSave(currentEntity, resultContext);

            if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success)
            {
                this.CurrentEntityMasterID = resultContext.EntityID;

                UserControlLoad();

                RefreshParent();
            }

            CheckIfResultIsSuccess(this.lbResultContext);
            lbResultContext.Text = resultContext.Message; ;
        }
        public void ProcessRequest(HttpContext context)
        {
            this.CommonClientRef = new Common();

            DecryptQueryString(context.Request);

            string path = string.Empty;
            if (this.queryString["UploadPath"] != null)
            {
                path = this.queryString["UploadPath"].ToString();
            }

            HttpPostedFile fileToUpload = context.Request.Files["Filedata"];
            string pathToSave = (path.EndsWith("\\") ? path : path + "\\") + fileToUpload.FileName;

            fileToUpload.SaveAs(pathToSave);

            #region Save Entity

            this.currentEntity = new UploadedFile();

            string[] user = path.Split('_');
            string[] resName = user.First().Split('\\');
            FileInfo fi = new FileInfo(pathToSave);

            currentEntity.idResource = Convert.ToInt32(user.Last());
            currentEntity.ResourceName = resName.Last();
            currentEntity.FilePath = pathToSave;
            currentEntity.FileName = fileToUpload.FileName;
            currentEntity.Extension = Path.GetExtension(fileToUpload.FileName).Substring(1);
            currentEntity.DateUpload = DateTime.Now;
            currentEntity.Size = Convert.ToInt32(fi.Length / (1024));// в KБ
            //currentEntity.ContentType = 

            CallContext resultContext = new CallContext();
            resultContext.CurrentConsumerID = user.Last();
            resultContext = CommonClientRef.UploadedFileSave(currentEntity, resultContext);

            #endregion
        }
Beispiel #19
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            List<string> result = new List<string>();
            ValidationErrorsAsString = string.Empty;

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            if (this.idCostCenter == Constants.INVALID_ID || this.idCostCenter == Constants.INVALID_ID_ZERO)
            {
                result.Add("The field `Cost center` is required!");
            }
            if (this.idQuantityType == Constants.INVALID_ID || this.idQuantityType == Constants.INVALID_ID_ZERO)
            {
                result.Add("The field `Type of quantity` is required!");
            }
            if (this.ValueData == decimal.MinValue)
            {
                result.Add("The field `Value` is required!");
            }            

            this.ValidationErrorsAsString = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, result.ToArray());

            if (!string.IsNullOrEmpty(this.ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            if (result.Count > 0)
            {
                outputContext.EntityID = "";
            }
            else
            {
                outputContext.EntityID = this.EntityID.ToString();
            }

            return result;
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new AllowIP();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetAllowIPByID(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Setting_Not_Found_By_ID"), this.hdnRowMasterKey.Value);
                    this.ownerPage.FormLoad();
                    return;
                }

            }


            currentEntity.IP = this.tbxIP.Text;
            currentEntity.Commnet = this.tbxCommnet.Text;
            currentEntity.Allow = this.chbxAllow.Checked;

            CallContext resultContext = new CallContext();

            resultContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;

            resultContext = this.ownerPage.AdminClientRef.AllowIPSave(currentEntity, resultContext);

            this.lbResultContext.Text = resultContext.Message;
            this.hdnRowMasterKey.Value = resultContext.EntityID;
            this.CurrentEntityMasterID = resultContext.EntityID;


            this.ownerPage.FormLoad();

        }
        public CallContext AverageOutturnOverTimeDelete(List<int> listSelectedIDsToDelete, CallContext callContext)
        {
             return new AverageOutturnOverTimeBL().AverageOutturnOverTimeDelete(listSelectedIDsToDelete, callContext);

           
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            //update на снимката на потребителя
            if (!string.IsNullOrEmpty(this.hdnRowMasterKey.Value) && this.hdnRowMasterKey.Value != Constants.INVALID_ID_STRING)
            {
                string idPerson = this.hdnRowMasterKey.Value;
                this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(idPerson);

                //създава и отваря ресурсна папка с име - idPerson_PersonName
                string folderName = this.hdnRowMasterKey.Value + "_" + BaseHelper.ConvertCyrToLatin(this.currentEntity.FirstName.Trim());

                string resourcesFolderName = GeneralPage.GetSettingByCode(ETEMEnums.AppSettings.ResourcesFolderName).SettingValue + @"\Person\";

                //ID с което започва папката за импорт. Пример C:\Resources_UMS_Person\198_Kiril
                string idStartFolder = folderName.Split('_')[0].ToString();

                DirectoryInfo folder = new DirectoryInfo(resourcesFolderName);// + folderName);

                //Винаги изтриваме целевата папка за да не се пълни с всяка следваща снимка
                if (folder.Exists)
                {
                    DirectoryInfo[] directories = folder.GetDirectories();

                    foreach (var file in directories)
                    {
                        if (file.Name.StartsWith(idStartFolder + "_"))
                        {
                            FileInfo[] filesToDelete = file.GetFiles();
                            foreach (var delFile in filesToDelete)
                            {
                                File.Delete(delFile.FullName);
                            }

                            //Directory.Delete(file.FullName);

                            break;
                        }
                    }
                }

                //и отново създаваме потребителската директория
                folder = new DirectoryInfo(resourcesFolderName + folderName);

                if (!folder.Exists)
                {
                    folder = Directory.CreateDirectory(resourcesFolderName + folderName);
                }


                //ако сме избрали нещо
                if (!string.IsNullOrEmpty(FileUpload1.FileName))
                {
                    //записваме картинката в папката
                    string pathToSave = (folder.FullName.EndsWith("\\") ? folder.FullName : folder.FullName + "\\") + FileUpload1.FileName;

                    FileUpload1.SaveAs(pathToSave);

                    //update Person
                    if (this.currentEntity != null)
                    {
                        this.currentEntity.ImagePath = GeneralPage.GetSettingByCode(ETEMEnums.AppSettings.WebResourcesFolderName).SettingValue + "/Person/" + folderName + "/" + FileUpload1.FileName;
                        CallContext resultPersontContext = new CallContext();
                        resultPersontContext.CurrentConsumerID = idPerson;
                        resultPersontContext = AdminClientRef.PersonSave(this.currentEntity, resultPersontContext);
                    }
                }

                this.CurrentEntityMasterID = idPerson;
            }

            this.pnlAddPersonImage.Visible = false;
        }
        public override Tuple<CallContext, string> UserControlSave()
        {
            bool isNewEntity = true;

            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new Person();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    this.lbResultContext.Text   = String.Format(BaseHelper.GetCaptionString("Entity_Person_Not_Found_By_ID"), this.hdnRowMasterKey.Value);

                    string falseResult          = String.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"),
                                                                BaseHelper.GetCaptionString("Personal_Data"));

                    this.ownerPage.CallContext.ResultCode   = ETEMEnums.ResultEnum.Error;
                    this.ownerPage.CallContext.Message      = falseResult;

                    return new Tuple<CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data"));
                }

                isNewEntity = false;
            }

            currentEntity.IdentityNumber = this.tbxIdentityNumber.Text;

            currentEntity.FirstName     = this.tbxFirstName.Text;
            currentEntity.SecondName    = this.tbxSecondName.Text;
            currentEntity.LastName      = this.tbxLastName.Text;            
            currentEntity.idSex         = this.dllSex.SelectedValueINT;
            DateTime? tmpBirthDate      = null;

            if (this.tbxBirthDate.TextAsDateParseExact.HasValue)
            {
                tmpBirthDate = this.tbxBirthDate.TextAsDateParseExact;
            }
            else if (!string.IsNullOrEmpty(this.tbxEGN.Text))
            {
                try
                {
                    string firstPartEGN     = this.tbxEGN.Text.Substring(0, 6);
                    int year                = int.Parse(firstPartEGN.Substring(0, 2));
                    int month               = int.Parse(firstPartEGN.Substring(2, 2));
                    int day                 = int.Parse(firstPartEGN.Substring(4, 2));

                    if (month > 40)
                    {
                        month = month - 40;
                        year = year + 2000;
                    }
                    else
                    {
                        year = year + 1900;
                    }



                    tmpBirthDate = new DateTime(
                          year,
                          month,
                          day
                        );
                    this.tbxBirthDate.Text = tmpBirthDate.Value.ToString("dd.MM.yyyy");
                }


                catch { }
            }

            currentEntity.BirthDate                         = tmpBirthDate;
            currentEntity.EMail                             = this.tbxEMail.Text;
            currentEntity.MobilePhone                       = this.tbxMobilePhone.Text;
            currentEntity.Phone                             = this.tbxPhone.Text;
            currentEntity.EGN                               = this.tbxEGN.Text;
            currentEntity.IDN                               = this.tbxIDN.Text;
            currentEntity.IdentityNumber                    = this.tbxIdentityNumber.Text;
            currentEntity.Title                             = this.tbxTitle.Text;
            this.ownerPage.CallContext.CurrentConsumerID    = this.ownerPage.UserProps.IdUser;
            this.ownerPage.CallContext                      = this.ownerPage.AdminClientRef.PersonSave(currentEntity, this.ownerPage.CallContext);

            if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success)
            {
                this.lbResultContext.Text   = this.ownerPage.CallContext.Message;
                this.hdnRowMasterKey.Value  = this.ownerPage.CallContext.EntityID;

                CheckIfResultIsSuccess(lbResultContext);

                this.PersonInfo = this.currentEntity.FullName;

                if (!string.IsNullOrEmpty(PersonUsedFor))
                {
                    if (PersonUsedFor == ETEMEnums.PersonTypeEnum.Employe.ToString())
                    {
                        if (isNewEntity)
                        {
                            Employe newEmploye          = new Employe();
                            newEmploye.idPerson         = Convert.ToInt32(this.ownerPage.CallContext.EntityID);
                            CallContext callContext     = new CallContext();
                            callContext                 = this.ownerPage.EmployeClientRef.EmployeSave(newEmploye, callContext);

                            if (callContext.ResultCode == ETEMEnums.ResultEnum.Success)
                            {
                                this.DetailsKeyID = callContext.EntityID;
                            }
                            else
                            {
                                this.DetailsKeyID = Constants.INVALID_ID_STRING;
                            }
                        }
                    }

                }
            }

            this.pnlDivSearchStudent.Visible = false;

            if (string.IsNullOrWhiteSpace(this.PersonUsedFor))
            {
                this.ownerPage.FormLoad();
            }


            return new Tuple<CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data"));
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new Setting();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetSettingBySettingID(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Setting_Not_Found_By_ID"), this.hdnRowMasterKey.Value);
                    this.ownerPage.FormLoad();
                    return;
                }

            }


            currentEntity.SettingName = this.tbxSettingName.Text;
            currentEntity.SettingDescription = this.tbxSettingDescription.Text;
            currentEntity.SettingIntCode = this.tbxSettingIntCode.Text;
            currentEntity.SettingValue = this.tbxSettingValue.Text;
            currentEntity.SettingDefaultValue = this.tbxSettingDefaultValue.Text;


            CallContext resultContext = new CallContext();

            resultContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;

            resultContext = this.ownerPage.AdminClientRef.SettingSave(currentEntity, resultContext);

            this.lbResultContext.Text = resultContext.Message;
            this.hdnRowMasterKey.Value = resultContext.EntityID;

            this.ownerPage.ReloadSettingApplication();

            this.ownerPage.FormLoad();
        }
Beispiel #25
0
        protected void btnDeletePerson_Click(object sender, EventArgs e)
        {

            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.GroupPersonAddDelete, false))
            {
                return;
            }

            List<GroupPersonLink> list = new List<GroupPersonLink>();

            foreach (GridViewRow row in this.gvGroupPerson.Rows)
            {
                HiddenField hdnRowDetailKey = row.FindControl("hdnRowDetailKey") as HiddenField;
                CheckBox chbxDeleteGroupPersonLink = row.FindControl("chbxDeleteGroupPersonLink") as CheckBox;

                if (chbxDeleteGroupPersonLink.Checked)
                {
                    list.Add(new GroupPersonLink()
                    {
                        idGroupPersonLink = Int32.Parse(hdnRowDetailKey.Value)

                    }
                    );
                }
            }


            if (list.Count > 0)
            {
                CallContext resultContext = new CallContext();
                resultContext = this.AdminClientRef.GroupPersonLinkDelete(list, resultContext);
            }

            this.gvGroupPerson.DataSource = this.ownerPage.AdminClientRef.GetGroupPersonLinkDataViewByGroupID(Int32.Parse(this.hdnRowMasterKey.Value));
            this.gvGroupPerson.DataBind();
        }
Beispiel #26
0
        protected void btnAddPerson_Click(object sender, EventArgs e)
        {
            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.GroupPersonAddDelete, false))
            {
                return;
            }

            if (this.acAddPersonForGroup.SelectedValueINT != Constants.INVALID_ID && this.acAddPersonForGroup.SelectedValueINT != null && !string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                GroupPersonLink groupPersonLink = new GroupPersonLink();
                CallContext resultContext = new CallContext();

                if (this.CurrentEntityMasterID == Constants.INVALID_ID_STRING || string.IsNullOrEmpty(CurrentEntityMasterID))
                {
                    this.CurrentEntityMasterID = this.hdnRowMasterKey.Value;
                }

                //дублиране на лицата за известяване
                bool isUniquePerson = this.AdminClientRef.IsUniqueRecordGroupPersonLink(Int32.Parse(this.CurrentEntityMasterID), this.acAddPersonForGroup.SelectedValueINT.Value);

                if (!isUniquePerson)
                {
                    resultContext.ResultCode = ETEMEnums.ResultEnum.Error;
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Not_Unique_Records"), this.CurrentEntityMasterID);
                    return;
                }

                groupPersonLink.idGroup = Int32.Parse(this.CurrentEntityMasterID);
                groupPersonLink.idPerson = this.acAddPersonForGroup.SelectedValueINT.Value;

                resultContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;
                resultContext = this.AdminClientRef.GroupPersonLinkSave(groupPersonLink, resultContext);

                this.acAddPersonForGroup.SelectedValue = Constants.INVALID_ID_STRING;
                this.acAddPersonForGroup.Text = string.Empty;

                this.gvGroupPerson.DataSource = this.ownerPage.AdminClientRef.GetGroupPersonLinkDataViewByGroupID(Int32.Parse(this.CurrentEntityMasterID));
                this.gvGroupPerson.DataBind();
            }
        }
Beispiel #27
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            List<string> result = new List<string>();

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ValidationErrorsAsString = string.Empty;

          
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            //if (string.IsNullOrEmpty(this.InquiryNumber))
            //{
            //    result.Add("The field `InquiryNumber` is required!");
            //}

            if (this.OfferDate == DateTime.MinValue)
            {
                result.Add("The field `Date` is required!");
            }


            if (string.IsNullOrEmpty(this.Customer))
            {
                result.Add("The field `Customer` is required!");
            }

            if (!this.idProfileSetting.HasValue)
            {
                result.Add("The field `Profile` is required!");
            }


            if (!this.idNumberOfCavities.HasValue)
            {
                result.Add("The field `Number of cavities` is required!");
            }

            if (!this.LME.HasValue)
            {
                result.Add("The field `LME` is required!");
            }

            if (!this.PREMIUM.HasValue)
            {
                result.Add("The field `PREMIUM` is required!");
            }


            if (!this.idProfileSetting.HasValue)
            {
                result.Add("The field `Profile` is required!");
            }


            if (this.idProfileSetting.HasValue)
            {
                ProfileSetting profileSetting = new ProfileSettingBL().GetEntityById(this.idProfileSetting.Value);

                if (profileSetting.hasA && !this.ValueForA.HasValue)
                {
                    result.Add("The field `Value for A (mm)` is required!");
                }

                if (profileSetting.hasB && !this.ValueForB.HasValue)
                {
                    result.Add("The field `Value for B (mm)` is required!");
                }

                if (profileSetting.hasC && !this.ValueForC.HasValue)
                {
                    result.Add("The field `Value for C (mm)` is required!");
                }

                if (profileSetting.hasD && !this.ValueForD.HasValue)
                {
                    result.Add("The field `Value for D (mm)` is required!");
                }

                if (profileSetting.hasS && !this.ValueForS.HasValue)
                {
                    result.Add("The field `Value for S (mm)` is required!");
                }


            }


            if (!this.LME.HasValue)
            {
                result.Add("The field `LME` is required!");
            }


            if (this.LME.HasValue && this.LME.Value == decimal.MinValue)
            {
                result.Add("The field `LME` is required and should be equal or bigger than zero!");
            }



            if (!this.PREMIUM.HasValue)
            {
                result.Add("The field `PREMIUM` is required!");
            }


            if (this.PREMIUM.HasValue && this.PREMIUM.Value == decimal.MinValue)
            {
                result.Add("The field `PREMIUM` is required and should be equal or bigger than zero!");
            }


            this.ValidationErrorsAsString = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, result.ToArray());

            if (!string.IsNullOrEmpty(this.ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            if (result.Count > 0)
            {
                outputContext.EntityID = "";
            }
            else
            {
                outputContext.EntityID = this.EntityID.ToString();
            }


            return result;
        }
        public CallContext MaterialPriceListSave(List<MaterialPriceList> entities, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.MaterialPriceListSave;
            CallContext resContext = new MaterialPriceListBL().MaterialPriceListSave(entities, resultContext);

            return resContext;
        }
Beispiel #29
0
        public virtual CallContext EntityDelete <E>(List <T> entities, CallContext inputContext)
        {
            CallContext outputContext = new CallContext();

            outputContext.CurrentConsumerID = inputContext.CurrentConsumerID;
            outputContext.ResultCode        = ETEMEnums.ResultEnum.Success;
            // outputContext.securitySettings = inputContext.securitySettings;
            outputContext.ActionName = Constants.ACTION_DELETE;

            try
            {
                SetCallContextDataFromSession(outputContext);

                //outputContext.CurrentConsumerNames = props.PersonTwoNamePlusTitle;
                //outputContext.CurrentConsumerSessionId = props.SessionID;
                //outputContext.CurrentConsumerID = props.IdUser;
                //
            }
            catch (Exception ex)
            {
                outputContext.CurrentConsumerID = inputContext.CurrentConsumerID;
                BaseHelper.Log("Грешка създаване на обекта сесия в модела на приложението!");
                BaseHelper.Log(ex.Message);
            }

            List <Tuple <EventLog, T> > itemsToLog = new List <Tuple <EventLog, T> >();

            if (entities.Count > 0)
            {
                for (int i = 0; i < entities.Count; i++)
                {
                    var entity = entities[i];
                    if (!HasUserActionPermission(entity, outputContext, inputContext))
                    {
                        return(outputContext);
                    }

                    if (entity != null && entity.EntityID != Constants.INVALID_ID_ZERO && entity.EntityID != Constants.INVALID_ID)
                    {
                        savedEntity = GetEntityById(entity.EntityID);

                        if (savedEntity != null)
                        {
                            outputContext.EntityID = savedEntity.EntityID.ToString();

                            outputContext.Message    = BaseHelper.GetCaptionString("Entity_is_not_deleted");
                            outputContext.ResultCode = ETEMEnums.ResultEnum.Error;


                            dbContext.DeleteObject(savedEntity);

                            dbContext.SaveChanges();

                            outputContext.listKvEntityID.Add(new KeyValuePair <string, int>(EntitySetName, entity.EntityID));
                            outputContext.Message    = BaseHelper.GetCaptionString("Entity_is_deleted_successful");
                            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

                            EventLog simpleLog = MakeEventLog(outputContext, savedEntity);
                            itemsToLog.Add(new Tuple <EventLog, T>(simpleLog, entity));
                        }
                        else
                        {
                            outputContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                            outputContext.Message    = String.Format(BaseHelper.GetCaptionString("Entity_Not_Found_By_ID"), Constants.INVALID_ID);
                        }
                    }
                    else
                    {
                        outputContext.Message    = BaseHelper.GetCaptionString("Entity_is_not_created");
                        outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
                        outputContext.EntityID   = Constants.INVALID_ID_STRING;
                    }
                }


                if (itemsToLog.Count > 0)
                {
                    Thread t = new Thread(() => MakeFullDbLog(itemsToLog));
                    t.Start();
                }

                return(outputContext);
            }
            else
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
                outputContext.Message    = BaseHelper.GetCaptionString("The_list_of_entities_was_empty");
                return(outputContext);
            }
        }
        protected void btnMarge_Click(object sender, EventArgs e)
        {
            try
            {
                CallContext cc = new CallContext();

                this.AdminClientRef.PermittedActionMerge(cc);

                FormLoad();
            }
            catch (Exception ex)
            {

                BaseHelper.Log("Грешка в btnMarge_Click " + formResource.PagePath);
                BaseHelper.Log(ex.Message);
                BaseHelper.Log(ex.StackTrace);
            }

        }
 public CallContext DiePriceListDetailDelete(List<int> listSelectedIDs, CallContext resultContext)
 {
     return new DiePriceListDetailBL().DiePriceListDetailDelete(listSelectedIDs, resultContext);
 }
Beispiel #32
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            ValidationErrorsAsString = string.Empty;
            List<string> result = new List<string>();

            if (string.IsNullOrEmpty(this.FirstName))
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_Person_FirstName")));
            }

            if (string.IsNullOrEmpty(this.LastName))
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_Person_LastName")));
            }

            //if (this.idCitizenship==Constants.INVALID_ID)
            //{
            //    result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_Person_Citizenship")));
            //}

            /*
            if (this.BirthDate == null)
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_BirthYear")));
            }

            if (!this.idSex.HasValue || this.idSex.Value == Constants.INVALID_ID || this.idSex.Value == Constants.INVALID_ID_ZERO)
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_Person_Sex")));
            }

            if (string.IsNullOrEmpty(this.EGN) && string.IsNullOrEmpty(this.IdentityNumber) && string.IsNullOrEmpty(this.IDN))
            {
                result.Add(BaseHelper.GetCaptionString("Entity_Person_Identifiers"));
            }
            */

            if (!string.IsNullOrEmpty(this.EGN))
            {
                var existUser = dbContext.Persons.Where(u => u.EGN == this.EGN &&
                                                        u.FirstName != this.FirstName &&
                                                        u.LastName != this.LastName &&
                                                        u.idPerson != this.idPerson).FirstOrDefault();

                if (existUser != null)
                {
                    result.Add(BaseHelper.GetCaptionString("Entity_Person_IdentityNumber_Exist"));
                }
            }
            else if (!string.IsNullOrEmpty(this.IdentityNumber))
            {
                var existUser = dbContext.Persons.Where(u => u.IdentityNumber == this.IdentityNumber &&
                                                        u.FirstName != this.FirstName &&
                                                        u.LastName != this.LastName &&
                                                        u.idPerson != this.idPerson).FirstOrDefault();

                if (existUser != null)
                {
                    result.Add(BaseHelper.GetCaptionString("Entity_Person_IdentityNumber_Exist"));
                }
            }

            ValidationErrorsAsString = string.Join(",", result.ToArray());

            if (!string.IsNullOrEmpty(ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }
            

            outputContext.Message = this.ValidationErrorsAsString;
            outputContext.EntityID = this.EntityID.ToString();

            return result;
        }
Beispiel #33
0
        /// <summary>
        /// Saves list of Entities
        /// </summary>
        /// <typeparam name="E"></typeparam>
        /// <param name="entities"></param>
        /// <param name="inputContext"></param>
        /// <param name="setNull"> this param is flag for refrection save, and it allows to set null or string empry as value of some prop</param>
        /// <param name="propertiesToChange">if this is != null, it means that only selected protoperties of the Entity will be saved</param>
        /// <returns></returns>

        public virtual CallContext EntitySave <E>(List <T> entities, CallContext inputContext, List <string> propertiesToChange = null, bool?allowNullAsPropvalue = null) where E : Identifiable
        {
            CallContext outputContext = new CallContext();

            outputContext.CurrentConsumerID = inputContext.CurrentConsumerID;

            try
            {
                SetCallContextDataFromSession(outputContext);

                //outputContext.CurrentConsumerNames = props.PersonTwoNamePlusTitle;
                //outputContext.CurrentConsumerSessionId = props.SessionID;
                //outputContext.CurrentConsumerID = props.IdUser;
                //
            }
            catch (Exception ex)
            {
                outputContext.CurrentConsumerID = inputContext.CurrentConsumerID;
                BaseHelper.Log("Грешка създаване на обекта сесия в модела на приложението!");
                BaseHelper.Log(ex.Message);
            }



            outputContext.PersonType       = inputContext.PersonType;
            outputContext.ResultCode       = ETEMEnums.ResultEnum.Success;
            outputContext.securitySettings = inputContext.securitySettings;
            outputContext.CurrentYear      = inputContext.CurrentYear;
            outputContext.CurrentPeriod    = inputContext.CurrentPeriod;


            List <Tuple <EventLog, T> > itemsToLog = new List <Tuple <EventLog, T> >();

            for (int i = 0; i < entities.Count; i++)
            {
                var entity = entities[i];
                if (!HasUserActionPermission(entity, outputContext, inputContext))
                {
                    return(outputContext);
                }

                if (entity.ValidateEntity(outputContext).Count > 0)
                {
                    return(outputContext);
                }

                if (entity != null && entity.EntityID != Constants.INVALID_ID_ZERO && entity.EntityID != Constants.INVALID_ID)
                {
                    savedEntity = GetEntityById(entity.EntityID);

                    if (savedEntity != null)
                    {
                        outputContext.ActionName = Constants.ACTION_UPDATE;
                        if (propertiesToChange == null)
                        {
                            EntityToEntity(entity, savedEntity);
                        }
                        else
                        {
                            BaseGenericHelper <T> .EntityToEntityByReflection(entity, savedEntity, propertiesToChange, allowNullAsPropvalue);
                        }

                        if (savedEntity is IModifiable)
                        {
                            ((IModifiable)savedEntity).SetModificationData(outputContext);
                        }

                        outputContext.EntityID = savedEntity.EntityID.ToString();

                        outputContext.Message    = BaseHelper.GetCaptionString("Entity_is_not_update");
                        outputContext.ResultCode = ETEMEnums.ResultEnum.Error;

                        try
                        {
                            dbContext.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            BaseHelper.Log("Грешка в BaseClassBL.EntitySave() - Update");
                            BaseHelper.Log(ex.Message);
                            BaseHelper.Log(ex.StackTrace);
                        }

                        outputContext.listKvEntityID.Add(new KeyValuePair <string, int>(EntitySetName, entity.EntityID));
                        outputContext.Message    = BaseHelper.GetCaptionString("Entity_is_update_successful");
                        outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

                        EventLog simpleLog = MakeEventLog(outputContext, savedEntity);
                        itemsToLog.Add(new Tuple <EventLog, T>(simpleLog, savedEntity));
                    }
                    else
                    {
                        outputContext.ResultCode = ETEMEnums.ResultEnum.Warning;
                        outputContext.Message    = String.Format(BaseHelper.GetCaptionString("Entity_Not_Found_By_ID"), Constants.INVALID_ID);
                    }
                }
                else
                {
                    outputContext.Message    = BaseHelper.GetCaptionString("Entity_is_not_created");
                    outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
                    outputContext.EntityID   = Constants.INVALID_ID_STRING;

                    if (string.IsNullOrEmpty(this.EntitySetName))
                    {
                        outputContext.Message = BaseHelper.GetCaptionString("EntitySetName_is_not_set");
                    }

                    if (entity is IModifiable)
                    {
                        ((IModifiable)entity).SetCreationData(outputContext);
                    }

                    dbContext.AddObject(this.EntitySetName, entity);

                    try
                    {
                        dbContext.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        BaseHelper.Log("Грешка в BaseClassBL.EntitySave() - Create");
                        BaseHelper.Log(ex.Message);
                        BaseHelper.Log(ex.StackTrace);
                    }

                    outputContext.ActionName = Constants.ACTION_INSERT;
                    outputContext.ResultCode = ETEMEnums.ResultEnum.Success;
                    outputContext.EntityID   = entity.EntityID.ToString();
                    outputContext.listKvEntityID.Add(new KeyValuePair <string, int>(EntitySetName, entity.EntityID));
                    outputContext.Message = BaseHelper.GetCaptionString("Entity_is_created_successful");

                    EventLog simpleLog = MakeEventLog(outputContext, entity);

                    itemsToLog.Add(new Tuple <EventLog, T>(simpleLog, entity));
                }
            }


            var     application = System.Web.HttpContext.Current.Application;
            Setting setting     = new Setting();

            Dictionary <string, Setting> dictionarySetting = new Dictionary <string, Setting>();

            if (application != null && application[Constants.APPLICATION_SETTING_LIST] != null)
            {
                dictionarySetting = application[Constants.APPLICATION_SETTING_LIST] as Dictionary <string, Setting>;

                if (dictionarySetting == null)
                {
                    setting = new Setting()
                    {
                        SettingName         = "Създаване на подробен лог в базата данни(YES|NO)",
                        SettingDescription  = "Създаване на подробен лог в базата данни(YES|NO)",
                        SettingIntCode      = ETEMEnums.AppSettings.MakeLogInDB.ToString(),
                        SettingValue        = "YES",
                        SettingDefaultValue = "YES",
                        SettingClass        = ETEMEnums.AppSettingsClass.String.ToString()
                    };

                    dictionarySetting.Add(ETEMEnums.AppSettings.MakeLogInDB.ToString(), setting);
                }
            }
            else
            {
                setting = new Setting()
                {
                    SettingName         = "Създаване на подробен лог в базата данни(YES|NO)",
                    SettingDescription  = "Създаване на подробен лог в базата данни(YES|NO)",
                    SettingIntCode      = ETEMEnums.AppSettings.MakeLogInDB.ToString(),
                    SettingValue        = "YES",
                    SettingDefaultValue = "YES",
                    SettingClass        = ETEMEnums.AppSettingsClass.String.ToString()
                };
                dictionarySetting.Add(ETEMEnums.AppSettings.MakeLogInDB.ToString(), setting);
            }

            setting = dictionarySetting.Where(k => k.Key == ETEMEnums.AppSettings.MakeLogInDB.ToString()).FirstOrDefault().Value;

            if (setting.SettingValue == "YES")
            {
                if (itemsToLog.Count > 0)
                {
                    Thread t = new Thread(() => MakeFullDbLog(itemsToLog));
                    t.Start();
                }
            }

            return(outputContext);
        }