コード例 #1
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);
        }
コード例 #2
0
        internal void SendMailPassword(User currentUser)
        {
            KeyValue kvActiveStatus = new KeyValueBL().GetKeyValueByIntCode("UserStatus", "Active");
            KeyValue kvTemporarilyInactiveStatus = new KeyValueBL().GetKeyValueByIntCode("UserStatus", "TemporarilyInactive");

            Person person   = null;
            string password = string.Empty;

            if (currentUser.idStatus == kvActiveStatus.idKeyValue)
            {
                person   = new PersonBL().GetPersonByPersonID(currentUser.idPerson.ToString());
                password = ETEMModel.Helpers.BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(currentUser.Password));
            }
            else if (currentUser.idStatus == kvTemporarilyInactiveStatus.idKeyValue)
            {
                person   = new PersonBL().GetPersonByPersonID(currentUser.idAltPerson.ToString());
                password = ETEMModel.Helpers.BaseHelper.Decrypt(System.Web.HttpUtility.UrlDecode(currentUser.AltPassword));
            }
            else
            {
                return;
            }



            CommonBL commonBL = new CommonBL();

            CallContext callContext = new CallContext();

            if (callContext.ListKvParams.Where(w => w.Key == ETEMEnums.AppSettings.MailServer.ToString()).Count() == 0)
            {
                callContext.ListKvParams.Add(new KeyValuePair <string, object>(ETEMEnums.AppSettings.MailServer.ToString(),
                                                                               commonBL.GetSettingByCode(ETEMEnums.AppSettings.MailServer).SettingValue));
            }
            if (callContext.ListKvParams.Where(w => w.Key == ETEMEnums.AppSettings.MailServerPort.ToString()).Count() == 0)
            {
                callContext.ListKvParams.Add(new KeyValuePair <string, object>(ETEMEnums.AppSettings.MailServerPort.ToString(),
                                                                               commonBL.GetSettingByCode(ETEMEnums.AppSettings.MailServerPort).SettingValue));
            }
            if (callContext.ListKvParams.Where(w => w.Key == ETEMEnums.AppSettings.MailFromPassword.ToString()).Count() == 0)
            {
                callContext.ListKvParams.Add(new KeyValuePair <string, object>(ETEMEnums.AppSettings.MailFromPassword.ToString(),
                                                                               commonBL.GetSettingByCode(ETEMEnums.AppSettings.MailFromPassword).SettingValue));
            }



            string body = string.Format(BaseHelper.GetCaptionString("Entity_User_Send_Password_Body"),
                                        person.TwoNamesPlusTitle,
                                        currentUser.UserName,
                                        password
                                        );

            commonBL.SendMailAction(
                commonBL.GetSettingByCode(ETEMEnums.AppSettings.DefaultEmail).SettingValue,
                person.EMail,
                BaseHelper.GetCaptionString("Entity_User_Send_Password_Subject"),
                body,
                "Системен e-mail", new List <string>(), callContext);
        }
コード例 #3
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.Resource))
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_Sequence_Resource")));
            }
            if (this.nextVal <= 0)
            {
                result.Add(String.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_Sequence_NextVal_Grater_Than_Zero")));
            }

            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);
        }
コード例 #4
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.PermittedActions.Where(
                e => e.GroupSecuritySetting == this.GroupSecuritySetting &&
                e.SecuritySetting == this.SecuritySetting &&
                e.idPermittedAction != this.idPermittedAction
                ).FirstOrDefault();

            if (existEntity != null)
            {
                result.Add(BaseHelper.GetCaptionString("Entity_PermittedAction_GroupSecuritySetting_SecuritySetting_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);
        }
コード例 #5
0
ファイル: Location.cs プロジェクト: borisov90/Projects
        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);
        }
コード例 #6
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
        public void btnComfirmDelete_Click(Object sender, EventArgs e)
        {
            var nodeId = int.Parse(this.hdnEditingIndexValue.Value);
            List <MenuNodeDataView> allNodes = this.ownerPage.AdminClientRef.GetAllMenuNode(this.ownerPage.CallContext);
            bool hasParentNodes = allNodes.Any(n => n.parentNode == nodeId);

            if (hasParentNodes)
            {
                this.lbDelComfirmationResult.Text = BaseHelper.GetCaptionString("Node_has_parent_nodes_deletion_canceled");
                this.lbDelComfirmationResult.Attributes.Add("class", "alert alert-error");
            }
            else
            {
                this.ownerPage.CallContext = this.ownerPage.AdminClientRef.RemoveMenuNode(nodeId, this.ownerPage.CallContext);
                if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success)
                {
                    this.pnlDeleteComfirmation.Visible = false;
                }
                else
                {
                    this.lbDelComfirmationResult.Text = this.ownerPage.CallContext.Message;
                    this.lbDelComfirmationResult.Attributes.Add("class", "alert alert-error");
                }
            }
        }
コード例 #7
0
        public override Tuple <CallContext, string> UserControlSave()
        {
            this.currentEntity = this.ownerPage.CostCalculationRef.GetOfferByID(this.CurrentEntityMasterID);

            if (this.currentEntity == null)
            {
                string falseResult = string.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("UserMain_Data"));

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

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



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

            this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.OfferSave(this.currentEntity, this.ownerPage.CallContext);

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

            CheckIfResultIsSuccess();



            return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("OfferMain_Data")));
        }
コード例 #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>();



            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);
        }
コード例 #9
0
ファイル: PersonBL.cs プロジェクト: borisov90/Projects
        public Person GetPersonByEGN(string _EGN, CallContext resultContext)
        {
            Person person = null;

            IQueryable <Person> personResult = null;

            personResult = this.dbContext.Persons.Where(e => e.EGN == _EGN);

            if (personResult.Count() == 1)
            {
                person = personResult.FirstOrDefault();
                resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
            }
            else if (personResult.Count() > 1)
            {
                resultContext.ResultCode = ETEMEnums.ResultEnum.Error;
                resultContext.Message    = string.Format(BaseHelper.GetCaptionString("Entity_Person_Found_More_Than_One_By_EGN"), _EGN);
            }
            else
            {
                resultContext.ResultCode = ETEMEnums.ResultEnum.Error;
                resultContext.Message    = string.Format(BaseHelper.GetCaptionString("Entity_Person_Not_Found_By_EGN"), _EGN);
            }

            return(person);
        }
コード例 #10
0
        private void SetEmptyValues()
        {
            this.lbResultContext.Attributes.Remove("class");
            this.lbResultContext.Text = string.Empty;

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

            this.tbxAbout.Text = string.Empty;
            this.tbxAbout.Attributes.Add("placeholder", BaseHelper.GetCaptionString("Placeholder_NotifAbout"));

            this.tbxComment.Text = string.Empty;
            this.tbxComment.Attributes.Add("placeholder", BaseHelper.GetCaptionString("Placeholder_NotifComment"));

            //дата и час на изпращане
            this.tbxSendDate.Text = DateTime.Now.ToString(Constants.SHORT_DATE_PATTERN);
            //статус изпратено
            this.ddlStatus.SelectedValue = this.AdminClientRef.GetKeyValueIdByIntCode("NotificationStatus", "Submitted").ToString();

            this.hdnRowMasterKey.Value     = string.Empty;
            this.btnSave.Enabled           = true;
            this.btnAddNoticeTo.Enabled    = true;
            this.btnDeleteNoticeTo.Enabled = true;
            //'Изпратено от' не може да се редактира
            this.ucSendFromPerson.SelectedValue = this.ownerPage.UserProps.PersonID;
            this.ucSendFromPerson.Text          = this.ownerPage.UserProps.PersonNamePlusTitle;
            this.ucSendFromPerson.ReadOnly      = true;

            this.lnkBtnPreviewDocument.Text    = string.Empty;
            this.lnkBtnPreviewDocument.Visible = false;

            this.gvSendNoticeTo.DataSource = null;
            this.gvSendNoticeTo.DataBind();

            //this.fuNotificationFile.BtnUploadFileEnabled    = false;
            this.fuNotificationFile.ClearGrid();

            ///
            //Прикачени файлове
            //сетваме стойност на полето LinkFile когато изпращаме съобщение до група от хора
            //if (currentEntity.LinkFile == null)
            //{
            //    this.fuNotificationFile.CustomFolder = this.CurrentEntityMasterID + "_" +
            //                                           this.currentEntity.SendDate.Value.ToString(Constants.DATE_SHORT_PATTERN_FOR_FILE_SUFFIX) +
            //                                           "_Notification";
            //}
            //else
            //{
            //    this.fuNotificationFile.CustomFolder = this.currentEntity.LinkFile + "_" +
            //                                           this.currentEntity.SendDate.Value.ToString(Constants.DATE_SHORT_PATTERN_FOR_FILE_SUFFIX) +
            //                                           "_Notification";
            //}

            //this.fuNotificationFile.UserControlLoad();

            ///
        }
コード例 #11
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();
        }
コード例 #12
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
        public void btnAddMenuItem_Click(Object sender, EventArgs e)
        {
            var    newMenuNode = new ETEMModel.Models.MenuNode();
            var    newUrl      = new ETEMModel.Models.NavURL();
            Button btnSender   = sender as Button;

            if (btnSender != null && btnSender.Text == BaseHelper.GetCaptionString("Add_Btn"))
            {
                int selectedMainMenuItemValue = int.Parse(this.ddlMainMenuItems.SelectedValue.ToString());

                if (selectedMainMenuItemValue != Constants.INVALID_ID_ZERO)
                {
                    int selectedSubMenuItemValue = int.Parse(this.ddlSubMenuItems.SelectedValue.ToString());
                    if (selectedSubMenuItemValue != Constants.INVALID_ID_ZERO)
                    {
                        newMenuNode.parentNode = selectedSubMenuItemValue;
                        newMenuNode.name       = this.tbxNewMenuItemName.Text;
                        newMenuNode.type       = "link";
                    }
                    else
                    {
                        newMenuNode.parentNode = selectedMainMenuItemValue;
                        newMenuNode.name       = this.tbxNewMenuItemName.Text;
                        newMenuNode.type       = "parent";
                    }
                }
                else
                {
                    newMenuNode.parentNode = Constants.INVALID_ID_ZERO;
                    newMenuNode.name       = this.tbxNewMenuItemName.Text;
                    newMenuNode.type       = "root";
                }
            }
            else if (btnSender != null)
            {
                var edittingIndexValue = this.hdnEditingIndexValue.Value;
                newMenuNode            = new ETEMModel.Models.MenuNode();
                newMenuNode.idNode     = int.Parse(edittingIndexValue);
                newMenuNode.name       = this.tbxNewMenuItemName.Text;
                newMenuNode.parentNode = int.Parse(this.ddlCurrentNodePlace.SelectedValue);
                newMenuNode.type       = this.hdnEditingNodeType.Value;
                newUrl.idNavURL        = int.Parse(this.hdnEditingNodeUrlIndex.Value);
            }

            newUrl.URL         = this.txvNavUrl.Text;
            newUrl.code        = "1";
            newUrl.QueryParams = this.tbxQueryParams.Text.Trim();

            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;
            this.ownerPage.CallContext = this.ownerPage.AdminClientRef.MenuNodeSave(newUrl, newMenuNode, this.ownerPage.CallContext);
            CheckIfResultIsSuccess();
            AddResultMessage(this.ownerPage.CallContext);
            this.ownerPage.ReloadMenuNodeDataViewApplication();
        }
コード例 #13
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
        private void HiddenControlsLoad(string nodeId = null)
        {
            List <MenuNodeDataView> allnodes = this.ownerPage.AdminClientRef.GetAllMenuNode(this.ownerPage.CallContext);

            if (nodeId == null)
            {
                List <MenuNodeDataView> nodeListRootItems = allnodes.Where(m => m.parentNode == 0).ToList();
                AddDefaultEmtryValue(nodeListRootItems, BaseHelper.GetCaptionString("UI_Please_Select"));
                this.ddlMainMenuItems.DataSource = nodeListRootItems;
                this.ddlMainMenuItems.DataBind();
            }
            else
            {
                List <MenuNodeDataView> listRootsAndParentsNodes = allnodes.Where(n => (n.type == "root") || n.type == "parent").ToList();
                List <MenuNodeDataView> rootNodes   = allnodes.Where(n => (n.type == "root")).ToList();
                List <MenuNodeDataView> parentNodes = allnodes.Where(n => n.type == "parent").ToList();
                MenuNodeDataView        edittedNode = allnodes.FirstOrDefault(n => n.idNode == int.Parse(nodeId));
                NavURL navUrl = this.ownerPage.AdminClientRef.GetUrlNavById(edittedNode.idNavURL);

                SetEddingNodeValues(nodeId, edittedNode, navUrl);

                bool isSelectedNodeInRoots = rootNodes.Any(n => n.idNode == int.Parse(nodeId));
                if (isSelectedNodeInRoots)
                {
                    this.hdnEditingNodeType.Value   = "root";
                    this.hdnEditingNodeParent.Value = Constants.INVALID_ID_ZERO_STRING;
                    this.lbNodePlace.Visible        = true;
                    this.lbNodePlace.Text           = BaseHelper.GetCaptionString("Can_Only_Change_Name_And_URL");
                }
                else
                {
                    bool isEditedInParentNodes = parentNodes.Any(n => n.idNode == int.Parse(nodeId));
                    this.hdnEditingNodeParent.Value = edittedNode.parentNode.ToString();
                    if (isEditedInParentNodes)
                    {
                        this.hdnEditingNodeType.Value = "parent";

                        AddDefaultEmtryValue(rootNodes, BaseHelper.GetCaptionString("Make_Node_Root"));
                        BindDdl(rootNodes, ddlCurrentNodePlace, BaseHelper.GetCaptionString("Can_Change_Position_In_Root_Menu")
                                , lbNodePlace, edittedNode.parentNode.ToString());
                    }
                    else
                    {
                        this.hdnEditingNodeType.Value = "link";

                        AddDefaultEmtryValue(listRootsAndParentsNodes, BaseHelper.GetCaptionString("Make_Node_Root"));
                        BindDdl(listRootsAndParentsNodes, ddlCurrentNodePlace, BaseHelper.GetCaptionString("Can_Change_Position_In_Root_And_Parent_Menu")
                                , lbNodePlace, edittedNode.parentNode.ToString());
                    }
                }
            }
        }
コード例 #14
0
        public List <string> ValidateEntity(CallContext outputContext)
        {
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ETEMDataModelEntities dbContext = new ETEMDataModelEntities();

            this.passwordMinLength = Int32.Parse(new SettingBL().GetSettingByCode(ETEMEnums.AppSettings.PasswordMinLength.ToString()).SettingValue);

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

            if (string.IsNullOrEmpty(this.UserName))
            {
                result.Add(string.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_User_UserName")));
            }
            if (string.IsNullOrEmpty(this.Password))
            {
                result.Add(string.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_User_Password")));
            }
            if (this.Password.Length < passwordMinLength)
            {
                result.Add(BaseHelper.GetCaptionString("Entity_User_PasswordMinLength") + " " + passwordMinLength);
            }
            if (this.idPerson == Constants.INVALID_ID || this.idPerson == Constants.INVALID_ID_ZERO)
            {
                result.Add(string.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_User_Person")));
            }
            if (this.idStatus == Constants.INVALID_ID || this.idStatus == Constants.INVALID_ID_ZERO)
            {
                result.Add(string.Format(BaseHelper.GetCaptionString("Entity_Common_Field_Mandatory"), BaseHelper.GetCaptionString("Entity_User_Status")));
            }

            var existUser = dbContext.Users.Where(u => u.UserName == this.UserName && u.idUser != this.idUser).FirstOrDefault();

            if (existUser != null)
            {
                result.Add(BaseHelper.GetCaptionString("Entity_User_UserName_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);
        }
コード例 #15
0
ファイル: DiesData.ascx.cs プロジェクト: borisov90/Projects
        public override Tuple <CallContext, string> UserControlSave()
        {
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new Offer();
            }
            else
            {
                this.currentEntity = this.ownerPage.CostCalculationRef.GetOfferByID(this.CurrentEntityMasterID);

                if (this.currentEntity == null)
                {
                    string falseResult = string.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("UserMain_Data"));

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

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


            if (!string.IsNullOrEmpty(this.tbxLifespan.Text))
            {
                Decimal tmpLifespan;
                if (Decimal.TryParse(this.tbxLifespan.Text, out tmpLifespan))
                {
                    this.currentEntity.Lifespan  = tmpLifespan;
                    this.currentEntity.CostOfDie = currentEntity.DiePrice;
                }
            }



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

            this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.OfferSave(this.currentEntity, this.ownerPage.CallContext);

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

            CheckIfResultIsSuccess();



            return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("OfferMain_Data")));
        }
コード例 #16
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
        public void ddlSubMenuItems_OnSelectedIndexChanged(Object sender, EventArgs e)
        {
            var ddlSubNode           = sender as DropDownList;
            int selectedSubNodeValue = int.Parse(ddlSubNode.SelectedValue.ToString());

            if (selectedSubNodeValue != Constants.INVALID_ID_ZERO)
            {
                this.lbNewMenuItemName.Text = BaseHelper.GetCaptionString("Add_New_Item_In_Sub_Menu");
            }
            else
            {
                this.lbNewMenuItemName.Text = BaseHelper.GetCaptionString("Add_New_Item_In_Main_Menu");
            }
        }
コード例 #17
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
 private void SetInitialValues()
 {
     this.ddlCurrentNodePlace.Visible = false;
     this.ddlMainMenuItems.Visible    = true;
     this.pnlAddNewMenuItem.Visible   = true;
     this.lbMainNodesDll.Visible      = true;
     this.lbSubMenuItems.Visible      = true;
     this.txvNavUrl.Text          = string.Empty;
     this.tbxNewMenuItemName.Text = string.Empty;
     this.tbxQueryParams.Text     = string.Empty;
     this.lbNodePlace.Visible     = false;
     this.btnAddMenuItem.Text     = BaseHelper.GetCaptionString("Add_Btn");
     this.PopUpHeadline.InnerText = BaseHelper.GetCaptionString("Adding_Nodes");
     this.lbNewMenuItemName.Text  = BaseHelper.GetCaptionString("Add_New_Item_In_Base_Menu");
     this.lbResultContext.Attributes.Remove("class");
     this.lbResultContext.Text = string.Empty;
 }
コード例 #18
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;;
        }
コード例 #19
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
        private void SetEddingNodeValues(string nodeId, MenuNodeDataView edittedNode, NavURL navUrl)
        {
            this.hdnEditingIndexValue.Value   = nodeId;
            this.hdnEditingNodeUrlIndex.Value = edittedNode.idNavURL.ToString();

            this.btnAddMenuItem.Text      = BaseHelper.GetCaptionString("Save_Btn");
            this.txvNavUrl.Text           = navUrl.URL;
            this.tbxNewMenuItemName.Text  = edittedNode.name;
            this.lbNewMenuItemName.Text   = BaseHelper.GetCaptionString("New_Node_Name");
            this.tbxQueryParams.Text      = navUrl.QueryParams;
            this.ddlMainMenuItems.Visible = false;
            this.ddlSubMenuItems.Visible  = false;
            lbMainNodesDll.Visible        = false;
            lbSubMenuItems.Visible        = false;
            this.PopUpHeadline.InnerText  = BaseHelper.GetCaptionString("Editing_Nodes");
            this.lbResultContext.Attributes.Remove("class");
            this.lbResultContext.Text = string.Empty;
        }
コード例 #20
0
        public List <SortDirectionClass> GetSortDirections()
        {
            List <SortDirectionClass> result = new List <SortDirectionClass>()
            {
                new SortDirectionClass()
                {
                    SortDirectionName = BaseHelper.GetCaptionString("SortDirectionAsc"),
                    SortDirectionCode = Constants.SORTING_ASC
                },
                new SortDirectionClass()
                {
                    SortDirectionName = BaseHelper.GetCaptionString("SortDirectionDesc"),
                    SortDirectionCode = Constants.SORTING_DESC
                }
            };

            return(result);
        }
コード例 #21
0
ファイル: MenuNode.ascx.cs プロジェクト: borisov90/Projects
        public void ddlMainMenuItems_OnSelectedIndexChanged(Object sender, EventArgs e)
        {
            List <MenuNodeDataView> allnodes = this.ownerPage.AdminClientRef.GetAllMenuNode(this.ownerPage.CallContext);

            var ddlMainNode           = sender as DropDownList;
            int selectedMainNodeValue = int.Parse(ddlMainNode.SelectedValue.ToString());

            if (selectedMainNodeValue != Constants.INVALID_ID_ZERO)
            {
                List <MenuNodeDataView> nodeSubRootItems = allnodes.Where(m => m.parentNode == selectedMainNodeValue).ToList();
                this.lbNewMenuItemName.Text = BaseHelper.GetCaptionString("Add_New_Item_In_Main_Menu");
                AddDefaultEmtryValue(nodeSubRootItems, BaseHelper.GetCaptionString("UI_Please_Select"));
                BindDdl(nodeSubRootItems, this.ddlSubMenuItems);
            }
            else
            {
                this.lbNewMenuItemName.Text  = BaseHelper.GetCaptionString("Add_New_Item_In_Base_Menu");
                this.ddlSubMenuItems.Visible = false;
            }
        }
コード例 #22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.RoleSave, false))
            {
                return;
            }

            if (string.IsNullOrEmpty(this.CurrentId))
            {
                this.currentEntity = new Role();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetRoleByID(this.CurrentId);

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

            currentEntity.Name        = this.tbxName.Text;
            currentEntity.Description = this.tbxDescription.Text;
            currentEntity.RoleIntCode = this.tbxIntCode.Text;

            CallContext resultContext = new CallContext();

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

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

            CheckIfResultIsSuccess(lbResultContext);
            this.lbResultContext.Text  = resultContext.Message;
            this.hdnRowMasterKey.Value = resultContext.EntityID;

            this.ownerPage.ReloadSettingApplication();

            this.ownerPage.FormLoad();
        }
コード例 #23
0
        protected void btnSendEmailsPopUp_Click(object sender, EventArgs e)
        {
            try
            {
                List <int>  listSelectedIDs  = new List <int>();
                CheckBox    chbxCheckForSend = new CheckBox();
                HiddenField hdnIdEntity      = new HiddenField();
                foreach (GridViewRow row in this.gvUsers.Rows)
                {
                    chbxCheckForSend = row.FindControl("chbxCheckForSend") as CheckBox;

                    if (chbxCheckForSend != null && chbxCheckForSend.Checked)
                    {
                        hdnIdEntity = row.FindControl("hdnIdEntity") as HiddenField;

                        if (hdnIdEntity != null && !listSelectedIDs.Contains(Int32.Parse(hdnIdEntity.Value)))
                        {
                            listSelectedIDs.Add(Int32.Parse(hdnIdEntity.Value));
                        }
                    }
                }

                if (listSelectedIDs.Count == 0)
                {
                    base.ShowMSG(BaseHelper.GetCaptionString("Form_Email_Please_Select_Recipient_User"));
                    return;
                }

                this.tbxSubject.Text = GetCaption("Entity_User_Send_Password_Subject");
                this.tbxBody.Text    = GetCaption("Entity_User_Send_Password_Body");

                this.pnlSendEmail.Visible = true;
            }
            catch (Exception ex)
            {
                BaseHelper.Log("Грешка в btnSendEmailsPopUp_Click " + formResource.PagePath);
                BaseHelper.Log(ex.Message);
                BaseHelper.Log(ex.StackTrace);
            }
        }
コード例 #24
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();
            }
        }
コード例 #25
0
        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();
        }
コード例 #26
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new Module();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetModuleByID(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.ModuleName    = this.tbxModuleName.Text;
            currentEntity.ModuleSysName = this.tbxModuleSysName.Text;
            currentEntity.Comment       = this.tbxComment.Text;
            currentEntity.NeedCheck     = this.chbxNeedCheck.Checked;

            CallContext resultContext = new CallContext();

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

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

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


            this.ownerPage.ReloadModuleDataViewApplication();

            this.ownerPage.FormLoad();
        }
コード例 #27
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new PermittedAction();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetPermittedActionByID(this.hdnRowMasterKey.Value);

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


            currentEntity.FrendlyName = this.tbxFrendlyName.Text;
            currentEntity.Description = this.tbxDescription.Text;
            currentEntity.idModule    = this.ddlModule.SelectedValueINT;



            CallContext resultContext = new CallContext();

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

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

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

            this.ownerPage.ReloadSettingApplication();

            this.ownerPage.FormLoad();
        }
コード例 #28
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            pnlKeyType.Visible = true;

            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new ETEMModel.Models.KeyType();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetKeyTypeByKeyTypeID(this.hdnRowMasterKey.Value);

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



            currentEntity.Name           = this.tbxName.Text;
            currentEntity.KeyTypeIntCode = this.tbxKeyTypeIntCode.Text;
            currentEntity.Description    = this.tbxDescription.Text;
            currentEntity.IsSystemBool   = this.cbxIsSystem.Checked;

            CallContext resultContext = new CallContext();

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

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

            this.lbResultContext.Text  = resultContext.Message;
            this.hdnRowMasterKey.Value = resultContext.EntityID;
            this.ownerPage.FormLoad();
            this.ownerPage.ReloadKeyTypeInApplication();
        }
コード例 #29
0
ファイル: MenuNodeBL.cs プロジェクト: borisov90/Projects
        internal CallContext RemoveMenuNode(int nodeID, CallContext resultContext)
        {
            MenuNode node = dbContext.MenuNodes.FirstOrDefault(n => n.idNode == nodeID);

            resultContext.ResultCode = ETEMEnums.ResultEnum.Error;
            resultContext.Message    = BaseHelper.GetCaptionString("Entity_Not_Found");
            if (node != null)
            {
                List <RoleMenuNode> nodeForeignKeys = dbContext.RoleMenuNodes.Where(n => n.idNode == nodeID).ToList();
                if (nodeForeignKeys.Count > 0)
                {
                    for (int i = 0; i < nodeForeignKeys.Count; i++)
                    {
                        dbContext.RoleMenuNodes.DeleteObject(nodeForeignKeys[i]);
                    }
                }

                dbContext.MenuNodes.DeleteObject(node);
                dbContext.SaveChanges();
                resultContext.ResultCode = ETEMEnums.ResultEnum.Success;
                resultContext.Message    = BaseHelper.GetCaptionString("Entity_Deletetion_Successful");
            }
            return(resultContext);
        }
コード例 #30
0
        private void LoadDdlLoadStudentInfoBy()
        {
            this.ddlLoadStudentInfoBy.Items.Clear();

            ListItem item = new ListItem();

            item.Value    = "Name";
            item.Text     = BaseHelper.GetCaptionString("Entity_CampusApplication_FirstName");
            item.Selected = true;
            this.ddlLoadStudentInfoBy.Items.Add(item);

            if (this.PersonUsedFor != ETEMEnums.PersonTypeEnum.StudentCandidate.ToString())
            {
                item       = new ListItem();
                item.Value = "EGN";
                item.Text  = BaseHelper.GetCaptionString("Entity_CampusApplication_EGN");
                this.ddlLoadStudentInfoBy.Items.Add(item);

                item       = new ListItem();
                item.Value = "FacultyNo";
                item.Text  = BaseHelper.GetCaptionString("Entity_CampusApplication_FacultyNo");
                this.ddlLoadStudentInfoBy.Items.Add(item);
            }
        }