Example #1
0
        private void CustomerProperties_Load(object sender, EventArgs e)
        {
            customers = ShardDb.getCustomersById(customer.id);
            if (!customers.Success)
            {
                this.Close();
                return;
            }
            customer = new Customer();
            foreach (DataRow dr in customers.DataTable.Rows)
            {
                customer.brideName      = dr[0] == null ? "" : dr[0].ToString();
                customer.brideContact   = dr[1] == null ? "" : dr[1].ToString();
                customer.marryDay       = dr[2] == null ? "" : dr[2].ToString();
                customer.channelId      = Convert.ToInt16(dr[3]);
                customer.reserveDate    = dr[4] == null ? "" : dr[4].ToString();
                customer.reserveTime    = dr[5] == null ? "" : dr[5].ToString();
                customer.tryDress       = dr[6] == null ? "" : dr[6].ToString();
                customer.memo           = dr[7] == null ? "" : dr[7].ToString();
                customer.scsj_jsg       = dr[8] == null ? "" : dr[8].ToString();
                customer.scsj_cxsg      = dr[9] == null ? "" : dr[9].ToString();
                customer.scsj_tz        = dr[10] == null ? "" : dr[10].ToString();
                customer.scsj_xw        = dr[11] == null ? "" : dr[11].ToString();
                customer.scsj_xxw       = dr[12] == null ? "" : dr[12].ToString();
                customer.scsj_yw        = dr[13] == null ? "" : dr[13].ToString();
                customer.scsj_dqw       = dr[14] == null ? "" : dr[14].ToString();
                customer.scsj_tw        = dr[15] == null ? "" : dr[15].ToString();
                customer.scsj_jk        = dr[16] == null ? "" : dr[16].ToString();
                customer.scsj_jw        = dr[17] == null ? "" : dr[17].ToString();
                customer.scsj_dbw       = dr[18] == null ? "" : dr[18].ToString();
                customer.scsj_yddc      = dr[19] == null ? "" : dr[19].ToString();
                customer.scsj_qyj       = dr[20] == null ? "" : dr[20].ToString();
                customer.scsj_bpjl      = dr[21] == null ? "" : dr[21].ToString();
                customer.status         = Int16.Parse(dr[22].ToString());
                customer.jdgw           = dr[23] == null ? "" : dr[23].ToString();
                customer.groomName      = dr[24] == null ? "" : dr[24].ToString();
                customer.groomContact   = dr[25] == null ? "" : dr[25].ToString();
                customer.wangwangID     = dr[26] == null ? "" : dr[26].ToString();
                customer.id             = Convert.ToInt16(dr[27]);
                customer.reservetimes   = dr[28] == null ? "" : dr[28].ToString();
                customer.retailerMemo   = dr[29] == null ? "" : dr[29].ToString();
                customer.hisreason      = dr[30] == null ? "" : dr[30].ToString();
                customer.storeId        = Convert.ToInt16(dr[31]);
                customer.accountPayable = dr[32].ToString();
                customer.refund         = dr[33].ToString();
                customer.fine           = dr[34].ToString();
                customer.partnerName    = dr[35] == null ? "" : dr[35].ToString();
            }
            tbCustomerID.Text   = customer.id.ToString();
            tbBrideName.Text    = customer.brideName;
            tbBrideContact.Text = customer.brideContact;
            tbGroomName.Text    = customer.groomName;
            tbGroomContact.Text = customer.groomContact;
            dtMarryDay.Text     = customer.marryDay;

            comboBoxChannel.DisplayMember = "name";
            comboBoxChannel.ValueMember   = "id";
            Data channels = ShardDb.getChannels();

            if (!channels.Success)
            {
                this.Close();
                return;
            }
            comboBoxChannel.DataSource    = channels.DataTable;
            comboBoxChannel.SelectedValue = customer.channelId;
            combBoxCity.DisplayMember     = "name";
            combBoxCity.ValueMember       = "id";
            Data cities = ShardDb.getCities();

            if (!cities.Success)
            {
                this.Close();
                return;
            }
            combBoxCity.DataSource = cities.DataTable;
            Data city = ShardDb.getCityByStoreId(customer.storeId);

            if (!city.Success)
            {
                this.Close();
                return;
            }
            combBoxCity.SelectedValue   = Convert.ToInt16(city.DataTable.Rows[0].ItemArray[0]);
            comboBoxStore.SelectedValue = customer.storeId;
            dtReserveDate.Value         = customer.reserveDate == "" ? DateTime.Today : DateTime.Parse(customer.reserveDate);
            dtReserveTime.Value         = customer.reserveTime == "" ? DateTime.Now : DateTime.Parse(customer.reserveTime);
            if (customer.tryDress.Equals("是"))
            {
                radioButtonYes.Checked = true;
            }
            else
            {
                radioButtonNo.Checked = true;
            }
            tbMemo.Text      = customer.memo;
            tbHisReason.Text = customer.hisreason;
            scsj_jsg.Text    = customer.scsj_jsg;
            scsj_cxsg.Text   = customer.scsj_cxsg;
            scsj_tz.Text     = customer.scsj_tz;
            scsj_xw.Text     = customer.scsj_xw;
            scsj_xxw.Text    = customer.scsj_xxw;
            scsj_yw.Text     = customer.scsj_yw;
            scsj_dqw.Text    = customer.scsj_dqw;
            scsj_tw.Text     = customer.scsj_tw;
            scsj_jk.Text     = customer.scsj_jk;
            scsj_jw.Text     = customer.scsj_jw;
            scsj_dbw.Text    = customer.scsj_dbw;
            scsj_yddc.Text   = customer.scsj_yddc;
            scsj_qyj.Text    = customer.scsj_qyj;
            scsj_bpjl.Text   = customer.scsj_bpjl;
            wangwangID.Text  = customer.wangwangID;
            jdgw.Text        = customer.jdgw;
            //tbAddress.Text = customer.address;
            reserveTimes               = Int16.Parse(customer.reservetimes);
            lastStatus                 = customer.status;
            textBoxRetailerMemo.Text   = customer.retailerMemo;
            textBoxAccountPayable.Text = customer.accountPayable;
            textBoxRefund.Text         = customer.refund;
            textBoxFine.Text           = customer.fine;
            Data status = ShardDb.getCustomerStatus();

            if (!status.Success)
            {
                this.Close();
                return;
            }
            comboBoxStatus.DisplayMember = "name";
            comboBoxStatus.ValueMember   = "id";
            comboBoxStatus.DataSource    = status.DataTable;
            comboBoxStatus.SelectedValue = customer.status;

            fillTryDressList();
            fillOrderList();
            if (Sharevariables.UserLevel == 1)
            {
                buttonDelete.Enabled = true;
            }
            else
            {
                buttonDelete.Enabled = false;
            }

            if (Sharevariables.UserLevel == 4)
            {
                buttonSave.Enabled = false;
            }
            else
            {
                buttonSave.Enabled = true;
            }

            if (Sharevariables.UserLevel == 16)
            {
                dataGridViewOrder.Enabled = false;
                dataGridViewTryOn.Enabled = false;
            }
            else
            {
                dataGridViewOrder.Enabled = true;
                dataGridViewTryOn.Enabled = true;
            }
        }