Ejemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (btnEdit.Text == "Edit")
            {
                txt_FristName.ReadOnly = false;
                txt_Email.ReadOnly     = false;
                txt_CellPhone.ReadOnly = false;
                txt_LastName.ReadOnly  = false;
                txt_BusiName.ReadOnly  = false;
                txt_Address.ReadOnly   = false;
                txt_BusiPhone.ReadOnly = false;
                txt_City.ReadOnly      = false;
                txt_Website.ReadOnly   = false;
                txt_Zip.ReadOnly       = false;
                cmb_BusiType.Enabled   = true;
                cmb_County.Enabled     = true;
                cmb_State.Enabled      = true;
                btnEdit.Text           = "Update";
            }
            else
            {
                if (txt_State.Text != "")
                {
                    sid = wrap.InsertData(new string[] { txt_State.Text, cmb_Country.SelectedValue.ToString() }, "PROC_INSERT_STATE", "State");
                }
                if (txt_BusiType.Text != "" || txt_BusiType.Text != string.Empty)
                {
                    bid = wrap.InsertData(new string[] { txt_BusiType.Text }, "PROC_INSERT_BUSINESSTYPE", "BusinessType");
                }
                if (txt_County.Text != "" || txt_County.Text != string.Empty)
                {
                    cid = wrap.InsertData(new string[] { cmb_State.SelectedValue.ToString(), txt_County.Text }, "PROC_INSERT_COUNTY", "County");
                }

                btid   = wrap.GetScalarValue(cmb_BusiType.Text, "business_type");
                stid   = wrap.GetScalarValue(cmb_State.Text, "state");
                cntrid = wrap.GetScalarValue(cmb_Country.Text, "country");
                cntyid = wrap.GetScalarValue(cmb_County.Text, "county");

                cphone = txt_CellPhone.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                bphone = txt_CellPhone.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                bool res = wrap.UpdateMemberReg(new string[] { lblReg_id.Text, txt_FristName.Text.ToString(), txt_LastName.Text.ToString(), txt_BusiName.Text.ToString(), cmb_BusiType.Text == "Others" ? bid.ToString(): btid.ToString(),
                                                               txt_Address.Text, cntrid.ToString(), txt_City.Text, cmb_County.Text == "Others" ? cid.ToString(): cntyid.ToString(), cmb_State.Text == "Others" ? sid.ToString() : stid.ToString(), txt_Zip.Text, txt_BusiPhone.Text,
                                                               txt_CellPhone.Text, txt_Email.Text, txt_Website.Text });
                if (res == true)
                {
                    string FINAL = "BEGIN:VCARD" + "\n"
                                   + "VERSION:4.0" + "\n"
                                   + "N:" + txt_LastName.Text.ToUpper() + "; AARA-" + txt_FristName.Text.ToUpper() + ";;;" + "\n"
                                   + "FN: AARA-" + txt_FristName.Text.ToUpper() + " " + txt_LastName.Text.ToUpper() + "\n"
                                   + "ORG:" + txt_BusiName.Text + "\n"
                                   + "TEL;TYPE=work,voice;VALUE=uri:" + bphone + "\n"
                                   + "TEL;TYPE=cell,voice;VALUE=uri:" + cphone + "\n"
                                   + "ADR;TYPE=work:;;" + txt_Address.Text.ToUpper() + ";" + txt_City.Text.ToUpper() + ";" + cmb_State.Text.ToUpper() + ";" + txt_Zip.Text + ";" + cmb_Country.Text + "\n"
                                   + "EMAIL:" + txt_Email.Text + "\n"
                                   + "END:VCARD";


                    qrcode     = new QRCodeGenerater(FINAL);
                    imageBytes = qrcode.CodeGenerator();

                    bool result = wrap.InsertQrTable(new string[] { "PROC_INSERT_DATA_IN_QRTABLE", lblRegistrationID.Text }, imageBytes);
                    if (result == true)
                    {
                        DataTable dt = wrap.GetDataForQr(lblRegistrationID.Text);
                        Pic_QRCode.Image = Image.FromStream(new MemoryStream(imageBytes));
                        frm_Registration.setImage(Pic_QRCode, 155, 150);
                        pnl_Qrcode.Visible      = true;
                        Pic_QRCode.Visible      = true;
                        btnGenerateCode.Visible = true;
                    }
                }
                Clear();
                ReadOnlyAllControl();
                btnEdit.Text = "Edit";
            }
        }
Ejemplo n.º 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (btnEdit.Text == "Edit")
            {
                txt_FristName.ReadOnly = false;
                txt_Email.ReadOnly = false;
                txt_CellPhone.ReadOnly = false;
                txt_LastName.ReadOnly = false;
                txt_BusiName.ReadOnly = false;
                txt_Address.ReadOnly = false;
                txt_BusiPhone.ReadOnly = false;
                txt_City.ReadOnly = false;
                txt_Website.ReadOnly = false;
                txt_Zip.ReadOnly = false;
                cmb_BusiType.Enabled = true;
                cmb_County.Enabled = true;
                cmb_State.Enabled = true;
                btnEdit.Text = "Update";
            }
            else
            {
                if (txt_State.Text != "")
                {
                    sid = wrap.InsertData(new string[] { txt_State.Text, cmb_Country.SelectedValue.ToString() }, "PROC_INSERT_STATE", "State");
                }
                if (txt_BusiType.Text != "" || txt_BusiType.Text != string.Empty)
                {
                    bid = wrap.InsertData(new string[] { txt_BusiType.Text }, "PROC_INSERT_BUSINESSTYPE", "BusinessType");
                }
                if (txt_County.Text != "" || txt_County.Text != string.Empty)
                {
                    cid = wrap.InsertData(new string[] { cmb_State.SelectedValue.ToString(), txt_County.Text }, "PROC_INSERT_COUNTY", "County");
                }

                btid = wrap.GetScalarValue(cmb_BusiType.Text, "business_type");
                stid = wrap.GetScalarValue(cmb_State.Text, "state");
                cntrid = wrap.GetScalarValue(cmb_Country.Text, "country");
                cntyid = wrap.GetScalarValue(cmb_County.Text, "county");

                cphone = txt_CellPhone.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                bphone = txt_CellPhone.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                bool res = wrap.UpdateMemberReg(new string[] {lblReg_id.Text,txt_FristName.Text.ToString(), txt_LastName.Text.ToString(), txt_BusiName.Text.ToString(), cmb_BusiType.Text == "Others" ? bid.ToString(): btid.ToString() ,
                                txt_Address.Text,cntrid.ToString(),txt_City.Text,cmb_County.Text == "Others" ? cid.ToString(): cntyid.ToString(),cmb_State.Text == "Others" ? sid.ToString() : stid.ToString(),txt_Zip.Text,txt_BusiPhone.Text,
                                txt_CellPhone.Text,txt_Email.Text,txt_Website.Text});
                if (res == true)
                {
                    string FINAL = "BEGIN:VCARD" + "\n"
                + "VERSION:4.0" + "\n"
                + "N:" + txt_LastName.Text.ToUpper() + "; AARA-" + txt_FristName.Text.ToUpper() + ";;;" + "\n"
                + "FN: AARA-" + txt_FristName.Text.ToUpper() + " " + txt_LastName.Text.ToUpper() + "\n"
                + "ORG:" + txt_BusiName.Text + "\n"
                + "TEL;TYPE=work,voice;VALUE=uri:" + bphone + "\n"
                + "TEL;TYPE=cell,voice;VALUE=uri:" + cphone + "\n"
                + "ADR;TYPE=work:;;" + txt_Address.Text.ToUpper() + ";" + txt_City.Text.ToUpper() + ";" + cmb_State.Text.ToUpper() + ";" + txt_Zip.Text + ";" + cmb_Country.Text + "\n"
                + "EMAIL:" + txt_Email.Text + "\n"
                + "END:VCARD";

                    qrcode = new QRCodeGenerater(FINAL);
                    imageBytes = qrcode.CodeGenerator();

                    bool result = wrap.InsertQrTable(new string[] {"PROC_INSERT_DATA_IN_QRTABLE",lblRegistrationID.Text},imageBytes);
                    if (result == true)
                    {
                        DataTable dt = wrap.GetDataForQr(lblRegistrationID.Text);
                        Pic_QRCode.Image = Image.FromStream(new MemoryStream(imageBytes));
                        frm_Registration.setImage(Pic_QRCode, 155, 150);
                        pnl_Qrcode.Visible = true;
                        Pic_QRCode.Visible = true;
                        btnGenerateCode.Visible = true;
                    }
                }
                Clear();
                ReadOnlyAllControl();
                btnEdit.Text = "Edit";
            }
        }