public void Login(string name, string pwd, out int facility_id)
        {
            facility_id = 0;

            UserAccount account = new UserAccount(name);

            if (!account.IsValid(name, pwd))
            {
                return;
            }

            FacilityDS.FacilityDSDataTable dt = BllProxyFacility.GetFacilityByUser(account.UserId);
            if (dt.Rows.Count == 0)
            {
                return;
            }

            facility_id = dt[0].facility_id;
        }
Esempio n. 2
0
        protected override void OnLoad(EventArgs e)
        {
            string userName     = this.UserName;
            bool   isAuthorized = this.IsAuthorized;

            MasterKiosk ucMasterPage = (MasterKiosk)this.Master;

            ucMasterPage.ShowTheContent(this.IsAuthorized);



            if (!this.Page.IsPostBack)
            {
                if (this.UserId != 0)
                {
                    FacilityDS.FacilityDSDataTable dt = BllProxyFacility.GetFacilityByUser(this.UserId);

                    facilityId = 0;
                    if (dt.Rows.Count == 0)
                    {
                        this.SetFacilityName("No Facility assigned to the username: "******"Logged out...");
                }
            }



            base.OnLoad(e);
        }
        private void BindGroups()
        {
            string      userName = TextBoxUserName.Text;
            string      password = TextBoxPassword.Text;
            UserAccount account  = new UserAccount(userName);

            if (account.IsValid(userName, password))
            {
                FacilityDS.FacilityDSDataTable dt = BllProxyFacility.GetFacilityByUser(account.UserId);
                if (dt.Rows.Count > 0)
                {
                    int facilityId = dt[0].facility_id;

                    FacilityDS.FacilityGroupDSDataTable facilityGroupdt = BllProxyFacilityGroup.GetAllFacilityGroups(facilityId);
                    FacilityDS.FacilityGroupDSRow[]     rows            = (FacilityDS.FacilityGroupDSRow[])facilityGroupdt.Select("facility_id is not NULL");
                    ddlGroup.DataSource = rows;
                    ddlGroup.DataBind();
                }
            }
        }
Esempio n. 4
0
        protected override void save()
        {
            //if (userId != 0)
            //{

            FacilityDS.FacilityDSDataTable dt = BllProxyFacility.GetFacilityByUser(this.UcAppPage.UserId);



            bool isUserUnique = false;

            if (dt.Rows.Count != 0)
            {
                if (this.UcAppPage.UserId == dt[0].user_id)
                {
                    isUserUnique = true;
                }
            }
            else
            {
                isUserUnique = true;
            }



            if (isUserUnique)
            {
                try
                {
                    if (profileId == 0)
                    {
                        //if (userId == 0)
                        //    userId = this.GetCurrentUserId();

                        Parameter objUserIdParameter = new Parameter("user_id", DbType.Int32);
                        objUserIdParameter.DefaultValue = userId.ToString();
                        objectdatasourceEdit.InsertParameters["user_id"] = objUserIdParameter;


                        Parameter objSurveyIdParameter = new Parameter("survey_id", DbType.Int32);
                        objSurveyIdParameter.DefaultValue = surveyId.ToString();
                        objectdatasourceEdit.InsertParameters["survey_id"] = objSurveyIdParameter;


                        this.dvControl.InsertItem(true);
                    }
                    else
                    {
                        this.dvControl.UpdateItem(true);
                    }
                }
                catch
                {
                    this.showErrorMessage("Profile cannot be saved!");
                }
            }
            else
            {
                this.showErrorMessage("User is assigned to another Facility");
            }

            //}
            //else
            //{
            //    this.showErrorMessage("User cannot be left blank!");
            //}
        }