示例#1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        contsellEntity self = new contsellEntity();
        self.Ccode = this.txtccode.Text;
        self.Cname = this.txtcname.Text;
        self.Ccname = this.txtccname.Text;
        self.Cdate = this.txtcdate.Text;
        self.Spokesman = this.txtspokesman.Text;
        self.Saddress = this.txtsaddress.Text;
        self.Stel = this.txtstel.Text;
        self.Selfman = this.txtselfman.Text;
        self.Btime = this.txtbtime.Text;
        self.Etime = this.txtetime.Text;
        self.Cmark = this.txtcmark.Text;
        self.Cmoney = this.txtcmoney.Text;
        self.Umoney = this.txtumoney.Text;
        self.Omoney = this.txtomoney.Text;
        self.Cstuta = this.dropcstuta.SelectedItem.Text;
        self.Coper = this.dropcoper.SelectedItem.Text;
        //self.Coper = this.txtcoper.Text;
        self.Csection = this.dropcsection.SelectedItem.Text;
        self.Vdcmark = this.dropvdcmark.SelectedItem.Text;
        self.Vindicator = this.txtvindicator.Text;
        self.Cnoteer = Session["username"].ToString();//"honey";//session
        self.Cnotedate =  DateTime.Now.ToString();
        self.Cprovalue = this.txtcprovalue.Text;
        if (dropvdcmark.SelectedItem.Text == "已查收" )
        {
            if (chvid != "已查收")//用于防止进入时状态就是已查收 此时就不用更改时间
            self.Vdate = DateTime.Now.ToString();
        }
        else
        {
            self.Vdate = "";
        }
        self.Mark = this.txtmark.Text;

        if (Request.QueryString["action"] == "update")
        {
            self.Id = cid;

             //修改相关项目信息
            //int ic = consellBll.insertCusnote(self);
            string mid = cid;
            conworkEntity work = new conworkEntity();

            XmlDocument xdoc = new XmlDocument();
            xdoc.Load(Server.MapPath("work.xml"));

            XmlNodeList ch = xdoc.GetElementsByTagName("DataSet1").Item(0).ChildNodes;
             DataSet ds = new DataSet();
            bool check = false;//用于控制没有表的节点
            if (ch.Count > 0)
            {
                check = true;
            }
            if (check)
            {

                ds.ReadXml(Server.MapPath("work.xml"));
                int icount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < icount; i++)
                {
                    work.Cid = mid;
                    work.Conmark = ds.Tables[0].Rows[i]["mark"].ToString();
                    work.Conmoney = ds.Tables[0].Rows[i]["cmoney"].ToString();
                    work.Conname = ds.Tables[0].Rows[i]["cname"].ToString();
                    int cou = consellBll.insertCusnotew(work);

                }
            }

            int ids = consellBll.updateCusnote(self);
            if (ids > 0)
            {
                if (check)
                {
                    ds.Tables[0].Rows.Clear();
                    ds.WriteXml(Server.MapPath("work.xml"));
                }

                js("更新成功!");
                action = "";
            }
        }
        else
        {
            DataSet ds = new DataSet();
            ds.ReadXml(Server.MapPath("work.xml"));
            int icount = ds.Tables[0].Rows.Count;
            int ic = consellBll.insertCusnote(self);
            string mid = consellBll.getMaxid();
            conworkEntity work = new conworkEntity();
            for (int i = 0; i < icount; i++)
            {
                work.Cid = mid;
                work.Conmark = ds.Tables[0].Rows[i]["mark"].ToString();
                work.Conmoney = ds.Tables[0].Rows[i]["cmoney"].ToString();
                work.Conname = ds.Tables[0].Rows[i]["cname"].ToString();
               int cou =  consellBll.insertCusnotew(work);

            }
            if (ic > 0)
            {

                ds.Tables[0].Rows.Clear();

                ds.WriteXml(Server.MapPath("work.xml"));
                js("录入成功!");
            }
        }

           Response.Redirect("consellList.aspx");
    }
示例#2
0
 /// <summary>
 ///�����¼��Ϣ
 /// </summary>
 /// <param name="note"></param>
 /// <returns></returns>
 public static int insertCusnotew(conworkEntity note)
 {
     string sql = "insert into con_Work ( cid,conname,conmoney,conmark) values"; sql += "('" + note.Cid + "','" + note.Conname + "','" + note.Conmoney + "','" + note.Conmark + "')";
     return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql);
 }