Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer          = true;
            Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);
            Response.Expires         = -1500;
            Response.CacheControl    = "no-cache";
            try
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Master Page", "Now on Master Page...", null);
                var objUserContext = SessionManagement <UserContext> .GetValue(Constants.UserContextSessionKey);

                if (objUserContext == null)
                {
                    throw new Exception("Session Expired/ Unauthorized Access found");
                }
                AuditLog.LogEvent(SysEventType.ERROR, "Master Page Session", "Session not Expired..", null);
                // Page title display
                Page.Title = ConfigurationReader <string> .GetAppConfigurationValue(Constants.AppVersionConfKey);

                EzyHeaderControl.DataSource = objUserContext;
                EzyHeaderControl.BindHeader();
                EzyMenuControl.DataSource = objUserContext.Menus;
                EzyMenuControl.BindMenu();
            }
            catch (Exception ex)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "MASTERPAGE ERROR", "Error:Signout From MasterPage", ex);
                Response.Redirect(Constants.LogoutIntermediatePageUrl, false);
            }
        }
Esempio n. 2
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            if (Action == string.Empty || Action == Constants.ViewAction)
            {
                Action = Constants.InsertAction;
            }
            if (Action == Constants.InsertAction)
            {
                QueryArgument queryArgument = new QueryArgument(UserContext.DataBaseInfo)
                {
                    FilterKey = Code,
                    QueryType = Constants.TableAccounts
                };
                if (_transactionManager.ValidateKey(queryArgument))
                {
                    CustomMessageControl.MessageBodyText = Code + " Party Code already exist";
                    CustomMessageControl.MessageType     = MessageTypes.Error;
                    CustomMessageControl.ShowMessage();
                    return;
                }
            }
            var accounts = new Accounts();

            accounts.Add(new Account
            {
                SName         = Code,
                Name          = Name,
                Type          = LType,
                Created       = CreatedDate,
                Sub           = Constants.LedgerSub,
                LMode         = LMode,
                FGroup        = FGroup,
                ContactPerson = ContactPerson,
                Address       = BasicAddress.DataSource,
                Parent        = LType == Constants.Customers ? Constants.LabelCustomer : LType == Constants.Vendors ? Constants.LabelVendor : string.Empty,
                Action        = Action,
                DataBaseInfo  = UserContext.DataBaseInfo,
            });

            if (_controlPanel.SetAccounts(accounts))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.PartyMasterSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "PARTYMASTER SAVED",
                                  GlobalCustomResource.PartyMasterSaved, true);
                clearForm();
                DivAction = false;
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.PartyMasterFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "PARTYMASTER UPDATE FAILED",
                                  GlobalCustomResource.PartyMasterFailed, true);
            }
        }
Esempio n. 3
0
        protected void lnkSaveType_Click(object sender, EventArgs e)
        {
            var lnkbtn = sender as LinkButton;

            if (UpdateDetails(MaterialHierarchyType.Type))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.TypeSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "TYPE SAVED",
                                  GlobalCustomResource.TypeSaved, true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.TypeFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "TYPE UPDATE FAILED",
                                  GlobalCustomResource.TypeFailed, true);
            }
            fillTypeddl();
            BindMaterialTypes(BindType.List);
            clearForm();
            if (lnkbtn.ID == "lnkSaveTypeBtm")
            {
                ActiveStep = "3";
            }
        }
Esempio n. 4
0
        private bool IsSessionExpired()
        {
            var userContext = SessionManagement <UserContext> .GetValue(Constants.UserContextSessionKey);

            // Check for App session expiry
            if (userContext == null)
            {
                return(true);
            }

            // Bypass SSO validation if it set in config
            var bypassSSOAuthentication = ConfigurationReader <string> .GetAppConfigurationValue(Constants.BypassSSOAuthentication);

            if (!string.IsNullOrEmpty(bypassSSOAuthentication) && bypassSSOAuthentication == "true")
            {
                return(false);
            }

            // Check for SSO session Expiry
            var ssoId = GetSSOIDFromRequestHeader();

            if (string.IsNullOrEmpty(ssoId) || ssoId != userContext.UserProfile.LoginId.Trim())
            {
                AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "APP CONTEXT SSO ID : " + userContext.UserProfile.LoginId.Trim() + " REQUEST HEADER SSO ID : " + ssoId, null);
                return(true);
            }

            return(false);
        }
Esempio n. 5
0
        protected void lnkBan_Click(object sender, EventArgs e)
        {
            var lnkbtn = sender as LinkButton;

            if (lnkbtn == null)
            {
                return;
            }
            Action = lnkbtn.CommandName;
            Code   = lnkbtn.CommandArgument;

            var         closeLink  = (Control)sender;
            GridViewRow row        = (GridViewRow)closeLink.NamingContainer;
            var         hidSuspent = ((HiddenField)row.Cells[0].FindControl("hidSuspent")).Value.ToBool();

            var queryArgument = new QueryArgument(UserContext.DataBaseInfo)
            {
                Key       = Code,
                filter1   = hidSuspent ? "false" : "true",
                FilterKey = Constants.TableMaterials
            };

            _controlPanel.Cancle(queryArgument);

            CustomMessageControl.MessageBodyText = GlobalCustomResource.MaterialSaved;
            CustomMessageControl.MessageBodyText = hidSuspent ? GlobalCustomResource.PartIncluded : GlobalCustomResource.PartSuspended;
            CustomMessageControl.MessageType     = MessageTypes.Success;
            CustomMessageControl.ShowMessage();
            AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspent ? "Part Included" : "Part Suspended",
                              hidSuspent ? GlobalCustomResource.PartIncluded : GlobalCustomResource.PartSuspended, true);
            Code = string.Empty;
            BindData(BindType.List);
        }
Esempio n. 6
0
        private string GetSSOIDFromRequestHeader()
        {
            try
            {
                var ssoKey = ConfigurationReader <string> .GetAppConfigurationValue(Constants.SSOIDKey);

                var allRaw = Request.ServerVariables["ALL_RAW"];
                if (!allRaw.Contains(ssoKey))
                {
                    AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "SSO ID NOT FOUND IN THE REQUEST", null);
                    return(null);
                }
                var startPosition   = allRaw.IndexOf(ssoKey);
                var endPosition     = allRaw.IndexOf("\r", startPosition);
                var currentKeyValue = allRaw.Substring(startPosition, endPosition - startPosition);
                var splittedArray   = currentKeyValue.Split(':');
                if (splittedArray != null && splittedArray.Length > 0)
                {
                    AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "SSO ID : " + splittedArray[1], null);
                    return(splittedArray[1].Trim());
                }
                AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "Failed to split key value pair", null);
            }
            catch (Exception ex)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Login Authentication", "GetSSOID failed with an exception ", ex);
            }
            return(null);
        }
Esempio n. 7
0
        protected void txtUserId_TextChanged(object sender, EventArgs e)
        {
            lblMessage.Visible = false;
            try
            {
                if (string.IsNullOrEmpty(txtUserId.Text))
                {
                    return;
                }
                var clientId = ConfigurationReader <string> .GetAppConfigurationValue(Constants.ClientIdConfKey);

                if (!ValidateUser(clientId, txtUserId.Text.ToString(CultureInfo.InvariantCulture)))
                {
                    lblMessage.InnerHtml = GlobalCustomResource.Default_txtUserId_TextChanged_Invalid_Userid__;
                    lblMessage.Visible   = true;
                }
                else
                {
                    if (ddlFinancialYear.Items.Count > 1)
                    {
                        ddlFinancialYear.SelectedIndex = 1;
                    }
                    ToolkitScriptManager1.SetFocus(txtPassword);
                }
            }
            catch (Exception ex)
            {
                lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Login_Failed_Error;
                AuditLog.LogEvent(SysEventType.ERROR, "Login Authentication", "Login failed with exception", ex);
                lblMessage.Visible = true;
            }
        }
Esempio n. 8
0
        protected void lnkLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtUserId.Text) && !string.IsNullOrEmpty(txtPassword.Text))
                {
                    var clientId = ConfigurationReader <string> .GetAppConfigurationValue(Constants.ClientIdConfKey);

                    var userId   = txtUserId.Text;
                    var password = txtPassword.Text;
                    var dataBase = ddlFinancialYear.SelectedValue.Trim();
                    if (AuthenticateUser(clientId, userId, password, dataBase))
                    {
                        Response.Redirect(Constants.DefaultAppPagesDirectory + _userContext.UserProfile.DefaultLink, false);
                    }
                    else
                    {
                        lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Invalid_Userid_or_Password__;
                        lblMessage.Visible   = true;
                    }
                }
                else
                {
                    lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Please_Enter_Valid_userid_and_password__;
                    lblMessage.Visible   = true;
                }
            }
            catch (Exception ex)
            {
                lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Login_Failed_Error;
                AuditLog.LogEvent(SysEventType.ERROR, "Login Authentication", "Login failed with exception", ex);
                lblMessage.Visible = true;
            }
        }
Esempio n. 9
0
        private string GetSSOIDFromRequestHeader()
        {
            try
            {
                //var temp = "Cache-Control: max-age=0 Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 Cookie: logintry=1%3B1489664199226; TARGET=HTTPS%3A//ssostagingck.registrar.ge.com/PfIdpSmAuth/PFRedirectProdProtected.jsp%3FfedHost%3Dhttps%3A//fss.stage.gecompany.com/fss%26resumePath%3D%252Fidp%252FVdlj5%252FresumeSAML20%252Fidp%252FSSO.ping; RSOSESSION=vFkrWaOZdYaLOQeaOzXMNCoTG1KN7C+pLwtsvx3ITOApBWwmhZVft0VLnOF/nggklw1NVgKirxMAZ6ortM7KkZy58Lpx3NiJm2vTtPUHZQY8LXWzR5G0Xs0Vifu8V2UHCmYrmBXgICTFsYZepS1GRSAD5SyRIwmSl5fR/brQYQprkHzW74OudIfQgw1NJTf5ZDavj3Ubd03S+ZjHFNrDNPfDqyl6VM1n+1LTSJKbVTleH6KdidGjcZB+DYNHveuRLlENCRmXA/Ah4ZCZ1Q4GyHAa7MYVWnnbxJi9kIq7P9kqKAh35E213yAUJyNNZf6vf/fEd2OJjjI8WGFwpYNNMznLqDlN/fgCAiNKVv1hC2Q5svjI7QgVWvyo0Qplp1oVs0ZMwn88zDSqrbF1tqtmKEZaVLZWhr+4JrQgGBTxv2bwN3g3iZoWlr6IgCOnglq2GebW9/pLC4eY/1vtJtVx6+LZrLkOazl+b+MBno5C4ednL4dpboSSmriDMVUmjZisz/fcGdT3p2+UTebBEffwcaRiKeJyWsqFSnTtdkXBcBpKx8P+augaZRyoEZExnpEowSLiPqdyEJPdhccCHq9VuIgmTZolAH7gBkK/9xfwKgZWA7pe2sMW/h6vo/aKwmxrQP8bYjUMj2w9G5+eUF63+zXtBaXT4cW/YvaDgDbN42Lz5dAXfJ6z8JJ/EKE3DGENlvdCBPCgzvLNmwJMninbwnMC1+VY2NJe3ZOQqLmjAySVyZzNakyPKRJCyk2pPWzzv59PA/WrkAZBzWheKkW2lLigPRlN5fL9BCxkgVmOz+dCFstdD+8sGGbHdcgWWIUXSKx3YkeSRIRhOYbSNRT+Jxy1ypiKiqjb93NbLtBQk5qhokm/5eEjBgE2owGrs5LUIyHZn3Z4kCtZr5T1JhMzwRiXupRT48ohA0ZrkBtoQ6heQNu01HDzz/zRAsKUmr0nPaHO4J1UJpsP4WGsU1qpCFPhbkhwr9jlmFvWmkMJdJAkxndic8Meb072M8aADaEQ9idpQSxo+XcG+zhFVwJYIaxPuutEw2trbDBtkrSffnYWA1vOeUy2ArH4L0T8WE7Pubn00PwXJ5x0gpk0jxf4l7gWHYuZDiqvDCd6aD+goM9f5B5EK3v5wUizbkaBXwQywkDwFgDb2Egu9JG24Vsj2W3rxPxzr7CJ; SMSESSION=HzPJAbXPpZrhT/VFCSaJeaMfdQ4iVvT4CJ7QzxLoGCnMHM7lA/uHphCgl2tUeMgKPaDr1Ri0hG+BGNQwO3lIqO04ataTnL9/yx5II/KNquu3sJIQcz6PUYWAvAtef9i7Xa5aRPewd5xgZQ2e1zC/S6dQjguEHzLKEAO5HrmmkFXpiY8hp/vX0MGHLIvE2sk/c6eCay35XeWFuBmT5wFFlklhE29LhLebd5VBrJHWLVlJCwXlH4/v6iUkxdRsV8ePfx/IRTHRb59h6HcWVa2ZqeBBlw6AYkyP3MwGCI+Dpqz3OootExSAyrO1b227ggEAAwICD/9pS7XyDCGM+ZdjLxPaPHLRBgbDa33UeVMyTLClwFhH48THIf2V05xv4I9GAu7ZZLnVCtzFKv/D7lPvPb+rsIIQg0i685SLfhUcB0/X4apITmgD/569wbtg85C1SCTE9WlP5Opn+CpFHs82VP9OxT+NvFdHq9FeN43aAI+c/h+i0dLHKebooX8mV7FqsfOC4Bah8AmxJMAHsWHDlBRwfJiDYO5Plm8HXcnL8rnMrlcYaex9P8vEdaLeQDA9kY3pUki6++zOERveeprqrryyNt0tpmIKkWR0tRbqNpSHRCCo7fLdMaWMc4TLbKtenLQ7FHacjYXNRdnqFl/PRHOJrU+KGqA3RltWR8bs9cH4BkMsMahNnIZzbRxp8AKrrmO5QtVZcmMII6oGHclo6ku1J+l/uhpC2oAeZrDbDxKcnsH0slX69c797TZut77G8HJqP17NFS3wRJuALN/H2AHjAUnWnEs5vS3vmH/++ARg4FSGpA0WO8IvSZg3JGvOjDKPucIROShUasgbgkldJIMpZuNqJO6eMniECAEO4Pgxe3M+Ybcgx7xbvwVFmjJZb95MQge2tGGctOj6BQPMqwGw7xmrLYoSFnBw8p9YiL6YYCfcJooUJ9hEYdkMoG1Q9tD4E6uFst2bQVnL/8kinFjWHBZFnf+quT5fRPrbRjsVnmOYuh1n4Yaa8OkoDCq9sfu2CYCcnZCRKAXgoGKlD4Ig/AwH6KE3GgX2+kIkd7AZxahmvGw+JErpr5DniBzd+qAAiCbz4X7zT+68z2NiMLanR9XxsKnm0ONt/st3IFRfr6olipkKWixI9ayubKQfRghRWfR0J4hE/8bscl5pT2ah72ZiRrJS; _shibsession_64656661756c7468632d666274732d737467=_f2101a5e3d7cbefa37a59a5b087366e5 Host: stg-bts.ap.health.ge.com Referer: https://fss.stage.gecompany.com/ User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Upgrade-Insecure-Requests: 1 DNT: 1 ShibSpoofCheck: 212484833638739896101279980556635823627 Shib-Application-ID: default Shib-Session-ID: _f2101a5e3d7cbefa37a59a5b087366e5 Shib-Identity-Provider: gefssstg Shib-Authentication-Instant: 2017-03-16T11:36:45.282Z Shib-Authentication-Method: urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified Shib-AuthnContext-Class: urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified Shib-Session-Index: AOdMtUPP4H71l0vJLSLHrjilE9e HTTP_GIVENNAME: Furqan HTTP_SN: Ahmad HTTP_mail: [email protected] sso_uid: 305022783";
                var ssoKey = ConfigurationReader <string> .GetAppConfigurationValue(Constants.SSOIDKey);

                var allRaw = Request.ServerVariables["ALL_RAW"];
                AuditLog.LogEvent(SysEventType.INFO, "Login Authentication:ALL_RAW", allRaw, null);
                if (!allRaw.Contains(ssoKey))
                {
                    AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "SSO ID NOT FOUND IN THE REQUEST", null);
                    return(null);
                }
                AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "SSO ID FOUND IN THE REQUEST", null);
                var startPosition   = allRaw.IndexOf(ssoKey);
                var endPosition     = allRaw.IndexOf("\r", startPosition);
                var currentKeyValue = allRaw.Substring(startPosition, endPosition - startPosition);
                AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "SSO ID KEY VALUE: " + currentKeyValue, null);
                var splittedArray = currentKeyValue.Split(':');
                if (splittedArray != null && splittedArray.Length > 0)
                {
                    AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "SSO ID : " + splittedArray[1], null);
                    return(splittedArray[1].Trim());
                }
                AuditLog.LogEvent(SysEventType.INFO, "Login Authentication", "Failed to split key value pair", null);
            }
            catch (Exception ex)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Login Authentication", "GetSSOID failed with an exception ", ex);
            }
            return(null);
        }
Esempio n. 10
0
        private void AuthenticateUser()
        {
            try
            {
                var ssoId = GetSSOIDFromRequestHeader();
                if (string.IsNullOrEmpty(ssoId))
                {
                    lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Please_Enter_Valid_userid_and_password__;
                    lblMessage.Visible   = true;
                }
                else
                {
                    var clientId = ConfigurationReader <string> .GetAppConfigurationValue(Constants.ClientIdConfKey);

                    var dbinfoKey = ConfigurationReader <string> .GetAppConfigurationValue(Constants.TrnsDbInfoKey);

                    if (AuthenticateUser(clientId, ssoId, string.Empty, dbinfoKey))
                    {
                        Response.Redirect(Constants.DefaultAppPagesDirectory + _userContext.UserProfile.DefaultLink, false);
                    }
                    else
                    {
                        lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Invalid_Userid_or_Password__;
                        lblMessage.Visible   = true;
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.InnerHtml = GlobalCustomResource.Default_lnkLogin_Click_Login_Failed_Error;
                AuditLog.LogEvent(SysEventType.ERROR, "Login Authentication", "Login failed with exception", ex);
                lblMessage.Visible = true;
            }
        }
Esempio n. 11
0
        public bool UpdateUserDetails()
        {
            try
            {
                if (Action == Constants.InsertAction)
                {
                    CreatedDate = UserContext.CurrentDate;
                    UserCode    = Guid.NewGuid();
                }

                var objProfile = new UserProfile
                {
                    UType       = Constants.UserType,
                    UCode       = UserCode,
                    Created     = CreatedDate,
                    LoginId     = UserLoginId,
                    Password    = Password,
                    Name        = UserName,
                    Address     = Address,
                    City        = City,
                    Country     = Country,
                    State       = State,
                    Zip         = ZipCode,
                    Mobile      = Mobile,
                    OffPhone    = OfficePhone,
                    ResPhone    = ResidentialPhone,
                    Email       = Email,
                    Dob         = Dob,
                    EmpId       = EmployeeId,
                    Gender      = Gender,
                    Designation = new Designation {
                        Id = Designation
                    },
                    ReportingTo = new Guid(ReportingTo),
                    Branch      = Branch,
                    ActiveTill  = ActiveTill,
                    Wh          = Warehouse,
                    Dept        = Department,
                    Avatar      = Avator,

                    LastPasswordChanged = Dates.ToDateTime(LastPasswordChanged, DateFormat.Format_05),
                    Bu           = Bu,
                    Off          = Status,
                    DefaultLink  = Constants.DefaultHomeLink,
                    Action       = Action,
                    DataBaseInfo = UserContext.DataBaseInfo
                };

                var userProfiles = new UserProfiles {
                    objProfile
                };
                return(_controlPanel.ManageUsers(userProfiles));
            }
            catch (Exception Ex)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Profile Creation", "Error occured while saving.", Ex);
            }
            return(false);
        }
Esempio n. 12
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            if (Action == string.Empty || Action == Constants.ViewAction)
            {
                Action = Constants.InsertAction;
            }
            if (Action == Constants.InsertAction)
            {
                QueryArgument queryArgument = new QueryArgument(UserContext.DataBaseInfo)
                {
                    FilterKey = CountryId,
                    filter1   = Constants.CountryType,
                    QueryType = Constants.TableMCatHeader
                };
                if (_transactionManager.ValidateKey(queryArgument))
                {
                    CustomMessageControl.MessageBodyText = "Country Code already exist";
                    CustomMessageControl.MessageType     = MessageTypes.Error;
                    CustomMessageControl.ShowMessage();
                    txtId.Focus();
                    return;
                }
            }
            var country = new Country
            {
                CountryId      = CountryId,
                CountryName    = CountryName,
                CurrencyCode   = CurrencyCode,
                CurrencyName   = CurrencyName.ToTrimString(),
                CurrencySymbol = CurrencySymbol,
                Denomination   = Denomination,
                Action         = Action,
                DataBaseInfo   = UserContext.DataBaseInfo
            };
            var countries = new Countries {
                country
            };

            if (_controlPanel.SetCountry(countries))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.CountrySaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                AuditLog.LogEvent(SysEventType.INFO, "Country Saved",
                                  GlobalCustomResource.CountrySaved);
                ClearForm();
                BindData(BindType.List);
                IsVisibleSave = false;
                txtId.Enabled = true;
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.CountryFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                AuditLog.LogEvent(SysEventType.INFO, "Country update failed",
                                  GlobalCustomResource.CountryFailed);
            }
            CustomMessageControl.ShowMessage();
        }
Esempio n. 13
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (IsSessionExpired())
     {
         AuditLog.LogEvent(SysEventType.ERROR, "MASTERPAGE ERROR", "Error:Signout From MasterPage", new Exception("Session Expired!"));
         Response.Redirect(Constants.SessionExpiryPageUrl, true);
     }
 }
Esempio n. 14
0
        protected void lnkBan_Click(object sender, EventArgs e)
        {
            var         closeLink = (Control)sender;
            GridViewRow row       = (GridViewRow)closeLink.NamingContainer;
            var         id        = ((TextBox)row.FindControl("txtID")).Text.Trim();

            if (id == string.Empty)
            {
                return;
            }

            var hidSuspent = ((HiddenField)row.Cells[0].FindControl("hidSuspent")).Value.ToBool();

            var categories = new Categories();

            categories.Add(new Category
            {
                CatType     = Constants.PartType,
                CatCode     = FRType,
                ID          = ((TextBox)row.FindControl("txtID")).Text.ToUpper(),
                Description = ((TextBox)row.FindControl("txtDesp")).Text,
                CreatedDate = Dates.ToDateTime(((HiddenField)row.FindControl("hidCreatedDate")).Value.Trim(), DateFormat.Format_01),
                Action      = Constants.UpdateAction,
                Suspend     = !hidSuspent
            });

            var firstOrDefault = categories.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }

            var controlPanel = new ControlPanelManager();

            if (controlPanel.SetCategory(categories))
            {
                CustomMessageControl.MessageBodyText = hidSuspent ? GlobalCustomResource.ModalityIncluded : GlobalCustomResource.ModalitySuspended;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspent ? "Modality Included" : "Modality Suspended",
                                  hidSuspent ? GlobalCustomResource.ModalityIncluded : GlobalCustomResource.ModalitySuspended, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData(null);
            }
            else
            {
                CustomMessageControl.MessageBodyText = hidSuspent ? GlobalCustomResource.ModalityIncludedFailed : GlobalCustomResource.ModalitySuspendedFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspent ? "Modality Included FAILED" : "Modality Suspended FAILED",
                                  hidSuspent ? GlobalCustomResource.ModalityIncludedFailed : GlobalCustomResource.ModalitySuspendedFailed, true);
            }
        }
Esempio n. 15
0
        protected void lnkBan_Click(object sender, EventArgs e)
        {
            var         closeLink = (Control)sender;
            GridViewRow row       = (GridViewRow)closeLink.NamingContainer;
            var         id        = ((TextBox)row.FindControl("txtID")).Text.Trim();

            if (id == string.Empty)
            {
                return;
            }
            var locations  = new Locations();
            var hidSuspent = ((HiddenField)row.Cells[0].FindControl("hidSuspent")).Value.ToBool();

            locations.Add(new Location
            {
                Type        = Type,
                Catg1       = Region,
                Catg2       = ddlRegion.SelectedItem.Text,
                Id          = ((TextBox)row.FindControl("txtId")).Text.Trim().ToUpper(),
                Description = ((TextBox)row.FindControl("txtDescription")).Text,
                Parent      = Constants.LabelWarehouse,
                Created     = Dates.ToDateTime(((HiddenField)row.FindControl("hidCreatedDate")).Value.Trim(), DateFormat.Format_01),
                Suspend     = !hidSuspent,
                Action      = Constants.UpdateAction,
            });

            var firstOrDefault = locations.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }


            if (_controlPanel.SetLocation(locations))
            {
                CustomMessageControl.MessageBodyText = hidSuspent ? GlobalCustomResource.LocationIncluded : GlobalCustomResource.LocationSuspended;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspent ?"LOCATION Included": "LOCATION Suspended",
                                  hidSuspent ? GlobalCustomResource.LocationIncluded : GlobalCustomResource.LocationSuspended, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData();
            }
            else
            {
                CustomMessageControl.MessageBodyText = hidSuspent ? GlobalCustomResource.LocationIncludedFailed : GlobalCustomResource.LocationSuspendedFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspent ? "LOCATION Included FAILED" : "LOCATION Suspended FAILED",
                                  hidSuspent ? GlobalCustomResource.LocationIncludedFailed : GlobalCustomResource.LocationSuspendedFailed, true);
            }
        }
Esempio n. 16
0
 public void BindHeader()
 {
     if (DataSource != null)
     {
         DisplayHeaderInformation();
     }
     else
     {
         AuditLog.LogEvent(SysEventType.ERROR, "MENU ERROR",
                           "Error : Error occured while binding header control", new Exception("Header Control datasource is not supplied/null"));
     }
 }
Esempio n. 17
0
 public void BindMenu()
 {
     if (DataSource != null)
     {
         menu.InnerHtml = LoadMenus();
     }
     else
     {
         AuditLog.LogEvent(SysEventType.ERROR, "MENU ERROR",
                           "Error : Error occured while binding menu", new Exception("Menu datasource is not supplied/null"));
     }
 }
Esempio n. 18
0
        private string LoadMenus()
        {
            var menuMarkup = new StringBuilder();

            try
            {
                var menuId = QueryStringManagement.GetValue(Constants.MenuCodeQsKey, Guid.Empty.ToString());

                var mainMenus = DataSource;
                foreach (var mainMenu in mainMenus)
                {
                    var mainMenuMarkup = new StringBuilder();
                    var subMenuMarkup  = new StringBuilder();
                    var subMenus       = mainMenu.SubMenus;
                    var activeMenuCode = menuId;
                    var firstOrDefault = subMenus.FirstOrDefault(x => String.Equals(x.MenuId, menuId, StringComparison.CurrentCultureIgnoreCase));
                    if (firstOrDefault != null)
                    {
                        activeMenuCode = firstOrDefault.MenuCode;
                    }
                    // Check whether the current menu is an active parent or not.
                    //0,1 -> activeCSS, 2 -> url or Javascript, 3 -> Menu title, 4 -> SubMenu Markup
                    mainMenuMarkup.AppendFormat(GlobalCustomResource.MainMenu,
                                                (mainMenu.MenuCode.Trim() == activeMenuCode.Substring(0, 12)) ? Constants.ActiveMenuUlCss : string.Empty,
                                                (mainMenu.MenuCode.Trim() == activeMenuCode.Substring(0, 12)) ? Constants.ActiveMenuAnchorCss : string.Empty,
                                                (string.IsNullOrEmpty(mainMenu.MenuUrl) ? Constants.HrefJs : mainMenu.MenuUrl), //Constants.DefaultAppPagesDirectory + mainMenu.MenuUrl),
                                                (string.IsNullOrEmpty(mainMenu.MenuUrl) ? GlobalCustomResource.ArrowNode : string.Empty),
                                                mainMenu.MenuName,
                                                Constants.SubMenuPlaceHolder, mainMenu.MenuIcon);


                    foreach (var menuItem in subMenus)
                    {
                        // Check whether the current menu is an active child or not.
                        subMenuMarkup.AppendFormat(GlobalCustomResource.SubMenu,
                                                   menuItem.MenuCode.Trim() == activeMenuCode ? Constants.SelectedSubMenuCss : string.Empty,
                                                   Constants.WebPageRootHtml + menuItem.MenuUrl,
                                                   menuItem.MenuName);
                    }
                    // add the submenu markup with the main menu markup
                    mainMenuMarkup.Replace(Constants.SubMenuPlaceHolder,
                                           !String.IsNullOrEmpty(subMenuMarkup.ToString())
                            ? string.Format(GlobalCustomResource.SubMenuWrapper, subMenuMarkup)
                            : string.Empty);
                    menuMarkup.Append(mainMenuMarkup);
                }
            }
            catch (Exception Ex)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Menu Binding", "Exception on Binding Menu..", Ex);
            }
            return(menuMarkup.ToString());
        }
Esempio n. 19
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            // Assign new action if action is empty or view
            if (Action == string.Empty || Action == Constants.ViewAction)
            {
                Action = Constants.InsertAction;
            }
            if (UserLoginId == string.Empty)
            {
                return;
            }
            if (UserContext == null)
            {
                AuditLog.LogEvent(SysEventType.ERROR, "Profile Creation", "Error : Error occured while creating New User Profile", new Exception("UserContext is null"));
                return;
            }
            QueryArgument queryArgument = new QueryArgument(UserContext.DataBaseInfo)
            {
                FilterKey = Action == Constants.InsertAction ? string.Empty : UserCode.ToString(),
                filter1   = UserLoginId,
                QueryType = Constants.ProfileValidationType
            };
            var result = _transactionManager.ValidateKey(queryArgument);

            if (result)
            {
                CustomMessageControl.MessageBodyText = "Duplicate User ID";
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                txtUserId.Focus();
                return;
            }
            if (UpdateUserDetails())
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE SAVED",
                                  GlobalCustomResource.UserProfileSaved, true);
                ClearForm();
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE UPDATE FAILED",
                                  GlobalCustomResource.UserProfileFailed, true);
            }
        }
Esempio n. 20
0
        protected void lnkBan_Click(object sender, EventArgs e)
        {
            var         closeLink = (Control)sender;
            GridViewRow row       = (GridViewRow)closeLink.NamingContainer;
            var         id        = ((TextBox)row.FindControl("txtPrimary")).Text.Trim();

            if (id == string.Empty)
            {
                return;
            }
            var units      = new Units();
            var hidSuspend = ((HiddenField)row.Cells[0].FindControl("hidSuspend")).Value.ToBool();

            units.Add(new FBTS.Model.Control.Unit
            {
                //Type = Type,
                Id          = ((TextBox)row.FindControl("txtPrimary")).Text.Trim().ToUpper(),
                Description = ((TextBox)row.FindControl("txtSecondary")).Text,
                Suspend     = !hidSuspend,
                Action      = Constants.UpdateAction,
            });

            var firstOrDefault = units.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }


            if (_controlPanel.SetUom(units))
            {
                CustomMessageControl.MessageBodyText = hidSuspend ? GlobalCustomResource.UOMIncluded : GlobalCustomResource.UOMSuspended;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspend ? "UOM Included" : "UOM Suspended",
                                  hidSuspend ? GlobalCustomResource.UOMIncluded : GlobalCustomResource.UOMSuspended, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData();
            }
            else
            {
                CustomMessageControl.MessageBodyText = hidSuspend ? GlobalCustomResource.UOMIncludedFailed : GlobalCustomResource.UOMSuspendedFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, hidSuspend ? "UOM Included FAILED" : "UOM Suspended FAILED",
                                  hidSuspend ? GlobalCustomResource.UOMIncludedFailed : GlobalCustomResource.UOMSuspendedFailed, true);
            }
        }
Esempio n. 21
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var parts = new Materials();

            parts.Add(new Material
            {
                PartNumber          = Code,
                Description         = Description,
                DetailedDescription = DetailedDescription,
                MaterialType        = new MaterialType {
                    Id = PartType
                },
                MaterialGroup = new MaterialGroup {
                    Id = PartGroup
                },
                Unit           = Unit,
                SalesPrice     = SalesPrice,
                Created        = CreatedDate,
                PriceValidDate = PriceValideDate
            });

            var firstOrDefault = parts.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
                firstOrDefault.Action       = Action;
            }
            if (_controlPanel.SetMaterials(parts))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.MaterialSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "MATERIALS SAVED",
                                  GlobalCustomResource.MaterialSaved, true);
                DivAction = false;
                clearForm();
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.MaterialFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "MATERIALS UPDATE FAILED",
                                  GlobalCustomResource.MaterialFailed, true);
            }
        }
Esempio n. 22
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var locations = new Locations();

            _locations = LocationDetails;
            foreach (GridViewRow gvRow in GridViewTable.Rows)
            {
                locations.Add(new Location
                {
                    Type        = Type,
                    Catg1       = Region,
                    Catg2       = ddlRegion.SelectedItem.Text,
                    Id          = ((TextBox)gvRow.FindControl("txtId")).Text.Trim().ToUpper(),
                    Description = ((TextBox)gvRow.FindControl("txtDescription")).Text,
                    Parent      = Constants.LabelWarehouse,
                    Created     = Dates.ToDateTime(((HiddenField)gvRow.FindControl("hidCreatedDate")).Value.Trim(), DateFormat.Format_01),
                    Suspend     = ((HiddenField)gvRow.FindControl("hidSuspent")).Value.Trim().ToBool(),
                    Action      = (string.IsNullOrEmpty((((HiddenField)gvRow.FindControl("hdnAction")).Value)) ? Constants.UpdateAction : ((HiddenField)gvRow.FindControl("hdnAction")).Value),
                });
            }
            var firstOrDefault = locations.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }


            if (_controlPanel.SetLocation(locations))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.LocationSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "LOCATION SAVED",
                                  GlobalCustomResource.LocationSaved, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData();
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.LocationFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "LOCATION UPDATE FAILED",
                                  GlobalCustomResource.LocationFailed, true);
            }
        }
Esempio n. 23
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            string       relation1   = Categories.Where(x => x.Selected).Select(a => a.Value).ToList().ToCharSeperatedString(Constants.DelimeterSinglePipe);
            WFComponents teamMasters = new WFComponents();

            teamMasters.Add(new WFComponent
            {
                ComponentType = Type,
                ComponentId   = TeamId,
                ComponentDesp = TeamName,
                Relation1     = relation1,
                Action        = Action,
                DataBaseInfo  = UserContext.DataBaseInfo,
            });
            WFComponentSubs wfComponentSubs = new WFComponentSubs();

            wfComponentSubs.AddRange(Users.Where(x => x.Selected).ToList().Select(row => new WFComponentSub
            {
                WFCSCode = row.Value
            }));
            var firstOrDefault = teamMasters.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.wfComponentSubs = wfComponentSubs;
            }

            if (_controlPanel.SetTeams(teamMasters))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.TeamMasterSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "TEAM MASTER SAVED",
                                  GlobalCustomResource.TeamMasterSaved, true);
                ClearForm();
                DivAction = false;
                BindData(BindType.List);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.TeamMasterFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "TEAM MASTER UPDATE FAILED",
                                  GlobalCustomResource.TeamMasterFailed, true);
            }
        }
Esempio n. 24
0
        private bool AuthenticateUser(string argsClientId, string argsUserId, string argsPassword, string argsDatabase)
        {
            var loginPresenter = new UserAuthenticationManager();

            _userContext = loginPresenter.AuthenticateUser(argsClientId, argsUserId, argsPassword,
                                                           argsDatabase);
            if (_userContext == null)
            {
                return(false);
            }
            AuditLog.LogEvent(SysEventType.ERROR, "Session Creating", _userContext.UserProfile.Name, null);

            SessionManagement <UserContext> .SetValue(Constants.UserContextSessionKey, _userContext);

            AuditLog.LogEvent(SysEventType.ERROR, "Session Created", _userContext.UserProfile.Name, null);
            return(true);
        }
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            OrderTransactions orderTransactions = new OrderTransactions();

            orderTransactions.Add(new OrderTransaction
            {
                OrderType          = Constants.PurchaseRequestTdType,
                orderHead          = ForecastingHead.GetData(),
                orderDetails       = ForecastingPart.GVPartData,
                updateOrderDeatils = ForecastingPart.OrderDetailData,
                Action             = Action,
                DataBaseInfo       = UserContext.DataBaseInfo,
                StageId            = TransactionStageControlId.ActiveStage.Trim(),
                Bu        = UserContext.UserProfile.Bu,
                Off       = Constants.TRNInProcessOFF,
                Branch    = UserContext.UserProfile.Branch,
                LogedUser = UserContext.UserId,
            });
            var firstOrDefault = orderTransactions.FirstOrDefault();
            var references     = getReferences();

            if (firstOrDefault != null)
            {
                firstOrDefault.References = references;
            }
            if (_transactionManager.SetForcasting(orderTransactions))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.ForecastingSave;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "Forecasting Saved",
                                  GlobalCustomResource.ForecastingSave, true);

                fillHeaderGrid();
                DivAction = false;
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "openTabFunctionCall", "openTab(1)", true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.ForecastingFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "Forecasting Update Failed",
                                  GlobalCustomResource.ForecastingFailed, true);
            }
        }
Esempio n. 26
0
        protected void lnkSaveDesignation_Click(object sender, EventArgs e)
        {
            var designations = new Designations();

            foreach (GridViewRow gvRow in GridViewTable.Rows)
            {
                designations.Add(new Designation
                {
                    Id          = ((TextBox)gvRow.FindControl("txtCode")).Text,
                    Description = ((TextBox)gvRow.FindControl("txtDescription")).Text,
                    Level       = ((TextBox)gvRow.FindControl("txtAccess")).Text,
                    Action      = (string.IsNullOrEmpty((((HiddenField)gvRow.FindControl("hdnAction")).Value)) ?
                                   Constants.UpdateAction : ((HiddenField)gvRow.FindControl("hdnAction")).Value),
                    SlNo        = ((HiddenField)gvRow.FindControl("hdnSno")).Value,
                    CreatedDate = Dates.ToDateTime(((HiddenField)gvRow.FindControl("hidCreatedDate")).Value, DateFormat.Format_05)
                });
            }
            var firstOrDefault = designations.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }

            if (_controlPanel.SetDesignation(designations))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.DesignationSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "DESIGNATION SAVED",
                                  GlobalCustomResource.DesignationSaved, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData(BindType.List);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.DesignationFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "DESIGNATION UPDATE FAILED",
                                  GlobalCustomResource.DesignationFailed, true);
            }
        }
Esempio n. 27
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var categories = new Categories();

            lnkAddNew.Enabled = true;
            lnkAddNew.Style.Add("cursor", "Pointer");

            foreach (GridViewRow gvRow in GridViewTable.Rows)
            {
                categories.Add(new Category
                {
                    CatType     = Constants.PartType,
                    CatCode     = FRType,
                    ID          = ((TextBox)gvRow.FindControl("txtID")).Text.ToUpper(),
                    Description = ((TextBox)gvRow.FindControl("txtDesp")).Text,
                    CreatedDate = Dates.ToDateTime(((HiddenField)gvRow.FindControl("hidCreatedDate")).Value.Trim(), DateFormat.Format_01),
                    Action      = (string.IsNullOrEmpty((((HiddenField)gvRow.FindControl("hdnAction")).Value)) ? Constants.UpdateAction : ((HiddenField)gvRow.FindControl("hdnAction")).Value),
                    Suspend     = false
                });
            }
            var firstOrDefault = categories.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }
            var controlPanel = new ControlPanelManager();

            if (controlPanel.SetCategory(categories))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.ModalitySaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "Category SAVED", GlobalCustomResource.ModalitySaved, true);
                BindData(null);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.ModalityFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "Category UPDATE FAILED", GlobalCustomResource.ModalityFailed, true);
            }
        }
Esempio n. 28
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var menus = new Menus();

            foreach (GridViewRow gvRow in gvMenuRights.Rows)
            {
                var checkBox = gvRow.FindControl("chkSelect") as CheckBox;
                if (checkBox != null && checkBox.Checked)
                {
                    menus.Add(new FBTS.Model.Control.Menu
                    {
                        MenuCode  = ((HiddenField)gvRow.FindControl("hidMenuCode")).Value,
                        MenuOrder = Convert.ToDecimal(((TextBox)gvRow.FindControl("txtLevel")).Text)
                    });
                }
            }
            var menuAccessRights = new MenuAccessRights
            {
                AccessLevelId = SelectedAccessLevel,
                AccessRights  = menus,
                DataBaseInfo  = UserContext.DataBaseInfo
            };

            if (_controlPanel.SetMenuAccessRights(menuAccessRights))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.AccessRightSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "ACCESS RIGHT SAVED",
                                  GlobalCustomResource.AccessRightSaved, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData(BindType.List);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.AccessRightFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "ACCESS RIGHT UPDATE FAILED",
                                  GlobalCustomResource.AccessRightFailed, true);
            }
        }
Esempio n. 29
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var units = new Units();

            lnkAddNew.Enabled = true;
            lnkAddNew.Style.Add("cursor", "Pointer");
            foreach (GridViewRow gvRow in GridViewTable.Rows)
            {
                units.Add(new FBTS.Model.Control.Unit
                {
                    Id          = ((TextBox)gvRow.FindControl("txtPrimary")).Text.Trim().ToUpper(),
                    Description = ((TextBox)gvRow.FindControl("txtSecondary")).Text.Trim().ToUpper(),
                    Suspend     = ((HiddenField)gvRow.FindControl("hidSuspend")).Value.Trim().ToBool(),
                    Action      = (string.IsNullOrEmpty((((HiddenField)gvRow.FindControl("hdnAction")).Value)) ? Constants.UpdateAction : ((HiddenField)gvRow.FindControl("hdnAction")).Value),
                });
            }
            var firstOrDefault = units.FirstOrDefault();

            if (firstOrDefault != null)
            {
                firstOrDefault.DataBaseInfo = UserContext.DataBaseInfo;
            }

            if (_controlPanel.SetUom(units))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UOMSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "UOM SAVED",
                                  GlobalCustomResource.UOMSaved, true);
                lnkAddNew.Enabled = true;
                lnkAddNew.Style.Add("cursor", "Pointer");
                BindData();
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UOMFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "UOM UPDATE FAILED",
                                  GlobalCustomResource.UOMFailed, true);
            }
        }
Esempio n. 30
0
        protected void lnkSaveAccessLevel_Click(object sender, EventArgs e)
        {
            var menus = new Menus();

            foreach (GridViewRow gvRow in gvMenuRights.Rows)
            {
                var checkBox = gvRow.FindControl("chkSelect") as CheckBox;
                if (checkBox != null && checkBox.Checked)
                {
                    menus.Add(new FBTS.Model.Control.Menu
                    {
                        MenuCode  = ((HiddenField)gvRow.FindControl("hidMenuCode")).Value,
                        MenuOrder = Convert.ToDecimal(((TextBox)gvRow.FindControl("txtLevel")).Text)
                    });
                }
            }
            var menuAccessRights = new MenuAccessRights
            {
                UserId       = UserCode,
                AccessRights = menus,
                DataBaseInfo = UserContext.DataBaseInfo
            };

            //UserProfilePresenter.SaveMenuRights(menuAccessRights)
            if (_controlPanel.SetMenuAccessRights(menuAccessRights))
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileSaved;
                CustomMessageControl.MessageType     = MessageTypes.Success;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE SAVED",
                                  GlobalCustomResource.UserProfileSaved, true);
            }
            else
            {
                CustomMessageControl.MessageBodyText = GlobalCustomResource.UserProfileFailed;
                CustomMessageControl.MessageType     = MessageTypes.Error;
                CustomMessageControl.ShowMessage();
                AuditLog.LogEvent(UserContext, SysEventType.INFO, "USERPROFILE UPDATE FAILED",
                                  GlobalCustomResource.UserProfileFailed, true);
            }
        }