private void AutoFitColumnEVEN()
        {
            distribution widthDist = new distribution();
            int          totalWidth = 0, totalFixWidth = 0;

            for (int idx = 0; idx < this.Columns.Count; idx++)
            {
                if (!this.Columns[idx].Visible)
                {
                    continue;
                }
                if (this.myFixedSizedColumns.Contains(this.Columns[idx].Name))
                {
                    totalFixWidth += this.Columns[idx].Width;
                    continue;
                }
                totalWidth += this.Columns[idx].Width;
                widthDist.Add(this.Columns[idx].Name, this.Columns[idx].Width);
            }
            totalWidth = this.Width - totalFixWidth - (this.RowHeadersVisible ? this.RowHeadersWidth : 2) - SystemInformation.VerticalScrollBarThumbHeight - 2 - totalWidth;
            if (!widthDist.Distribute(totalWidth, 0))
            {
                return;
            }
            System.Collections.SortedList disResult = widthDist.GetDistribution();
            int    value = 0;
            string tmp;

            for (int idx = 0; idx < disResult.Count; idx++)
            {
                tmp = disResult.GetKey(idx).ToString();
                int.TryParse(disResult[tmp].ToString(), out value);
                this.Columns[tmp].Width += value;
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form1 f = new Form1();

            if (textBox1.Text == "")
            {
                return;
            }
            if (textBox2.Text == "")
            {
                return;
            }
            if (textBox3.Text == "")
            {
                return;
            }
            if (textBox4.Text == "")
            {
                MessageBox.Show("Please, Input name country", "Ooops", MessageBoxButtons.OK);
                return;
            }
            distribution temp = new distribution();

            try
            {
                temp.culture_tradition      = double.Parse(textBox2.Text);
                temp.culture_susceptibility = double.Parse(textBox3.Text);
                temp.amount         = int.Parse(textBox1.Text);
                temp.age            = comboBox2.SelectedItem.ToString();
                temp.gender         = comboBox1.SelectedItem.ToString();
                temp.education      = comboBox3.SelectedItem.ToString();
                temp.wish_migration = int.Parse(comboBox6.SelectedItem.ToString());
                //MessageBox.Show(text: "It has be done", caption: "Accept!", buttons: MessageBoxButtons.OK);
                temp.print();
                SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\FLoginov\Source\Repos\diplom\diplom\myDiplom\myDiplom\Database.mdf;Integrated Security=True");
                conn.Open();
                string sql = "insert into Russia values(" + temp.gender + "," + temp.education + "," + temp.culture_tradition.ToString() + "," + temp.culture_susceptibility.ToString() + "," + temp.wish_migration.ToString() + "," + temp.amount.ToString() + "," + temp.age + ")";
                MessageBox.Show(sql, "", MessageBoxButtons.OK);
                SqlCommand command = new SqlCommand(sql, conn);
                conn.Close();
                Close();
            }
            catch
            {
                MessageBox.Show(text: "Sorry, you've written unacceptable value into some textbox. Please, try again", caption: "Error!", buttons: MessageBoxButtons.OK);
                //MessageBox.Show("I did it again...", caption: "Oops", buttons: MessageBoxButtons.OK);
            }
        }
 public ActionResult disItems()
 {
     List<distribution> dist = new List<distribution>();
     long id = long.Parse(Request.QueryString["id"]);
     需求计划 model = 需求计划管理.查找需求计划(id);
     List<需求计划分发链接> dis = model.分发列表;
     if (dis.Any())
     {
         foreach (var item in dis)
         {
             distribution d = new distribution();
             d.reciever = item.需求计划分发数据.收货单位名称;
             d.number = item.需求计划分发数据.分发编号.ToString();
             d.material = item.需求计划分发数据.物资名称;
             d.cator = item.需求计划分发数据.规格型号;
             d.percent = item.需求计划分发数据.计量单位;
             d.discount = item.需求计划分发数据.分配数量.ToString();
             d.getway = item.需求计划分发数据.提货方式.ToString();
             d.transway = item.需求计划分发数据.运输方式.ToString();
             d.destination = item.需求计划分发数据.到站;
             d.note = item.需求计划分发数据.备注;
             dist.Add(d);
         }
     }
     JsonResult json = new JsonResult() { Data = dist };
     return Json(json, JsonRequestBehavior.AllowGet);
 }
        private void AutoFitColumnEVEN()
        {
            distribution widthDist = new distribution();
            int totalWidth = 0, totalFixWidth = 0;

            for (int idx = 0; idx < this.Columns.Count; idx++)
            {
                if (!this.Columns[idx].Visible) continue;
                if (this.myFixedSizedColumns.Contains(this.Columns[idx].Name))
                {
                    totalFixWidth += this.Columns[idx].Width;
                    continue;
                }
                totalWidth += this.Columns[idx].Width;
                widthDist.Add(this.Columns[idx].Name, this.Columns[idx].Width);
            }
            totalWidth = this.Width - totalFixWidth - (this.RowHeadersVisible ? this.RowHeadersWidth : 2) - SystemInformation.VerticalScrollBarThumbHeight - 2 - totalWidth;
            if (!widthDist.Distribute(totalWidth, 0)) return;
            System.Collections.SortedList disResult = widthDist.GetDistribution();
            int value = 0;
            string tmp;
            for (int idx = 0; idx < disResult.Count; idx++)
            {
                tmp = disResult.GetKey(idx).ToString();
                int.TryParse(disResult[tmp].ToString(), out value);
                this.Columns[tmp].Width += value;
            }
        }