コード例 #1
0
        private void BindchildGrid(string strhdid)
        {
            bi_heatdevice_repair bhdr = new bi_heatdevice_repair();

            System.Data.DataTable dt = bhdr.getBindDataAsdt(strhdid);

            editID.Text          = strhdid;
            childGrid.DataSource = dt;
            childGrid.DataBind();
        }
コード例 #2
0
        private void initchildinfo(string strID)
        {
            bi_heatdevice_repair bhdr = new bi_heatdevice_repair();

            System.Data.DataTable dt = bhdr.getEditdata(strID);

            DataRow r = dt.Rows[0];

            editchildID.Text          = strID;
            hdrepairtime.SelectedDate = DateTime.Parse(r["hdrepairtime"].ToString().Trim());
            hdreworktime.SelectedDate = DateTime.Parse(r["hdreworktime"].ToString().Trim());
            hderror.Text         = r["hderror"].ToString().Trim();
            hdrepaircontent.Text = r["hdrepaircontent"].ToString().Trim();
        }
コード例 #3
0
        protected void btnDeleteChild_Click(object sender, EventArgs e)
        {
            int[] intRowindexarray = childGrid.SelectedRowIndexArray;

            if (intRowindexarray.Length > 0)
            {
                bi_heatdevice_repair bhdr = new bi_heatdevice_repair();
                object[]             keys = childGrid.DataKeys[intRowindexarray[0]];

                string strID = null;
                if (keys[0] != null)
                {
                    strID = keys[0].ToString();
                }
                string strhdid = null;
                if (keys[1] != null)
                {
                    strhdid = keys[1].ToString();
                }
                //string strID = keys[0].ToString();
                //string strhdid = keys[1].ToString();出现了key[]=null的异常

                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' ");

                int intresult = 0;
                intresult = bhdr.deletebycondition("bi_heatdevice_repair", dic);

                strhdid = editID.Text.ToString().Trim();
                BindchildGrid(strhdid);

                Alert alert = new Alert();

                if (intresult > 0)
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "成功移除数据";
                }
                else
                {
                    alert.MessageBoxIcon = MessageBoxIcon.Error;
                    alert.Message        = "数据移除失败";
                }

                alert.Show();
            }
        }
コード例 #4
0
        protected void btnSaveChild_Click(object sender, EventArgs e)
        {
            string strID   = editchildID.Text.ToString().Trim();
            string strhdid = editID.Text.ToString().Trim();
            Dictionary <string, string> dic = initchildDatadic(strhdid);

            bi_heatdevice_repair bhdr = new bi_heatdevice_repair();
            int intresult             = 0;

            if (strID == "")
            {
                dic.Add("ID", Guid.NewGuid().ToString());

                intresult = bhdr.add(dic, "bi_heatdevice_repair");
            }
            else
            {
                intresult = bhdr.update(dic, "bi_heatdevice_repair", "ID", strID);
            }

            BindchildGrid(strhdid);

            Alert alert = new Alert();

            if (intresult == 1)
            {
                alert.Icon    = Icon.Information;
                alert.Message = "数据保存成功";
            }
            else
            {
                alert.MessageBoxIcon = MessageBoxIcon.Error;
                alert.Message        = "数据保存失败";
            }

            alert.Show();
        }