/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cb0_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ComboBox cb;
                if (!string.IsNullOrEmpty(this.comboBox1.Text) && !string.IsNullOrEmpty(this.cbRef.Text))
                {
                    RSFinanceToolsEntities db = new RSFinanceToolsEntities();
                    string    p      = this.comboBox1.SelectedValue.ToString();
                    string    Value1 = this.comboBox1.SelectedValue.ToString();
                    Control[] ctlsr  = this.panel3.Controls.Find("CriteriaLabel", true);
                    Control[] ctlcb  = this.panel3.Controls.Find("CriteriaCB", true);
                    if (ctlsr.Length > 0)
                    {
                        var dt2 = new List <rsTemplateTransaction>();
                        cb = new ComboBox();
                        cb.FormattingEnabled = true;
                        cb.Location          = new System.Drawing.Point(198, 35 * (0));
                        cb.Size = new System.Drawing.Size(229, 22);
                        cb.Name = "CriteriaCB";
                        string text1 = ((Label)ctlsr[0]).Text;
                        dt2 = (from FT_sett in db.rsTemplateTransactions
                               where FT_sett.TemplateID == p &&
                               FT_sett.Criteria1 == text1
                               select FT_sett).ToList();

                        DataTable newdt2 = ft.ToDataTable(dt2);
                        var       query2 = from t in newdt2.AsEnumerable()
                                           group t by new { t1 = t.Field <string>("Value1") } into m
                                  select new
                        {
                            CriteriaValue = m.First().Field <string>("Value1"),
                        };
                        DataTable newdt3 = ft.ToDataTable(query2.ToList());
                        DataRow   dr2    = newdt3.NewRow();
                        dr2["CriteriaValue"] = "";
                        newdt3.Rows.InsertAt(dr2, 0);
                        cb.DisplayMember         = "CriteriaValue";
                        cb.DataSource            = newdt3;
                        cb.ValueMember           = "CriteriaValue";
                        cb.SelectedIndexChanged += new EventHandler(cb1_SelectedIndexChanged);
                        if (ctlcb.Length > 0)
                        {
                            for (int i = 0; i < ctlcb.Length; i++)
                            {
                                this.panel3.Controls.Remove(ctlcb[i]);
                            }
                        }

                        this.panel3.Controls.Add(cb);
                        cb1_SelectedIndexChanged(null, null);
                    }
                }
                CheckFinalDropDown();
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string formUserID   = this.textBox1.Text;
            string formPassword = this.textBox2.Text;

            using (RSFinanceToolsEntities db = new RSFinanceToolsEntities())
            {
                try
                {
                    var wUserID = (from FT_user in db
                                   where FT_user.FormUserID == formUserID & FT_user.FormUserPassword == formPassword
                                   select FT_user.ft_id).First();

                    var SunIP = (from FT_user in db.FinTools_Users
                                 where FT_user.FormUserID == formUserID & FT_user.FormUserPassword == formPassword
                                 select FT_user.SUNUserIP).First();

                    var SunUID = (from FT_user in db.FinTools_Users
                                  where FT_user.FormUserID == formUserID & FT_user.FormUserPassword == formPassword
                                  select FT_user.SUNUserID).First();

                    var SunUpass = (from FT_user in db.FinTools_Users
                                    where FT_user.FormUserID == formUserID & FT_user.FormUserPassword == formPassword
                                    select FT_user.SUNUserPass).First();

                    if (SessionInfo.UserInfo == null)
                    {
                        SessionInfo.UserInfo = new UserInfo();
                    }
                    SessionInfo.UserInfo.ID          = wUserID.ToString();
                    SessionInfo.UserInfo.SunUserIP   = SunIP;
                    SessionInfo.UserInfo.SunUserID   = DEncrypt.Decrypt(SunUID);
                    SessionInfo.UserInfo.SunUserPass = DEncrypt.Decrypt(SunUpass);

                    if (pSender != null)
                    {
                        ((Ribbon2)pSender).addfolders();
                    }
                    this.Close();
                    this.Dispose();
                }
                catch
                {
                    MessageBox.Show("The user id or the password is invalid.", "Message - RSystems FinanceTools", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 private void InitialCriterias()
 {
     try
     {
         this.panel3.Controls.Clear();
         Label   l;
         TextBox cb;
         if (!string.IsNullOrEmpty(this.comboBox1.Text))
         {
             RSFinanceToolsEntities db = new RSFinanceToolsEntities();
             string p  = this.comboBox1.SelectedValue.ToString();
             var    dt = (from FT_sett in db.rsTemplateSettings
                          where FT_sett.TemplateID == p
                          select FT_sett).ToList();
             DataTable newdt = ft.ToDataTable(dt);
             var       query = from t in newdt.AsEnumerable()
                               group t by new { t1 = t.Field <string>("CriteriaName") } into m
                       select new
             {
                 CriteriaName = m.First().Field <string>("CriteriaName"),
             };
             int i = 0;
             foreach (var employee in query)
             {
                 l           = new Label();
                 l.AutoSize  = true;
                 l.Location  = new System.Drawing.Point(28, 36 * (i));
                 l.Name      = "CriteriaLabel";
                 l.Size      = new System.Drawing.Size(89, 13);
                 l.Text      = employee.CriteriaName;
                 cb          = new TextBox();
                 cb.Location = new System.Drawing.Point(199, 36 * (i));
                 cb.Size     = new System.Drawing.Size(325, 66);
                 cb.Name     = "CriteriaCB";
                 this.panel3.Controls.Add(l);
                 this.panel3.Controls.Add(cb);
                 i++;
             }
         }
     }
     catch { }
 }
        /// <summary>
        ///
        /// </summary>
        private void CheckFinalDropDown()
        {
            if (!string.IsNullOrEmpty(this.comboBox1.Text))
            {
                RSFinanceToolsEntities db = new RSFinanceToolsEntities();
                string    p     = this.comboBox1.SelectedValue.ToString();
                Control[] ctlsr = this.panel3.Controls.Find("CriteriaLabel", true);
                Control[] ctlcb = this.panel3.Controls.Find("CriteriaCB", true);
                if (ctlsr.Length > 0)
                {
                    var    dt2      = new List <rsTemplateTransaction>();
                    string text5    = string.Empty;
                    string text4    = string.Empty;
                    string text3    = string.Empty;
                    string text2    = string.Empty;
                    string text1    = string.Empty;
                    string cbValue1 = string.Empty;
                    string cbValue2 = string.Empty;
                    string cbValue3 = string.Empty;
                    string cbValue4 = string.Empty;
                    string cbValue5 = string.Empty;
                    if (ctlsr[0] != null)
                    {
                        text1 = ((Label)ctlsr[0]).Text;
                    }
                    if (ctlsr.Length > 1 && ctlcb.Length > 1)
                    {
                        if (ctlsr[1] != null)
                        {
                            text2 = ((Label)ctlsr[1]).Text;
                        }
                    }
                    if (ctlsr.Length > 2 && ctlcb.Length > 2)
                    {
                        if (ctlsr[2] != null)
                        {
                            text3 = ((Label)ctlsr[2]).Text;
                        }
                    }
                    if (ctlsr.Length > 3 && ctlcb.Length > 3)
                    {
                        if (ctlsr[3] != null)
                        {
                            text4 = ((Label)ctlsr[3]).Text;
                        }
                    }
                    if (ctlsr.Length > 4 && ctlcb.Length > 4)
                    {
                        if (ctlsr[4] != null)
                        {
                            text5 = ((Label)ctlsr[4]).Text;
                        }
                    }
                    if (ctlcb[0] != null)
                    {
                        cbValue1 = ((ComboBox)ctlcb[0]).Text;
                    }
                    if (ctlcb.Length > 1)
                    {
                        if (ctlcb[1] != null)
                        {
                            cbValue2 = ((ComboBox)ctlcb[1]).Text;
                        }
                    }
                    if (ctlcb.Length > 2)
                    {
                        if (ctlcb[2] != null)
                        {
                            cbValue3 = ((ComboBox)ctlcb[2]).Text;
                        }
                    }
                    if (ctlcb.Length > 3)
                    {
                        if (ctlcb[3] != null)
                        {
                            cbValue4 = ((ComboBox)ctlcb[3]).Text;
                        }
                    }
                    if (ctlcb.Length > 4)
                    {
                        if (ctlcb[4] != null)
                        {
                            cbValue5 = ((ComboBox)ctlcb[4]).Text;
                        }
                    }
                    dt2 = (from FT_sett in db.rsTemplateTransactions
                           where FT_sett.TemplateID == p &&
                           FT_sett.Criteria5 == text5 &&
                           FT_sett.Criteria4 == text4 &&
                           FT_sett.Criteria3 == text3 &&
                           FT_sett.Criteria2 == text2 &&
                           FT_sett.Criteria1 == text1 &&
                           FT_sett.Value1 == cbValue1 &&
                           FT_sett.Value2 == cbValue2 &&
                           FT_sett.Value3 == cbValue3 &&
                           FT_sett.Value4 == cbValue4 &&
                           FT_sett.Value5 == cbValue5

                           select FT_sett).ToList();

                    DataTable newdt2 = ft.ToDataTable(dt2);
                    var       query2 = from t in newdt2.AsEnumerable()
                                       group t by new { t1 = t.Field <string>("TransactionName") } into m
                              select new
                    {
                        CriteriaValue = m.First().Field <string>("TransactionName"),
                    };
                    DataTable newdt3 = ft.ToDataTable(query2.ToList());
                    this.cbTransactionName.DataSource    = newdt3;
                    this.cbTransactionName.DisplayMember = "CriteriaValue";
                    this.cbTransactionName.ValueMember   = "CriteriaValue";
                }
            }
        }