Exemplo n.º 1
0
        private void repositoryItemButtonEdit1_Click(object sender, EventArgs e)
        {
            DataRowView view = this.bindingSource2.Current as DataRowView;

            if (!string.IsNullOrEmpty(view["CLFS"].ToString()))
            {
                PrviewTJLX   form = new PrviewTJLX(this.Activitie, "," + view["TJBH"].ToString() + ",", view["CLFS"].ToString(), view["BS"].ToString());
                DialogResult dl   = form.ShowDialog();
                if (dl == DialogResult.OK)
                {
                    if (form.bindingSource1.Current != null)
                    {
                        DataRowView v = form.bindingSource1.Current as DataRowView;
                        switch (view["CLFS"].ToString().Trim())
                        {
                        case "追加":
                            view.BeginEdit();
                            view["LXID"] += "," + v["ID"];
                            view["ZFMC"] += ";" + v["LXMC"];
                            view["XS"]   += "," + GetXS(v.Row);
                            view.EndEdit();
                            break;

                        case "替换":
                            view.BeginEdit();
                            view["LXID"] = "," + v["ID"];
                            view["XS"]   = "," + GetXS(v.Row);
                            string Str = view["ZFMC"].ToString();
                            if (Str.IndexOf("替换:") > -1)
                            {
                                Str          = Str.Substring(0, Str.IndexOf("替换:"));
                                view["ZFMC"] = Str + ";" + v["LXMC"];
                            }
                            else
                            {
                                view["ZFMC"] += ";" + v["LXMC"];
                            }
                            view.EndEdit();
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void AddZF(DataRowView v)
        {
            // PrviewTJLX form = new PrviewTJLX(this.Activitie, "," + v["TJBH"].ToString() + ",", v["CLFS"].ToString(), v["BS"].ToString());
            PrviewTJLX   form = new PrviewTJLX(this.Activitie, "," + v["TJBH"].ToString() + ",", v["CLFS"].ToString());
            DialogResult dl   = form.ShowDialog();

            if (dl == DialogResult.OK)
            {
                if (form.bindingSource1.Current != null)
                {
                    DataRowView view = form.bindingSource1.Current as DataRowView;
                    DataRow     r    = this.m_TabTJZF.NewRow();
                    r.BeginEdit();
                    r["TJBH"] = v["Key"];
                    r["TJID"] = v["Key"];
                    r["ZFBH"] = this.bindingSource2.Count + 1;
                    r["ZFMC"] = view["BS"] + ":" + view["LXMC"];
                    r["LXID"] = view["ID"];
                    r["XS"]   = GetXS(view.Row);
                    r.EndEdit();
                    this.m_TabTJZF.Rows.Add(r);//从类型库取出来并添加为做法
                }
            }
        }