Пример #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            ManageHouse house = new ManageHouse();

            house.JobNum  = this.JobNum;
            house.L       = this.L;
            house.JobName = this.JobName;
            house.Show();
            this.Dispose();
        }
Пример #2
0
        public virtual void lbHome_Click(object sender, EventArgs e)
        {
            ManageHouse house = new ManageHouse();

            house.JobNum  = this.JobNum;
            house.L       = this.L;
            house.JobName = this.JobName;
            house.Show();
            this.Dispose();
        }
Пример #3
0
        private void lbHome_Click(object sender, EventArgs e)
        {
            ManageHouse house = new ManageHouse();

            house.JobNum     = jobNum;
            house.L          = l;
            house.UserStatus = this.UserStatus;
            house.JobName    = this.JobName;
            house.Show();
            this.Dispose();
        }
Пример #4
0
        private void btnIns_Click(object sender, EventArgs e)
        {
            string name      = this.textName.Text;
            string cardNo    = this.textCardNo.Text;
            string number    = this.textNumber.Text;
            string strSex    = (string)this.comboSex.SelectedItem;
            string address   = this.textAddress.Text;
            string suggssest = this.textSuggssest.Text;
            string estPrice  = this.textEstPrice.Text;
            int    sex       = 0;

            if (strSex == "男")
            {
                sex = (int)Enums.man;
            }
            else if (strSex == "女")
            {
                sex = (int)Enums.woman;
            }
            Random rd        = new Random();
            string cardCli   = Convert.ToString(rd.Next(10000, 100000));
            string houseCard = Convert.ToString(rd.Next(100000, 1000000));
            string date      = DateTime.Now.ToString("yyyy-MM-dd");

            if (name != "" && cardNo != "" && number != "" && address != "" && suggssest != "" && estPrice != "")
            {
                using (mysql.Conn)
                {
                    mysql.Conn.Open();
                    string cliSql = string.Format("insert into client(cardCli,name,sex,cardNo,number,status,endDate) values('{0}','{1}',{2},'{3}','{4}',{5},'{6}')",
                                                  cardCli, name, sex, cardNo, number, (int)Enums.houseCli, date);
                    string houseSql = string.Format("insert into house(card,address,state,cardCli,insDate,UpdDate,estPrice,addCard,suggest) values('{0}','{1}',{2},'{3}','{4}','{5}',{6},'{7}','{8}')",
                                                    houseCard, address, (int)Enums.vacancy, cardCli, date, date, estPrice, this.JobNum, suggssest);

                    mysql.Comd = new MySqlCommand(cliSql, mysql.Conn);
                    MySqlTransaction tran = mysql.Conn.BeginTransaction();
                    mysql.Comd.Transaction = tran;
                    int index = mysql.Comd.ExecuteNonQuery();
                    mysql.Comd.CommandText = houseSql;
                    index += mysql.Comd.ExecuteNonQuery();

                    if (index > 1)
                    {
                        tran.Commit();
                        ManageHouse house = new ManageHouse();
                        house.JobNum  = this.JobNum;
                        house.L       = this.L;
                        house.JobName = this.JobName;
                        house.Messge  = "房源添加成功!";
                        house.Show();
                        this.Dispose();
                    }
                    else
                    {
                        tran.Rollback();
                        MessageBox.Show("房源添加失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("必填项不能为空!");
            }
        }
Пример #5
0
        private void btnUpd_Click(object sender, EventArgs e)
        {
            string name    = this.textName.Text;
            string cardNo  = this.textCardNo.Text;
            string strSex  = this.comboSex.SelectedItem.ToString();
            string number  = this.textNumber.Text;
            string address = this.textAddress.Text;
            string suggest = this.textSuggest.Text;
            string date    = DateTime.Now.ToString("yyyy-MM-dd");

            int sex = 2;

            if (strSex == "男")
            {
                sex = (int)Enums.man;
            }
            else if (strSex == "女")
            {
                sex = (int)Enums.woman;
            }

            if (name != "" && cardNo != "" && number != "" && address != "" && suggest != "" && sex >= 0 && sex < 2)
            {
                using (mysql.Conn)
                {
                    mysql.Conn.Open();
                    string cliSql = string.Format("update client set name='{0}',cardNo='{1}',sex={2},number='{3}',endDate='{4}' where cardCli='{5}'",
                                                  name, cardNo, sex, number, date, this.CliCard);
                    string houseSql = string.Format("update house set address='{0}',suggest='{1}',updDate='{2}' where card='{3}'",
                                                    address, suggest, date, this.Card);

                    MySqlTransaction trans = mysql.Conn.BeginTransaction();
                    mysql.Comd.Transaction = trans;

                    mysql.Comd = new MySqlCommand(cliSql, mysql.Conn);
                    int index = mysql.Comd.ExecuteNonQuery();

                    mysql.Comd.CommandText = houseSql;
                    index += mysql.Comd.ExecuteNonQuery();

                    if (index > 1)
                    {
                        trans.Commit();
                        ManageHouse house = new ManageHouse();
                        house.JobNum  = this.JobNum;
                        house.L       = this.L;
                        house.JobName = this.JobName;
                        house.Messge  = "房源信息更新成功!";
                        house.Show();
                        this.Dispose();
                    }
                    else
                    {
                        trans.Rollback();
                        MessageBox.Show("更新失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("必填项不能为空!");
            }
        }
Пример #6
0
        private void btnOrder_Click(object sender, EventArgs e)
        {
            string name      = this.textName.Text;
            string cardNo    = this.textCardNo.Text;
            string number    = this.textNumber.Text;
            string factPrice = this.textFactPrice.Text;
            string strSex    = this.comboSex.SelectedItem.ToString();
            string strType   = this.comboType.SelectedItem.ToString();
            string date      = DateTime.Now.ToString("yyyy-MM-dd");

            int sex  = (int)Enums.man;
            int type = (int)Enums.hire;

            if (strSex == "男")
            {
                sex = (int)Enums.man;
            }
            else if (strSex == "女")
            {
                sex = (int)Enums.woman;
            }

            if (strType == "租赁")
            {
                type = (int)Enums.hire;
            }
            else if (strType == "购买")
            {
                type = (int)Enums.sell;
            }
            Random ran       = new Random();
            string orderCard = ran.Next(100000, 1000000).ToString();
            string cliCard   = ran.Next(10000, 100000).ToString();

            if (name != "" && cardNo != "" && number != "" && factPrice != "")
            {
                using (mysql.Conn)
                {
                    mysql.Conn.Open();
                    string clientSql = string.Format("insert into client(cardCli,name,sex,cardNo,number,endDate,status) values('{0}','{1}',{2},'{3}','{4}','{5}',{6})",
                                                     cliCard, name, sex, cardNo, number, date, (int)Enums.resCli);
                    string orderSql = string.Format("insert into orderhouse(orderCard,hostClient,guestClient,houseCard,type,endDate,factPrice,operateMan) values('{0}','{1}','{2}','{3}',{4},'{5}',{6},'{7}')",
                                                    orderCard, this.HouseClient, cliCard, this.Card, type, date, factPrice, this.JobNum);
                    string updHouse = string.Format("update house set state={0} where card='{1}'", type, card);

                    MySqlTransaction trans = mysql.Conn.BeginTransaction();
                    mysql.Comd             = new MySqlCommand(clientSql, mysql.Conn);
                    mysql.Comd.Transaction = trans;

                    int index = mysql.Comd.ExecuteNonQuery();
                    mysql.Comd.CommandText = orderSql;
                    index += mysql.Comd.ExecuteNonQuery();

                    mysql.Comd.CommandText = updHouse;
                    index += mysql.Comd.ExecuteNonQuery();

                    if (index > 2)
                    {
                        trans.Commit();
                        ManageHouse house = new ManageHouse();
                        house.JobNum  = this.JobNum;
                        house.L       = this.L;
                        house.JobName = this.JobName;
                        house.Messge  = "订单生产成功!";
                        house.Show();
                        this.Dispose();
                    }
                    else
                    {
                        trans.Rollback();
                        MessageBox.Show("订单生产失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("必填项不能为空!");
            }
        }