Exemplo n.º 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (brideName.Text == "")
            {
                MessageBox.Show("请输入新娘姓名!");
                return;
            }

            if (brideContact.Text == "")
            {
                MessageBox.Show("请输入联系方式!");
                return;
            }

            if (wangwangID.Text.Length == 0)
            {
                MessageBox.Show("请输入WangWangId!");
                return;
            }

            if (((DataRowView)comboBoxChannel.SelectedItem).Row["name"].ToString().Equals("异业合作"))
            {
                if (textBoxPartnerName.Text.Trim().Length == 0)
                {
                    MessageBox.Show("请输入合作企业!");
                    return;
                }
            }

            Customer customer = new Customer();

            customer.brideName    = brideName.Text.Trim();
            customer.brideContact = brideContact.Text.Trim();
            customer.memo         = memo.Text.Trim();
            customer.wangwangID   = wangwangID.Text.Trim();
            customer.channelId    = Convert.ToInt16(comboBoxChannel.SelectedValue);
            customer.storeId      = Convert.ToInt16(comboBoxStore.SelectedValue);
            customer.status       = 1;
            customer.partnerName  = textBoxPartnerName.Text.Trim();
            customer.operatorName = Sharevariables.UserName;
            bool result = ShardDb.insertCustomer(customer);

            if (result)
            {
                this.Close();
            }
        }