Exemple #1
0
 private void CreateRecord(string companyName, string description)
 {
     CxCompany.CreateRecord(companyName, description);
     BackPanel.Visible          = true;
     ConfirmButtonPanel.Visible = false;
     DetailPanel.Visible        = false;
     ShowInfo(MessagePanel, Resources.Resource.mRecordCreateOK);
 }
Exemple #2
0
        private void DeleteRecord(int code)
        {
            CxCompany.DeleteRecord(code);

            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mRecordDeleteOK);
        }
Exemple #3
0
        public void BindCompanies(DropDownList ddl2Bind)
        {
            ddl2Bind.DataSource     = CxCompany.GetCompaniesList();
            ddl2Bind.DataTextField  = "CompanyName";
            ddl2Bind.DataValueField = "CompanyId";

            ddl2Bind.DataBind();
            ddl2Bind.Items.Insert(0, new ListItem(Resources.Resource.lSelectOne, "0"));
        }
Exemple #4
0
        private void ShowUserContext()
        {
            User user = WebSecurity.GetUserInfo(Page.User.Identity.Name);

            Company company = CxCompany.GetCompany(user.CompanyID);

            if (company != null)
            {
                LoginName loginName = AplLoginView.FindControl("LoginName1") as LoginName;
                loginName.FormatString = "{0} | " + company.Description;

                Session.Add("CompanyID", user.CompanyID);
            }
        }
Exemple #5
0
        public static void SendManagerEmail(string notificationMessage, int productionUnitId, int functionalAreaId, string formDescription, int formPeriod, string periodicityCode, DateTime formDate)
        {
            string userEmail  = null;
            string logText    = null;
            string baseParams = Properties.Settings.Default.NotificationParams;
            string notificationServiceTypeName = Properties.Settings.Default.NotificationTypeName;
            string subject     = Properties.Settings.Default.NotificationSubject;
            string messageBody = null;

            try
            {
                // get all users of passed Production Unit
                // send an email to each user
                IQueryable <UserProductionUnit> usersList = CxUserProductionUnit.GetListByProductionUnit(productionUnitId);
                foreach (UserProductionUnit currentUser in usersList.ToList())
                {
                    User user = CxUser.GetUserById(currentUser.UserID);

                    // if user is Manager send an email
                    if ((bool)user.IsManager && !user.IsLockedOut)
                    {
                        Company userCompany = CxCompany.GetCompany(user.CompanyID);

                        userEmail   = user.Email;
                        messageBody = string.Format(notificationMessage, user.Username, userCompany.CompanyName, formDescription, GetPeriodMessage(formPeriod, periodicityCode, formDate));
                        logText     = string.Format("sending an email to manager {0} with form : {1} and message {2}", userEmail, formDescription, messageBody);
                        LOGGER.Write(LOGGER.LOGGEREventID.INFORMATION, cMODULE_NAME, new string[] { cBASE_NAME, logText });

                        NotificationService.Send(baseParams, notificationServiceTypeName, userEmail, subject, messageBody);
                    }
                }
            }
            catch (Exception exp)
            {
                LOGGER.Write(LOGGER.LOGGEREventID.EXCEPTION, cMODULE_NAME, new string[] { cBASE_NAME, exp.Message });
            }
        }