示例#1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ValidateControls())
            {
                MessageBox.Show("输入不能为空,请核查!");
                return;
            }

            DataRow dr = dtZyInfo.Rows[0];

            dr["ylzh"] = this.tbMcard.Text.Trim();
            dr["name"] = this.tbName.Text.Trim();
            dr["zyh"]  = this.tbInhosNum.Text.Trim();



            bool result = new Business.ItemProcess().UpdateZyjl(dtZyInfo);

            if (result)
            {
                MessageBox.Show(this, "修改成功!", "保存提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ((InhosList)this.Owner).loadDataByStr();
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(this, "保存失败!", "保存提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        protected void GetDetails()
        {
            Hashtable ht = new Hashtable();

            ht.Add("id", "1");
            DataTable dt = new Business.ItemProcess().GetDetailById(ht).Tables[0];

            this.DetailGridView.AutoGenerateColumns = false;
            this.DetailGridView.DataSource          = dt;
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataTable dt     = (DataTable)this.DetailGridView.DataSource;
            bool      result = new Business.ItemProcess().UpdateDetailInfo(dt);

            if (result)
            {
                MessageBox.Show("保存成功!");
            }
        }
示例#4
0
        /// <summary>
        /// 通过scanname showname 获取,加载数据的时候,两个值相等
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private Hashtable getItemDictRowByScanName(string data)
        {
            Hashtable ht = new Hashtable();

            int       count           = 0;
            string    centercode      = "";
            string    firstCenterCode = "";
            string    showname        = "";
            DataTable dtItemDict      = null;
            //改成存储过程
            DataSet ds = new Business.ItemProcess().GetItemDict(this.frcode, data);

            if (ds.Tables.Count > 0)
            {
                dtItemDict = ds.Tables[0];
                if (dtItemDict.Rows.Count > 0)
                {
                    DataRow dr = dtItemDict.Rows[0];
                    centercode = dr["centercode"] == null ? "" : dr["centercode"].ToString();
                    showname   = dr["showname"] == null ? "" : dr["showname"].ToString();
                    if (!String.IsNullOrEmpty(centercode))
                    {
                        if (String.IsNullOrEmpty(firstCenterCode))
                        {
                            firstCenterCode = centercode;
                        }
                    }
                }
            }



            if (!String.IsNullOrEmpty(firstCenterCode))
            {
                DataSet dsDict = new Business.DictProcess().GetItemByID(firstCenterCode);
                if (dsDict.Tables.Count > 0)
                {
                    DataTable dtDict = dsDict.Tables[0];
                    if (dtDict.Rows.Count > 0)
                    {
                        ScanDataSet.CenterDataRow centerDataRow = (ScanDataSet.CenterDataRow)dtDict.Rows[0];
                        ht.Add("row", centerDataRow);


                        return(ht);
                    }
                }
            }

            return(ht);
        }
示例#5
0
        private void GetDetailById(string id)
        {
            this.ScanDataGridView.AutoGenerateColumns = false;
            this.ScanDataGridView.DataSource          = null;
            Hashtable ht = new Hashtable();

            ht.Add("id", id);
            DataTable dt = new Business.ItemProcess().GetDetailById(ht).Tables[0];

            this.labelCount.Text      = "总条数:0";
            this.labelTotalPrice.Text = "总金额:0";
            if (dt.Rows.Count > 0)
            {
                this.ScanDataGridView.DataSource = dt;


                this.Text += this.treeView1.SelectedNode.Text;
            }
        }
示例#6
0
        private void save(string id)
        {
            if (this.ScanDataGridView.Rows.Count > 1)
            {
                try
                {
                    DataTable dt = (DataTable)this.ScanDataGridView.DataSource;
                    //循环处理数据
                    bool result   = true;
                    int  rowcount = dt.Rows.Count;
                    //获取保存在dataset中的数据
                    if (dt.Rows.Count > 1)
                    {
                        //可能会有gridview 数据多,dataset 数据少,数据源没刷新的情况
                        this.ScanDataGridView.EndEdit();

                        ((IEditableObject)this.ScanDataGridView.CurrentRow.DataBoundItem).EndEdit();
                        this.ScanDataGridView.CurrentCell = null;
                        Application.DoEvents();

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            dt.Rows[i]["pid"]     = id;
                            dt.Rows[i]["paydate"] = System.DateTime.Now.ToShortDateString();
                            string code = dt.Rows[i]["code"] == null?i.ToString() : dt.Rows[i]["code"].ToString();

                            if (String.IsNullOrEmpty(code))
                            {
                                dt.Rows[i]["code"] = i.ToString();
                            }

                            string detailGUID = dt.Rows[i]["DetailGUID"] == null?Guid.NewGuid().ToString() : dt.Rows[i]["DetailGUID"].ToString();

                            if (String.IsNullOrEmpty(detailGUID))
                            {
                                dt.Rows[i]["DetailGUID"] = Guid.NewGuid().ToString();
                            }
                            string centercode = dt.Rows[i]["centercode"] == null?i.ToString() : dt.Rows[i]["centercode"].ToString();

                            string itemname = dt.Rows[i]["name"] == null ? "" : dt.Rows[i]["name"].ToString();
                            if (String.IsNullOrEmpty(centercode))
                            {
                                MessageBox.Show("中心编码不能为空!项目名称:【" + itemname + "】");
                                return;
                            }



                            string    centername = "";
                            DataTable dtname     = new Business.DictProcess().GetItemByID(centercode).Tables[0];
                            if (dtname.Rows.Count > 0)
                            {
                                centername = dtname.Rows[0]["name"].ToString();
                            }

                            dt.Rows[i]["centername"] = centername;
                        }



                        result = new Business.ItemProcess().SaveAndUpdateDetail(dt);



                        if (result)
                        {
                            this.loadForm.DialogResult = DialogResult.OK;
                            MessageBox.Show("保存成功");
                        }
                    }
                }
                catch (Exception ex)
                {
                    showError(ex.ToString());
                }
            }
        }