예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["Mode"] == null)
                {
                    Response.Redirect("UserInfo.aspx?Mode=New");
                }
                if (Request.QueryString != null)
                {
                    txtID.Enabled  = false;
                    txtUID.Enabled = false;

                    string mode = Request.QueryString["Mode"];
                    switch (mode)
                    {
                    case "View":

                        break;

                    case "New":

                        btnSave.Visible = true;


                        btnEdit.Visible = false;
                        break;

                    case "Edit":

                        int x = Convert.ToInt32(Request.QueryString["UserID"]);
                        loadPerson(x);
                        loadUser(x);
                        txtID.Text = x.ToString();

                        break;
                    }
                    if (Request.QueryString["UserID"] != null)
                    {
                        int PersonID = Convert.ToInt32(Request.QueryString["UserID"]);
                        int UserID   = Convert.ToInt32(Request.QueryString["UserID"]);
                        BusinessObjects.Person person = new BusinessObjects.Person(PersonID);
                        BusinessObjects.User   user   = new BusinessObjects.User(UserID);

                        txtFirstName.Enabled = false;
                        txtLastName.Enabled  = false;
                        txtTitle.Enabled     = false;
                        txtUsername.Enabled  = false;
                        txtPassword.Enabled  = false;
                        btnSave.Visible      = false;
                    }

                    if (Request.QueryString["UserID"] == null)
                    {
                        //   Request.QueryString["Mode"] = "New";
                        //Response.Redirect("UserInfo.aspx?Mode=New");
                    }
                }
            }
        }
예제 #2
0
        public void loadUser(int id)
        {
            BusinessObjects.User user = new BusinessObjects.User(id);
            DataSet ds = new DataSet();

            user.id          = id;
            txtUID.Text      = user.id.ToString();
            txtUsername.Text = user.Username.ToString();
            txtPassword.Text = user.Password.ToString();


            //txtUID.Text = ds.Tables[0].Rows[0]["UserID"].ToString();
            //txtUsername.Text = ds.Tables[0].Rows[0]["Username"].ToString();
            //txtPassword.Text = ds.Tables[0].Rows[0]["Password"].ToString();



            //DataPortal.UserData ud = new DataPortal.UserData();
            //DataSet ds = new DataSet();
            //int UserID = id;
            //ds = ud.Fetch(UserID);

            //object uid = ds.Tables[0].Rows[0]["UserID"].ToString();
            //object un = ds.Tables[0].Rows[0]["Username"].ToString();
            //object pw = ds.Tables[0].Rows[0]["Password"].ToString();

            //txtUID.Text = uid.ToString();
            //txtUsername.Text = un.ToString();
            //txtPassword.Text = pw.ToString();
        }
예제 #3
0
        public void loadUser(int id)
        {
            BusinessObjects.User user = new BusinessObjects.User(id);
            DataSet ds = new DataSet();

            user.id = id;
            txtUID.Text = user.id.ToString();
            txtUsername.Text = user.Username.ToString();
            txtPassword.Text = user.Password.ToString();

            //txtUID.Text = ds.Tables[0].Rows[0]["UserID"].ToString();
            //txtUsername.Text = ds.Tables[0].Rows[0]["Username"].ToString();
            //txtPassword.Text = ds.Tables[0].Rows[0]["Password"].ToString();

            //DataPortal.UserData ud = new DataPortal.UserData();
            //DataSet ds = new DataSet();
            //int UserID = id;
            //ds = ud.Fetch(UserID);

            //object uid = ds.Tables[0].Rows[0]["UserID"].ToString();
            //object un = ds.Tables[0].Rows[0]["Username"].ToString();
            //object pw = ds.Tables[0].Rows[0]["Password"].ToString();

            //txtUID.Text = uid.ToString();
            //txtUsername.Text = un.ToString();
            //txtPassword.Text = pw.ToString();
        }
예제 #4
0
        protected void lnkbtnsave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BusinessObjects.User user = new BusinessObjects.User();

                long ret = -1;
                if (!objusr.GetPwd(Convert.ToInt64(Session["uid"].ToString())).ToString().Equals(ClsUtility.MD5Hash(txtcurrpwd.Text)))
                {
                    lblmsg.Text = "Please enter correct Current Password";
                }
                else
                {
                    user.Password = ClsUtility.MD5Hash(txtnewpwd.Text.Trim().ToString());
                    user.UserId   = Convert.ToInt32(Session["Uid"].ToString());
                    ret           = objusr.Changepwd(user);
                    if (ret > 0)
                    {
                        lblmsg.Text = "password change successfully";
                    }
                    else
                    {
                        lblmsg.Text = "Password changing failed";
                    }
                }
            }
        }
예제 #5
0
 protected void btnsignup_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         BusinessObjects.User user = new BusinessObjects.User();
         long ret = -1;
         user.FirstName   = txtfirstname.Text;
         user.LastName    = txtlastname.Text;
         user.Password    = ClsUtility.MD5Hash(txtpassword.Text.Trim().ToString());
         user.EmailId     = txtemailid.Text;
         user.MobileNo    = txtmobileno.Text;
         user.Birthdate   = Convert.ToDateTime(txtbirthdate.Text.ToString());
         user.UserTypeId  = (ddlusertype.SelectedValue.ToString());
         user.Gender      = rbgender.SelectedItem.Text;
         user.requestedBy = "0";
         ret = objuser.InsertUser(user);
         if (ret > 0)
         {
             Response.Redirect("VerifyUsers.aspx");
         }
         else
         {
             lblmsg.Text = "Registration failed, please try after sometime";
         }
     }
     //call insert user here
 }
        public ResourcePool CreateUPOSample(User user)
        {
            const int numberOfItems = 1;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "UPO",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price"; // TODO It does not fit! Update this after having Initial Amount on RP!
            mainElement.MultiplierField.Name = "Number of Sales";

            // Items, cell, user cells
            // TODO How about ToList()[0]?
            mainElement.ElementItemSet.First().Name = "UPO";

            // Return
            return resourcePool;
        }
예제 #7
0
 protected void btnlogin_Click(object sender, EventArgs e)
 {
     BusinessObjects.User user = new BusinessObjects.User();
     user.EmailId  = txtunm.Text;
     user.Password = ClsUtility.MD5Hash(txtpwd.Text);
     user          = objusr.CheckLogin(user);
     if (user.UserId == 0)
     {
         lblmsg.Text = "Invalid UserName or Password, Please try again";
         return;
     }
     else
     {
         Session["uid"]      = user.UserId.ToString();
         Session["fullname"] = user.FirstName + user.LastName;
         if (user.UserTypeId.Equals("1"))
         {
             Response.Redirect("Admin/WebAdminHome.aspx");
         }
         else if (user.UserTypeId.Equals("2"))
         {
             Response.Redirect("Admin/WebSellerHome.aspx");
         }
         else if (user.UserTypeId.Equals("3"))
         {
             Response.Redirect("Admin/WebClientHome.aspx");
         }
     }
 }
        public ResourcePool CreateBasicsNewSystemSample(User user)
        {
            const int numberOfItems = 4;
            
            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Basics - New Model",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: true,
                numberOfItems: numberOfItems);

            // Main element
            var mainElement = resourcePool.ElementSet.First();

            // Fields
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            
            mainElement.ElementFieldSet.Single(item => item.IndexEnabled).Name = "Employee Satisfaction";

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Alpha";
            mainElement.ElementItemSet.Skip(1).First().Name = "Beta";
            mainElement.ElementItemSet.Skip(2).First().Name = "Charlie";
            mainElement.ElementItemSet.Skip(3).First().Name = "Delta";

            // Return
            return resourcePool;
        }
예제 #9
0
 protected void btnsave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         BusinessObjects.User user = new BusinessObjects.User();
         long ret = -1;
         user.FirstName  = txtfirstName.Text;
         user.LastName   = txtlastname.Text;
         user.EmailId    = txtemailid.Text;
         user.MobileNo   = txtmobileno.Text;
         user.Birthdate  = Convert.ToDateTime(txtbirthdate.Text);
         user.Gender     = rbgender.SelectedItem.Text;
         user.UserId     = Convert.ToInt64(Session["uid"]);
         user.UserTypeId = ddlusertype.SelectedValue;
         ret             = objuser.Updateuser(user);
         if (ret > 0)
         {
             Response.Redirect("#");
         }
         else
         {
             lblmsg.Text = "Profile update failed, please try after sometime";
         }
     }
 }
예제 #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //DataPortal.PersonPhoneData ppd = new DataPortal.PersonPhoneData();
            //DataSet ds = new DataSet();
            //DataPortal.PersonData pd = new DataPortal.PersonData();

            switch (Request.QueryString["Mode"])
            {
            case "New":

                BusinessObjects.User user = new BusinessObjects.User();
                //set all of the properties of the user object then call the user.save
                user.Title      = txtTitle.Text;
                user.FirstName  = txtFirstName.Text;
                user.LastName   = txtLastName.Text;
                user.Password   = txtPassword.Text;
                user.Username   = txtUsername.Text;
                user.UserExists = true;

                user.Save();
                txtUsername.Enabled  = false;
                txtPassword.Enabled  = false;
                txtTitle.Enabled     = false;
                txtFirstName.Enabled = false;
                txtLastName.Enabled  = false;
                btnEdit.Visible      = true;
                btnSave.Visible      = false;

                //// txtID.Text = user.id.ToString();
                txtUID.Text = user.ID.ToString();
                int x = user.id;
                Response.Redirect("UserInfo.aspx?Mode=Edit&UserID=" + x);
                break;

            case "Edit":

                // x = Convert.ToInt32(txtID.Text);

                user            = new BusinessObjects.User();
                user.id         = Convert.ToInt32(txtID.Text);
                user.Title      = txtTitle.Text;
                user.FirstName  = txtFirstName.Text;
                user.LastName   = txtLastName.Text;
                user.Password   = txtPassword.Text;
                user.Username   = txtUsername.Text;
                user.UserExists = true;

                user.Save();
                btnEdit.Visible = true;
                btnSave.Visible = false;
                textDisable();

                break;
            }
        }
예제 #11
0
        //public IEnumerable<User> GetAllProducts()
        //{
        //    BusinessObjects.User user = new BusinessObjects.User();
        //    return ;
        //}

        public IHttpActionResult GetUserById(Guid id)
        {
            User user = new BusinessObjects.User();

            user = user.GetById(id);
            if (user == null)
            {
                return(NotFound());
            }
            return(Ok(user));
        }
예제 #12
0
        protected void btnForgotPassword_Click(object sender, EventArgs e)
        {
            User user = new BusinessObjects.User();

            user = user.ForgotPassword(txtEmail.Text);
            if (user == null)
            {
                lblStatus.Text = "No email found";
            }
            else
            {
                lblStatus.Text = "Check your email for your password";
            }
        }
예제 #13
0
 protected void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         User user = new BusinessObjects.User();
         user = user.Register(txtEmail.Text);
         if (user == null)
         {
             lblStatus.Text = "Email was not sent.";
         }
     }
     catch (Exception ex)
     {
         lblStatus.Text = ex.Message;
     }
 }
예제 #14
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            User user = new BusinessObjects.User();

            user = user.Login(txtEmail.Text, txtPassword.Text);
            if (user == null)
            {
                lblStatus.Text = "Invalid User Name or password";
            }
            else if (user.Version == 0)
            {
                Session["User"] = user;
                Response.Redirect("ChangePassword.aspx");
            }
            else
            {
                Session["User"] = user;
                Response.Redirect("../index.aspx");
            }
        }
예제 #15
0
파일: DTO.cs 프로젝트: BszCsharp/zalando
        public Boolean SaveNewUser(User u)
        {
            Boolean result = true;
            if(openConnection())
            {
                OleDbCommand cmd = con.CreateCommand();
                cmd.Parameters.AddWithValue("email", u.Email);
                cmd.Parameters.AddWithValue("Pw", u.Kennwort);
                cmd.CommandText = "Insert Into tUser(Email,Passwort) Values(email,Pw)";
                try
                {
                    cmd.ExecuteNonQuery();

                }
                catch (Exception)
                {

                    ;
                }
            }
            return result;
        }
예제 #16
0
파일: DTO.cs 프로젝트: BszCsharp/zalando
        public User getUserByEmail(String email)
        {
            User u = null;;

            if(openConnection())
            {
                OleDbCommand cmd = con.CreateCommand();
                cmd.CommandText = "Select * From tUser where Email = '" + email + "';";
                OleDbDataReader reader =  cmd.ExecuteReader();
                if(reader.Read())
                {

                    u = new User();
                    u.Id = reader.GetInt32(0);
                    u.Email = reader.GetString(1);
                    u.Kennwort = reader.GetString(2);
                }

            }
            con.Close();
            return u;
        }
예제 #17
0
        private void filldata()
        {
            BusinessObjects.User user = new BusinessObjects.User();
            user.UserId = Convert.ToInt64(Session["uid"]);
            user        = objuser.AllUserById(user);

            if (user.UserId != 0)
            {
                txtfirstName.Text         = user.FirstName;
                txtlastname.Text          = user.LastName;
                txtmobileno.Text          = user.MobileNo;
                txtemailid.Text           = user.EmailId;
                txtbirthdate.Text         = user.Birthdate.ToString();
                ddlusertype.SelectedValue = user.UserTypeId;
                if (user.Gender == "Male")
                {
                    rbgender.Items[0].Selected = true;
                }
                else
                {
                    rbgender.Items[1].Selected = true;
                }
            }
        }
        public ResourcePool CreateKnowledgeIndexSample(User user)
        {
            const int numberOfItems = 2;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Knowledge Index Sample",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // License element
            var licenseElement = resourcePool.AddElement("License");

            // Fields
            var rightToUseField = licenseElement.AddField("Right to Use", ElementFieldDataType.String);
            var rightToCopyField = licenseElement.AddField("Right to Copy", ElementFieldDataType.String);
            var rightToModifyField = licenseElement.AddField("Right to Modify", ElementFieldDataType.String);
            var rightToSellField = licenseElement.AddField("Right to Sell", ElementFieldDataType.String);
            var licenseRatingField = licenseElement.AddField("License Rating", ElementFieldDataType.Decimal, false);
            licenseRatingField.EnableIndex();

            // Items, cell, user cells
            var restrictedLicense = licenseElement.AddItem("Restricted License")
                .AddCell(rightToUseField).SetValue("Yes").ElementItem
                .AddCell(rightToCopyField).SetValue("No").ElementItem
                .AddCell(rightToModifyField).SetValue("No").ElementItem
                .AddCell(rightToSellField).SetValue("No").ElementItem
                .AddCell(licenseRatingField).ElementItem;

            var openSourceLicense = licenseElement.AddItem("Open Source License")
                .AddCell(rightToUseField).SetValue("Yes").ElementItem
                .AddCell(rightToCopyField).SetValue("Yes").ElementItem
                .AddCell(rightToModifyField).SetValue("Yes").ElementItem
                .AddCell(rightToSellField).SetValue("Yes").ElementItem
                .AddCell(licenseRatingField).ElementItem;

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            var licenseField = mainElement.AddField("License", ElementFieldDataType.Element);
            licenseField.SelectedElement = licenseElement;

            // Items, cell, user cells
            // TODO How about ToList()[0]?
            mainElement.ElementItemSet.Skip(0).First().Name = "Commercial Organization";
            mainElement.ElementItemSet.Skip(0).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(1).First().Name = "Open Source Organization";
            mainElement.ElementItemSet.Skip(1).First().AddCell(licenseField).SetValue(openSourceLicense);
            //mainElement.ElementItemSet.Skip(2).First().Name = "Commercial Organization B";
            //mainElement.ElementItemSet.Skip(2).First().AddCell(licenseField).SetValue(restrictedLicense);
            //mainElement.ElementItemSet.Skip(3).First().Name = "Open Source Organization B";
            //mainElement.ElementItemSet.Skip(3).First().AddCell(licenseField).SetValue(openSourceLicense);

            // Return
            return resourcePool;
        }
        public ResourcePool CreateDefaultResourcePool(User user, string resourcePoolName, bool useFixedResourcePoolRate, string mainElementName, bool addDirectIncomeField, bool addMultiplierField, bool addImportanceIndex, int numberOfItems)
        {
            // Resource pool, main element, fields
            var resourcePool = new ResourcePool(user, resourcePoolName);

            if (useFixedResourcePoolRate)
            {
                resourcePool.UseFixedResourcePoolRate = true;
                resourcePool.AddUserResourcePool(10);
            }

            // Main element
            var element = resourcePool.AddElement(mainElementName);
            element.IsMainElement = true;

            // Resource pool field
            if (addDirectIncomeField)
                element.AddField("Direct Income", ElementFieldDataType.DirectIncome, true);

            // Multiplier field
            if (addMultiplierField)
                element.AddField("Multiplier", ElementFieldDataType.Multiplier);

            // Importance field
            ElementField importanceField = null;
            if (addImportanceIndex)
            {
                importanceField = element.AddField("Importance Field", ElementFieldDataType.Decimal, false);
                importanceField.EnableIndex();
            }

            // Items, cells, user cells
            for (var i = 1; i <= numberOfItems; i++)
            {
                var itemName = string.Format("Item {0}", i);

                var item = element.AddItem(itemName);

                if (addDirectIncomeField)
                    item.AddCell(element.DirectIncomeField).SetValue(100M); // Default value

                if (addMultiplierField)
                    item.AddCell(element.MultiplierField);

                if (addImportanceIndex)
                    item.AddCell(importanceField);
            }

            // Return
            return resourcePool;
        }
예제 #20
0
 public static Entities.User ConvertModelToEntity(BusinessObjects.User entityData)
 {
     return(TswMapper.Map <Entities.User>(entityData));
 }
        public ResourcePool CreateResourcePoolRateSample(User user)
        {
            const int numberOfItems = 4;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "CMRP Rate",
                useFixedResourcePoolRate: false,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            //// Fair share element
            //var fairShareElement = resourcePool.AddElement("Fair Share");

            //// Fields
            //var fairShareDesciptionField = fairShareElement.AddField("Description", ElementFieldDataType.String);
            //var fairShareImportanceField = fairShareElement.AddField("Rating", ElementFieldDataType.Decimal, false);
            //fairShareImportanceField.AddIndex("Fair Share Index");

            //// Items, cell, user cells
            //decimal ratingPerItem = 100 / 2;
            //var fairShareYesItem = fairShareElement.AddItem("Sharer")
            //    .AddCell(fairShareDesciptionField).SetValue("The organization shares it's income with its employees based on their contributions").ElementItem
            //    .AddCell(fairShareImportanceField).SetValue(ratingPerItem, user).ElementItem;

            //var fairShareNoItem = fairShareElement.AddItem("Keeper")
            //    .AddCell(fairShareDesciptionField).SetValue("The owner of the organization keeps all the income to himself, ignores the contributions").ElementItem
            //    .AddCell(fairShareImportanceField).SetValue(ratingPerItem, user).ElementItem;

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";

            // 1. index
            //mainElement.ResourcePoolField.AddIndex("Total Cost Index", ElementFieldIndexSortType.LowestToHighest);

            //mainElement.ElementFieldSet.Single(item => item.ElementFieldIndexSet.Any()).Name = "Rating";
            //mainElement.ElementFieldSet.Single(item => item.ElementFieldIndexSet.Any()).ElementFieldIndex.Name = "Employee Satisfaction";

            // 2. index
            var veryImportantField = resourcePool.ElementSet.First().AddField("Very Important Index", ElementFieldDataType.Decimal, false);
            veryImportantField.EnableIndex();

            // 3. index
            //var importanceField2 = resourcePool.ElementSet.First().AddField("Importance Field 2", ElementFieldDataType.Decimal, false);
            //importanceField2.AddIndex("Importance Index 2");

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Alpha";
            //mainElement.ElementItemSet.Skip(0).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(0).First().AddCell(veryImportantField);

            mainElement.ElementItemSet.Skip(1).First().Name = "Beta";
            //mainElement.ElementItemSet.Skip(1).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(1).First().AddCell(veryImportantField);

            mainElement.ElementItemSet.Skip(2).First().Name = "Charlie";
            //mainElement.ElementItemSet.Skip(2).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(2).First().AddCell(veryImportantField);

            mainElement.ElementItemSet.Skip(3).First().Name = "Delta";
            //mainElement.ElementItemSet.Skip(3).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(3).First().AddCell(veryImportantField);

            //mainElement.ElementItemSet.Skip(1).First().AddCell(importanceField2).SetValue(25M);

            // mainElement.ElementItemSet.Skip(1).First().Name = "Organization B";
            // var fairShareField = mainElement.AddField("Fair Share", ElementFieldDataType.Element);
            // fairShareField.SelectedElement = fairShareElement;

            // Items, cell, user cells
            //mainElement.ElementItemSet.Skip(0).First().Name = "Income Keeper Inc.";
            //mainElement.ElementItemSet.Skip(0).First().AddCell(fairShareField).SetValue(fairShareNoItem);

            //mainElement.ElementItemSet.Skip(1).First().Name = "Fair Sharer Org.";
            //mainElement.ElementItemSet.Skip(1).First().AddCell(fairShareField).SetValue(fairShareYesItem);

            // Return
            return resourcePool;
        }
        public ResourcePool CreateIndexesPieSample(User user)
        {
            const int numberOfItems = 1;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Indexes Pie",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);
            
            //resourcePool.EnableSubtotals = false;

            //// Fair share element
            //var fairShareElement = resourcePool.AddElement("Fair Share");

            //// Fields
            //var fairShareDesciptionField = fairShareElement.AddField("Description", ElementFieldDataType.String);
            //var fairShareImportanceField = fairShareElement.AddField("Rating", ElementFieldDataType.Decimal, false);
            //fairShareImportanceField.AddIndex("Fair Share Index");

            //// Items, cell, user cells
            //decimal ratingPerItem = 100 / 2;
            //var fairShareYesItem = fairShareElement.AddItem("Sharer")
            //    .AddCell(fairShareDesciptionField).SetValue("The organization shares it's income with its employees based on their contributions").ElementItem
            //    .AddCell(fairShareImportanceField).SetValue(ratingPerItem, user).ElementItem;

            //var fairShareNoItem = fairShareElement.AddItem("Keeper")
            //    .AddCell(fairShareDesciptionField).SetValue("The owner of the organization keeps all the income to himself, ignores the contributions").ElementItem
            //    .AddCell(fairShareImportanceField).SetValue(ratingPerItem, user).ElementItem;

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";

            // Sector Index
            var sectorField = resourcePool.ElementSet.First().AddField("Sector", ElementFieldDataType.Decimal, true);
            sectorField.EnableIndex();

            // Knowledge Index
            var licenseField = resourcePool.ElementSet.First().AddField("License", ElementFieldDataType.Decimal, true);
            licenseField.EnableIndex();

            // Total Cost Index
            mainElement.DirectIncomeField.EnableIndex(ElementFieldIndexSortType.LowestToHighest);

            // Fair Share Index
            var fairShareField = resourcePool.ElementSet.First().AddField("Fair Share", ElementFieldDataType.Decimal, true);
            fairShareField.EnableIndex();

            //mainElement.ElementFieldSet.Single(item => item.ElementFieldIndexSet.Any()).Name = "Rating";
            //mainElement.ElementFieldSet.Single(item => item.ElementFieldIndexSet.Any()).ElementFieldIndex.Name = "Employee Satisfaction";

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "One and Only";
            mainElement.ElementItemSet.Skip(0).First().AddCell(sectorField).SetValue(50M);
            mainElement.ElementItemSet.Skip(0).First().AddCell(licenseField).SetValue(50M);
            // mainElement.ElementItemSet.Skip(0).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(0).First().AddCell(fairShareField).SetValue(50M);

            //mainElement.ElementItemSet.Skip(1).First().Name = "Organization B";
            //mainElement.ElementItemSet.Skip(1).First().DirectIncomeCell.SetValue(100M);
            //mainElement.ElementItemSet.Skip(1).First().AddCell(sectorField).SetValue(50M);
            //mainElement.ElementItemSet.Skip(1).First().AddCell(licenseField).SetValue(25M);

            // mainElement.ElementItemSet.Skip(1).First().Name = "Organization B";
            // var fairShareField = mainElement.AddField("Fair Share", ElementFieldDataType.Element);
            // fairShareField.SelectedElement = fairShareElement;

            // Items, cell, user cells
            //mainElement.ElementItemSet.Skip(0).First().Name = "Income Keeper Inc.";
            //mainElement.ElementItemSet.Skip(0).First().AddCell(fairShareField).SetValue(fairShareNoItem);

            //mainElement.ElementItemSet.Skip(1).First().Name = "Fair Sharer Org.";
            //mainElement.ElementItemSet.Skip(1).First().AddCell(fairShareField).SetValue(fairShareYesItem);

            // Return
            return resourcePool;
        }
        public ResourcePool CreateTotalCostIndexSampleOld(User user)
        {
            const int numberOfItems = 2;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Total Cost Index Sample",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";

            // Resource pool index; use to Sales Price itself
            resourcePool.ElementSet.First().DirectIncomeField.EnableIndex(ElementFieldIndexSortType.LowestToHighest);

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Lowlands";
            mainElement.ElementItemSet.Skip(0).First().DirectIncomeCell.SetValue(125M);
            mainElement.ElementItemSet.Skip(1).First().Name = "High Coast";
            mainElement.ElementItemSet.Skip(1).First().DirectIncomeCell.SetValue(175M);

            // Return
            return resourcePool;
        }
        public ResourcePool CreateTotalCostIndexExistingSystemSample(User user)
        {
            const int numberOfItems = 3;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Total Cost Index - Existing Model",
                useFixedResourcePoolRate: true,
                mainElementName: "Product",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Main element
            var mainElement = resourcePool.ElementSet.First();

            // Fields
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Average Profit";
            mainElement.ElementItemSet.Skip(0).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(1).First().Name = "High Profit";
            mainElement.ElementItemSet.Skip(1).First().DirectIncomeCell.SetValue(120M);
            mainElement.ElementItemSet.Skip(2).First().Name = "No Profit";
            mainElement.ElementItemSet.Skip(2).First().DirectIncomeCell.SetValue(100M);

            // Return
            return resourcePool;
        }
예제 #25
0
 public Boolean ChangeUser(User user)
 {
     InitDB();
     User newUser = new User();
     newUser.LoadByPrimaryKey((long)user.Id);
     newUser.Fullname = user.Fullname;
     newUser.Loginid = user.Loginid;
     newUser.Groupid = user.Groupid;
     newUser.Password = user.Password;
     Boolean functionResult = false;
     try
     {
         newUser.Save();
         functionResult = true;
     }
     catch (Exception ex)
     {
         functionResult = false;
     }
     return functionResult;
 }
예제 #26
0
        protected void Insert(object sender, EventArgs e)
        {
            try
            {
                User currentUser = new UserController().GetUser(Context.User.Identity.Name);
                if (txtNewUserName.Text == "")
                {
                    General.ShowAlertMessage("Name field is required!");
                }

                else
                {
                    if (isValidUser())
                    {
                        User   u             = new User();
                        string strUserID     = string.Empty;
                        bool   CreateMapping = true;
                        bool   success       = false;
                        bool   isAdmin       = Convert.ToBoolean(ddlIsAdmin.SelectedValue);
                        if (txtMobileNo.Text != string.Empty)
                        {
                            u = new UserController().GetUserbyMobile(txtMobileNo.Text.Trim());
                            if (u != null)
                            {
                                strUserID = u.UserID;
                                if (u.UserGroup.Select(ss => ss.UserGroupID).Contains(Convert.ToInt32(GroupID)))
                                {
                                    CreateMapping = false;
                                }
                            }
                        }
                        if (txtEmailID.Text != string.Empty)
                        {
                            u = new UserController().GetUserbyEmail(txtEmailID.Text.Trim());
                            if (u != null)
                            {
                                strUserID = u.UserID;
                                if (u.UserGroup.Select(ss => ss.UserGroupID).Contains(Convert.ToInt32(GroupID)))
                                {
                                    CreateMapping = false;
                                }
                            }
                        }

                        if (u == null)
                        {
                            u = new BusinessObjects.User();
                            string CouponCode = string.Empty;
                            u.FirstName               = txtNewUserName.Text;
                            u.EMail                   = txtEmailID.Text;
                            u.MobileNo                = txtMobileNo.Text;
                            u.CreateDate              = DateTime.Now;
                            u.DOB                     = Convert.ToDateTime("1/1/1900");
                            u.LastLockoutDate         = DateTime.Now;
                            u.LastLoginDate           = DateTime.Now;
                            u.LastPasswordChangedDate = DateTime.Now;
                            u.CouponCode              = CouponCode;
                            u.IsDeleted               = false;
                            u.IsLockedOut             = false;
                            u.PWD                     = Encryption.Encrypt("ab@345");
                            //if (litFlowType.Text == "1" && !isAdmin)
                            //{
                            //    u.IsLockedOut = true;
                            //    u.PWD = string.Empty;
                            //}
                            u.RoleID  = 4;
                            u.Custom1 = txtRollNo.Text;
                            u.Custom2 = rdGender.SelectedValue;
                            u.Custom3 = txtDOJ.Text;
                            u.Custom4 = txtDesignation.Text;
                            u.Custom5 = "1";//This field is used Type of Flow that it should go

                            u.Session  = General.GetCurrentSession;
                            u.ClientID = Convert.ToInt32(litClientID.Text);
                            strUserID  = new UserController().CreateUser(u);
                        }



                        if (CreateMapping)
                        {
                            UserGroupMapping objUserGroupMapping = new UserGroupMapping();
                            objUserGroupMapping.UserGroupID      = GroupID;
                            objUserGroupMapping.UserID           = strUserID;
                            objUserGroupMapping.isAdmin          = Convert.ToBoolean(ddlIsAdmin.SelectedValue);
                            objUserGroupMapping.SerialNoForGroup = txtRollNo.Text;
                            string strMsg = new UserController().CreateUserGroupMapping(objUserGroupMapping);
                            success = true;
                        }

                        if (success == true)
                        {
                            General.ShowAlertMessage("Success");
                            this.bindGvContacts();
                            txtNewUserName.Text = string.Empty;;
                            txtEmailID.Text     = string.Empty;
                            txtMobileNo.Text    = string.Empty;
                            ErrorMessage.Text   = "The temporary password for the user is ab@345";
                        }
                        else
                        {
                            ErrorMessage.Text = "This User already exists!";
                        }
                    }

                    else
                    {
                        General.ShowAlertMessage("Invalid User! Please verify the data and try again");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessage.Text = ex.Message;
            }
        }
예제 #27
0
 public Boolean InsertCSScreen(CSScreen screen)
 {
     InitDB();
     User newUser = new User();
     CSScreen newScreen = new CSScreen();
     newScreen.Computername = screen.Computername;
     newScreen.Computerlocation = screen.Computerlocation;
     newScreen.Hardwareid = screen.Hardwareid;
     newScreen.Isdirectional = screen.Isdirectional;
     newScreen.Screenlocation = screen.Screenlocation;
     newScreen.Screennumber = screen.Screennumber;
     newScreen.Thumbnail = screen.Thumbnail;
     newScreen.Thumbnaildatetime = screen.Thumbnaildatetime;
     newScreen.Defaulttemplate = screen.Defaulttemplate;
     Boolean functionResult = false;
     try
     {
         newScreen.Save();
         functionResult = true;
     }
     catch (Exception ex)
     {
         functionResult = false;
     }
     return functionResult;
 }
예제 #28
0
 public void TestInitialize()
 {
     target = new User();
 }
예제 #29
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //DataPortal.PersonPhoneData ppd = new DataPortal.PersonPhoneData();
            //DataSet ds = new DataSet();
            //DataPortal.PersonData pd = new DataPortal.PersonData();

            switch (Request.QueryString["Mode"])
            {

                case "New":

                   BusinessObjects.User user = new BusinessObjects.User();
                        //set all of the properties of the user object then call the user.save
                   user.Title = txtTitle.Text;
                   user.FirstName = txtFirstName.Text;
                   user.LastName = txtLastName.Text;
                   user.Password = txtPassword.Text;
                   user.Username = txtUsername.Text;
                   user.UserExists = true;

                   user.Save();
                   txtUsername.Enabled = false;
                   txtPassword.Enabled = false;
                   txtTitle.Enabled = false;
                   txtFirstName.Enabled = false;
                   txtLastName.Enabled = false;
                   btnEdit.Visible = true;
                   btnSave.Visible = false;

                   //// txtID.Text = user.id.ToString();
                    txtUID.Text = user.ID.ToString();
                    int x = user.id;
                    Response.Redirect("UserInfo.aspx?Mode=Edit&UserID=" + x);
                    break;

                case "Edit":

                   // x = Convert.ToInt32(txtID.Text);

                    user = new BusinessObjects.User();
                    user.id = Convert.ToInt32(txtID.Text);
                    user.Title = txtTitle.Text;
                    user.FirstName = txtFirstName.Text;
                    user.LastName = txtLastName.Text;
                    user.Password = txtPassword.Text;
                    user.Username = txtUsername.Text;
                    user.UserExists = true;

                    user.Save();
                    btnEdit.Visible = true;
                    btnSave.Visible = false;
                    textDisable();

                  break;

            }
        }
        public ResourcePool CreateKnowledgeIndexPopularSoftwareLicenseSampleAlternative(User user)
        {
            const int numberOfItems = 4;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Knowledge Index - Popular Software Licenses",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // License element
            var licenseElement = resourcePool.AddElement("License");

            // Fields
            var linkField = licenseElement.AddField("Link", ElementFieldDataType.String);
            var importanceField = licenseElement.AddField("License Rating", ElementFieldDataType.Decimal, false);
            importanceField.EnableIndex();

            // Items, cell, user cells
            licenseElement.AddItem("Apache-2.0").AddCell(linkField)
                .SetValue("<a href='http://opensource.org/licenses/Apache-2.0' target='_blank'>Link</a>")
                .ElementItem
                .AddCell(importanceField);

            //licenseElement.AddItem("BSD-3-Clause")
            //    .AddCell(linkField).SetValue("<a href='http://opensource.org/licenses/BSD-3-Clause' target='_blank'>Link</a>")
            //    .ElementItem
            //    .AddCell(importanceField).SetValue(ratingPerLicense);

            licenseElement.AddItem("GPL-3.0")
                .AddCell(linkField).SetValue("<a href='http://opensource.org/licenses/GPL-3.0' target='_blank'>Link</a>")
                .ElementItem
                .AddCell(importanceField);

            //licenseElement.AddItem("LGPL-3.0")
            //    .AddCell(linkField).SetValue("<a href='http://opensource.org/licenses/LGPL-3.0' target='_blank'>Link</a>")
            //    .ElementItem
            //    .AddCell(importanceField).SetValue(ratingPerLicense);

            licenseElement.AddItem("MIT")
                .AddCell(linkField).SetValue("<a href='http://opensource.org/licenses/MIT' target='_blank'>Link</a>")
                .ElementItem
                .AddCell(importanceField);

            // TODO Check it again
            licenseElement.AddItem("EULA (Wikipedia)")
                .AddCell(linkField).SetValue("<a href='http://en.wikipedia.org/wiki/End-user_license_agreement' target='_blank'>Link</a>")
                .ElementItem
                .AddCell(importanceField);

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            var licenseField = mainElement.AddField("License", ElementFieldDataType.Element);
            licenseField.SelectedElement = licenseElement;

            // Items, cell, user cells
            // TODO How about ToList()[0]?
            mainElement.ElementItemSet.Skip(0).First().Name = "Apache-2.0 Organization";
            mainElement.ElementItemSet.Skip(0).First().AddCell(licenseField).SetValue(licenseElement.ElementItemSet.Skip(0).First());
            //mainElement.ElementItemSet.Skip(1).First().Name = "BSD-3-Clause Organization";
            //mainElement.ElementItemSet.Skip(1).First().AddCell(licenseField).SetValue(licenseElement.ElementItemSet.Skip(1).First());
            mainElement.ElementItemSet.Skip(1).First().Name = "GPL-3.0 Organization";
            mainElement.ElementItemSet.Skip(1).First().AddCell(licenseField).SetValue(licenseElement.ElementItemSet.Skip(2).First());
            //mainElement.ElementItemSet.Skip(3).First().Name = "LGPL-3.0 Organization";
            //mainElement.ElementItemSet.Skip(3).First().AddCell(licenseField).SetValue(licenseElement.ElementItemSet.Skip(3).First());
            mainElement.ElementItemSet.Skip(2).First().Name = "MIT Organization";
            mainElement.ElementItemSet.Skip(2).First().AddCell(licenseField).SetValue(licenseElement.ElementItemSet.Skip(4).First());
            mainElement.ElementItemSet.Skip(3).First().Name = "EULA Organization";
            mainElement.ElementItemSet.Skip(3).First().AddCell(licenseField).SetValue(licenseElement.ElementItemSet.Skip(5).First());

            // Return
            return resourcePool;
        }
        public ResourcePool CreateKnowledgeIndexPopularSoftwareLicenseSample(User user)
        {
            const int numberOfItems = 4;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Knowledge Index - Popular Software Licenses",
                useFixedResourcePoolRate: true,
                mainElementName: "License",
                addDirectIncomeField: false,
                addMultiplierField: false,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Main element
            var mainElement = resourcePool.ElementSet.First();

            // Fields
            var importanceField = mainElement.AddField("License Rating", ElementFieldDataType.Decimal, false);
            importanceField.EnableIndex();

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "<a href='http://opensource.org/licenses/Apache-2.0' target='_blank'>Apache-2.0</a>";
            //mainElement.ElementItemSet.Skip(0).First().Name = "Apache-2.0";
            //mainElement.ElementItemSet.Skip(0).First().NameCell.SetValue("<a href='http://opensource.org/licenses/Apache-2.0' target='_blank'>Apache-2.0</a>");
            mainElement.ElementItemSet.Skip(0).First().AddCell(importanceField);

            //mainElement.ElementItemSet.Skip(1).First().Name = "BSD-3-Clause";
            //mainElement.ElementItemSet.Skip(1).First().NameCell.SetValue("<a href='http://opensource.org/licenses/BSD-3-Clause' target='_blank'>BSD-3-Clause</a>");
            //mainElement.ElementItemSet.Skip(1).First().AddCell(importanceField).SetValue(ratingPerLicense);

            mainElement.ElementItemSet.Skip(1).First().Name = "<a href='http://opensource.org/licenses/GPL-3.0' target='_blank'>GPL-3.0</a>";
            //mainElement.ElementItemSet.Skip(1).First().Name = "GPL-3.0";
            //mainElement.ElementItemSet.Skip(1).First().NameCell.SetValue("<a href='http://opensource.org/licenses/GPL-3.0' target='_blank'>GPL-3.0</a>");
            mainElement.ElementItemSet.Skip(1).First().AddCell(importanceField);

            //mainElement.ElementItemSet.Skip(3).First().Name = "LGPL-3.0";
            //mainElement.ElementItemSet.Skip(3).First().NameCell.SetValue("<a href='http://opensource.org/licenses/LGPL-3.0' target='_blank'>LGPL-3.0</a>");
            //mainElement.ElementItemSet.Skip(3).First().AddCell(importanceField).SetValue(ratingPerLicense);

            mainElement.ElementItemSet.Skip(2).First().Name = "<a href='http://opensource.org/licenses/MIT' target='_blank'>MIT</a>";
            //mainElement.ElementItemSet.Skip(2).First().Name = "MIT";
            //mainElement.ElementItemSet.Skip(2).First().NameCell.SetValue("<a href='http://opensource.org/licenses/MIT' target='_blank'>MIT</a>");
            mainElement.ElementItemSet.Skip(2).First().AddCell(importanceField);

            // TODO Check it again
            mainElement.ElementItemSet.Skip(3).First().Name = "<a href='http://en.wikipedia.org/wiki/End-user_license_agreement' target='_blank'>EULA (Wikipedia)</a>";
            //mainElement.ElementItemSet.Skip(3).First().Name = "EULA (Wikipedia)";
            //mainElement.ElementItemSet.Skip(3).First().NameCell.SetValue("<a href='http://en.wikipedia.org/wiki/End-user_license_agreement' target='_blank'>EULA (Wikipedia)</a>");
            mainElement.ElementItemSet.Skip(3).First().AddCell(importanceField);

            // Return
            return resourcePool;
        }
예제 #32
0
        public User VerifyLogin(string login, string passwd)
        {
            InitDB();

            //Purge Schedules older than 7 days from current day5
            try
            {
                DateTime dtNow = DateTime.Now;
                DateTime ts = dtNow.AddDays(-7);

                var sc = new ScheduleCollection();
                sc.Query.Where(sc.Query.Loopend.LessThan(ts));
                sc.LoadAll();
                sc.MarkAllAsDeleted();
                sc.Save();
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+ex.Message);
            }

            //Purge all schedules on finding deleteschedule.txt
            if (File.Exists(@"c:\content\deleteschedule.txt") || File.Exists(@"c:\content\deleteschedule.txt.txt"))
            {
                CoreHost.Properties.Settings.Default.DefaultPort = "null";
                try
                {
                    File.Delete(@"c:\content\deleteschedule.txt");
                }
                catch (Exception ex)
                {
                }
                try
                {
                    File.Delete(@"c:\content\deleteschedule.txt.txt");
                }
                catch (Exception ex)
                {
                }
                Console.WriteLine(DateTime.Now.ToShortTimeString() + "  " + " -- Schedule Purge Requested --");
                ScheduleCollection sc = new ScheduleCollection();
                sc.LoadAll();
                sc.MarkAllAsDeleted();
                sc.Save();
                Console.WriteLine(DateTime.Now.ToShortTimeString() + "  " + " -- Schedules Purged OK --");
            }

            User _verifieduser = new User();
            Boolean Verified = false;
            UserCollection _usr = new UserCollection();
            _usr.LoadAll();
            foreach (User item in _usr)
            {
                if (!Verified) _verifieduser = item;
                if (item.Password == passwd && item.Loginid == login)
                {
                    Verified = true;
                }
            }
            if (Verified == true)
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+DateTime.Now.ToString() + "Login OK");
                return _verifieduser;
            }
            else
            {
                Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+DateTime.Now.ToString()+" :Failed Login Attempt");
                try
                {
                    User _newuser = new User();
                    _newuser.Id = 99999;
                    _newuser.Fullname = "failed";
                    _newuser.Loginid = "sys";
                    _newuser.Password = "******";
                    _newuser.Groupid = "sys";
                    //_newuser.Save();
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+DateTime.Now.ToString()+" :"+_newuser.Fullname + " - Failed Login Attempt");
                    return _newuser;
                }
                catch (Exception ex)
                {
                   // Console.Write(ex.Message);
                }
            }
            return null;
        }
        public ResourcePool CreateTotalCostIndexNewSystemAftermathSample(User user)
        {
            const int numberOfItems = 3;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Total Cost Index - New Model - Aftermath",
                useFixedResourcePoolRate: true,
                mainElementName: "Product",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Main element
            var mainElement = resourcePool.ElementSet.First();

            // Fields
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            mainElement.MultiplierField.SortOrder = 3;

            // Resource pool index; use to Sales Price itself
            mainElement.DirectIncomeField.EnableIndex(ElementFieldIndexSortType.LowestToHighest);

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "<s>Average Profit</s>";
            mainElement.ElementItemSet.Skip(0).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(1).First().Name = "<s>High Profit</s>";
            mainElement.ElementItemSet.Skip(1).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(2).First().Name = "No Profit";
            mainElement.ElementItemSet.Skip(2).First().DirectIncomeCell.SetValue(100M);

            // Return
            return resourcePool;
        }
예제 #34
0
 public Boolean RemoveUser(User userName)
 {
     InitDB();
     User deleteUser = new User();
     deleteUser.LoadByPrimaryKey((long)userName.Id);
     deleteUser.MarkAsDeleted();
     deleteUser.Save();
     return true;
 }
        public ResourcePool CreateFairShareSample(User user)
        {
            const int numberOfItems = 2;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Fair Share Index",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            //resourcePool.EnableSubtotals = false;

            // Fair share element
            var fairShareElement = resourcePool.AddElement("Fair Share");

            // Fields
            var fairShareDesciptionField = fairShareElement.AddField("Description", ElementFieldDataType.String);
            var fairShareImportanceField = fairShareElement.AddField("Fair Share Rating", ElementFieldDataType.Decimal, false);
            fairShareImportanceField.EnableIndex();

            // Items, cell, user cells
            var fairShareNoItem = fairShareElement.AddItem("Keeper")
                .AddCell(fairShareDesciptionField).SetValue("Uses the classic approach; the owner gets all the profit, workers get a fixed salary").ElementItem
                .AddCell(fairShareImportanceField).ElementItem;

            var fairShareYesItem = fairShareElement.AddItem("Sharer")
                .AddCell(fairShareDesciptionField).SetValue("Considers contributions from all parties and share the income based on this outcome").ElementItem
                .AddCell(fairShareImportanceField).ElementItem;

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            var fairShareField = mainElement.AddField("Fair Share", ElementFieldDataType.Element);
            fairShareField.SelectedElement = fairShareElement;

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Fair Sharer Org.";
            mainElement.ElementItemSet.Skip(0).First().AddCell(fairShareField).SetValue(fairShareYesItem);

            mainElement.ElementItemSet.Skip(1).First().Name = "Income Keeper Inc.";
            mainElement.ElementItemSet.Skip(1).First().AddCell(fairShareField).SetValue(fairShareNoItem);

            // Return
            return resourcePool;
        }
        public ResourcePool CreateSectorIndexSample(User user)
        {
            const int numberOfItems = 4;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Sector Index Sample",
                useFixedResourcePoolRate: true,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Sector element
            var sectorElement = resourcePool.AddElement("Sector");

            // Importance field
            var importanceField = sectorElement.AddField("Sector Rating", ElementFieldDataType.Decimal, false);
            importanceField.EnableIndex();

            // Items, cells, user cells
            var cosmeticsItem = sectorElement.AddItem("Cosmetics").AddCell(importanceField).ElementItem;
            var educationItem = sectorElement.AddItem("Education").AddCell(importanceField).ElementItem;
            var entertainmentItem = sectorElement.AddItem("Entertainment").AddCell(importanceField).ElementItem;
            var healthcareItem = sectorElement.AddItem("Healthcare").AddCell(importanceField).ElementItem;

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            var sectorField = mainElement.AddField("Sector", ElementFieldDataType.Element);
            sectorField.SelectedElement = sectorElement;

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Cosmetics Organization";
            mainElement.ElementItemSet.Skip(0).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(1).First().Name = "Education Organization";
            mainElement.ElementItemSet.Skip(1).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(2).First().Name = "Entertainment Organization";
            mainElement.ElementItemSet.Skip(2).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(3).First().Name = "Healthcare Organization";
            mainElement.ElementItemSet.Skip(3).First().AddCell(sectorField).SetValue(healthcareItem);

            // Old list
            //mainElement.ElementItemSet.Skip(0).First().Name = "Basic Materials";
            //mainElement.ElementItemSet.Skip(1).First().Name = "Conglomerates";
            //mainElement.ElementItemSet.Skip(2).First().Name = "Consumer Goods";
            //mainElement.ElementItemSet.Skip(3).First().Name = "Financial";
            //mainElement.ElementItemSet.Skip(4).First().Name = "Healthcare";
            //mainElement.ElementItemSet.Skip(5).First().Name = "Industrial Goods";
            //mainElement.ElementItemSet.Skip(6).First().Name = "Services";
            //mainElement.ElementItemSet.Skip(7).First().Name = "Technology";
            //mainElement.ElementItemSet.Skip(8).First().Name = "Utilities";

            // Return
            return resourcePool;
        }
예제 #37
0
 public Boolean InsertUser(User user)
 {
     InitDB();
     User newUser = new User();
     newUser.Fullname = user.Fullname;
     newUser.Loginid = user.Loginid;
     newUser.Groupid = user.Groupid;
     newUser.Password = user.Password;
     Boolean functionResult = false;
     try
     {
         newUser.Save();
         functionResult = true;
     }
     catch (Exception ex)
     {
         functionResult = false;
     }
     return functionResult;
 }
        public ResourcePool CreateBillionDollarQuestion(User user)
        {
            const int numberOfItems = 6;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "Billion Dollar Question",
                useFixedResourcePoolRate: true,
                mainElementName: "Issues",
                addDirectIncomeField: false,
                addMultiplierField: false,
                addImportanceIndex: true,
                numberOfItems: numberOfItems);

            resourcePool.InitialValue = 1000000000;

            // Main element
            var mainElement = resourcePool.ElementSet.First();

            // Fields
            mainElement.ElementFieldSet.Single(item => item.IndexEnabled).Name = "Rating";
            mainElement.ElementFieldSet.Single(item => item.IndexEnabled).IndexCalculationType = (byte)ElementFieldIndexCalculationType.Passive;

            // Items, cell, user cells
            mainElement.ElementItemSet.Skip(0).First().Name = "Cosmetics: Curing baldness";
            mainElement.ElementItemSet.Skip(1).First().Name = "Education: Reducing illiteracy";
            mainElement.ElementItemSet.Skip(2).First().Name = "Entertainment: Improving augmented reality in video games";
            mainElement.ElementItemSet.Skip(3).First().Name = "Healthcare: Curing cancer";
            mainElement.ElementItemSet.Skip(4).First().Name = "Hunger: Clean water for everyone";
            mainElement.ElementItemSet.Skip(5).First().Name = "Poverty: Reducing infant mortality rates";

            // Return
            return resourcePool;
        }
        public ResourcePool CreateAllInOneSample(User user)
        {
            const int numberOfItems = 32;

            // Resource pool
            var resourcePool = CreateDefaultResourcePool(user: user,
                resourcePoolName: "All in One",
                useFixedResourcePoolRate: false,
                mainElementName: "Organization",
                addDirectIncomeField: true,
                addMultiplierField: true,
                addImportanceIndex: false,
                numberOfItems: numberOfItems);

            // Sector element
            var sectorElement = resourcePool.AddElement("Sector");

            // Fields
            var sectorRatingField = sectorElement.AddField("Sector Rating", ElementFieldDataType.Decimal, false);
            sectorRatingField.EnableIndex();

            // Items, cells, user cells
            var cosmeticsItem = sectorElement.AddItem("Cosmetics").AddCell(sectorRatingField).ElementItem;
            var educationItem = sectorElement.AddItem("Education").AddCell(sectorRatingField).ElementItem;
            var entertainmentItem = sectorElement.AddItem("Entertainment").AddCell(sectorRatingField).ElementItem;
            var healthcareItem = sectorElement.AddItem("Healthcare").AddCell(sectorRatingField).ElementItem;

            // License element
            var licenseElement = resourcePool.AddElement("License");

            // Fields
            var rightToUseField = licenseElement.AddField("Right to Use", ElementFieldDataType.String);
            var rightToCopyField = licenseElement.AddField("Right to Copy", ElementFieldDataType.String);
            var rightToModifyField = licenseElement.AddField("Right to Modify", ElementFieldDataType.String);
            var rightToSellField = licenseElement.AddField("Right to Sell", ElementFieldDataType.String);
            var licenseRatingField = licenseElement.AddField("License Rating", ElementFieldDataType.Decimal, false);
            licenseRatingField.EnableIndex();

            // Items, cell, user cells
            var restrictedLicense = licenseElement.AddItem("Restricted License")
                .AddCell(rightToUseField).SetValue("Yes").ElementItem
                .AddCell(rightToCopyField).SetValue("No").ElementItem
                .AddCell(rightToModifyField).SetValue("No").ElementItem
                .AddCell(rightToSellField).SetValue("No").ElementItem
                .AddCell(licenseRatingField).ElementItem;

            var openSourceLicense = licenseElement.AddItem("Open Source License")
                .AddCell(rightToUseField).SetValue("Yes").ElementItem
                .AddCell(rightToCopyField).SetValue("Yes").ElementItem
                .AddCell(rightToModifyField).SetValue("Yes").ElementItem
                .AddCell(rightToSellField).SetValue("Yes").ElementItem
                .AddCell(licenseRatingField).ElementItem;

            // Fair share element
            var fairShareElement = resourcePool.AddElement("Fair Share");

            // Fields
            var fairShareDesciptionField = fairShareElement.AddField("Description", ElementFieldDataType.String);
            var fairShareRatingField = fairShareElement.AddField("Fair Share Rating", ElementFieldDataType.Decimal, false);
            fairShareRatingField.EnableIndex();

            // Items, cell, user cells
            var keeperItem = fairShareElement.AddItem("Keeper")
                .AddCell(fairShareDesciptionField).SetValue("The owner of the organization keeps all the income to himself, ignores the contributions").ElementItem
                .AddCell(fairShareRatingField).ElementItem;

            var sharerItem = fairShareElement.AddItem("Sharer")
                .AddCell(fairShareDesciptionField).SetValue("The organization shares it's income with its employees based on their contributions").ElementItem
                .AddCell(fairShareRatingField).ElementItem;

            // Main element
            var mainElement = resourcePool.ElementSet.First();
            mainElement.DirectIncomeField.Name = "Sales Price";
            mainElement.MultiplierField.Name = "Number of Sales";
            
            var sectorField = mainElement.AddField("Sector", ElementFieldDataType.Element);
            sectorField.SelectedElement = sectorElement;
            
            var licenseField = mainElement.AddField("License", ElementFieldDataType.Element);
            licenseField.SelectedElement = licenseElement;
            
            var fairShareField = mainElement.AddField("Fair Share", ElementFieldDataType.Element);
            fairShareField.SelectedElement = fairShareElement;
            
            // Resource pool index; use to Sales Price itself
            mainElement.DirectIncomeField.EnableIndex(ElementFieldIndexSortType.LowestToHighest);

            // Items, cell, user cells
            var itemIndex = 0;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Cosmetics (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 1;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Cosmetics (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 2;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Cosmetics (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 3;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Cosmetics (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 4;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Cosmetics (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 5;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Cosmetics (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 6;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Cosmetics (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 7;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Cosmetics (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(cosmeticsItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 8;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Education (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 9;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Education (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 10;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Education (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 11;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Education (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 12;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Education (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 13;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Education (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 14;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Education (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 15;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Education (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(educationItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 16;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Entertainment (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 17;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Entertainment (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 18;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Entertainment (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 19;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Entertainment (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 20;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Entertainment (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 21;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Entertainment (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 22;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Entertainment (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 23;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Entertainment (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(entertainmentItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 24;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Healthcare (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 25;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Healthcare (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 26;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Healthcare (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 27;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "Hidden Healthcare (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(restrictedLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 28;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Healthcare (Profit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 29;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Healthcare (Nonprofit & Keeper)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(keeperItem);

            itemIndex = 30;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Healthcare (Profit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(110M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            itemIndex = 31;
            mainElement.ElementItemSet.Skip(itemIndex).First().Name = "True Healthcare (Nonprofit & Sharer)";
            mainElement.ElementItemSet.Skip(itemIndex).First().DirectIncomeCell.SetValue(100M);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(sectorField).SetValue(healthcareItem);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(licenseField).SetValue(openSourceLicense);
            mainElement.ElementItemSet.Skip(itemIndex).First().AddCell(fairShareField).SetValue(sharerItem);

            // Return
            return resourcePool;
        }
예제 #40
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["Mode"] == null)
                {
                     Response.Redirect("UserInfo.aspx?Mode=New");
                }
                if (Request.QueryString != null)
                {
                    txtID.Enabled = false;
                    txtUID.Enabled = false;

                    string mode = Request.QueryString["Mode"];
                    switch (mode)
                    {
                        case "View":

                            break;

                        case "New":

                            btnSave.Visible = true;

                            btnEdit.Visible = false;
                            break;

                        case "Edit":

                            int x = Convert.ToInt32(Request.QueryString["UserID"]);
                            loadPerson(x);
                            loadUser(x);
                            txtID.Text = x.ToString();

                            break;
                    }
                    if (Request.QueryString["UserID"] != null)
                    {

                        int PersonID = Convert.ToInt32(Request.QueryString["UserID"]);
                        int UserID = Convert.ToInt32(Request.QueryString["UserID"]);
                        BusinessObjects.Person person = new BusinessObjects.Person(PersonID);
                        BusinessObjects.User user = new BusinessObjects.User(UserID);

                        txtFirstName.Enabled = false;
                        txtLastName.Enabled = false;
                        txtTitle.Enabled = false;
                        txtUsername.Enabled = false;
                        txtPassword.Enabled = false;
                        btnSave.Visible = false;

                    }

                   if (Request.QueryString["UserID"] == null)
                    {
                       //   Request.QueryString["Mode"] = "New";
                        //Response.Redirect("UserInfo.aspx?Mode=New");
                    }
                }
            }
        }