private void btnSave_PreProcurement_Click(object sender, RoutedEventArgs e)
        {
            if (PrePro_Validation() == true)
                return;

                try
                {

                    bpreproc.Flag = 1;
                    bpreproc.DealerID = cmbPre_Pro_Salename.SelectedValue.GetHashCode(); //txtsalername.Text;

                    //bpreproc.Phone_Id = txtprephone .Text ;
                    bpreproc.Domain_ID = Convert.ToInt32(cmbPreDomain.SelectedValue.GetHashCode());
                    bpreproc.Product_ID = Convert.ToInt32(cmbPreProduct.SelectedValue.GetHashCode());
                    bpreproc.Brand_ID = Convert.ToInt32(cmbPreBrand.SelectedValue.GetHashCode());
                    bpreproc.P_Category = Convert.ToInt32(cmbPrePCategory.SelectedValue.GetHashCode());
                    bpreproc.Model_No_ID = Convert.ToInt32(cmbPreModel.SelectedValue.GetHashCode());
                    bpreproc.Color_ID = Convert.ToInt32(cmd_PreColor.SelectedValue.GetHashCode());

                    bpreproc.Procurment_Price = Convert.ToDouble(txtPrice.Text);
                    bpreproc.Quantity = Convert.ToDouble(txtQuantity.Text);
                    bpreproc.Total_Amount = Convert.ToDouble(txtTotalPrice.Text);
                    bpreproc.Net_Amount = Convert.ToDouble(txtNetAmount.Text);
                    bpreproc.Round_Off = Convert.ToDouble(txtpreroundoff.Text);
                    //    for (int i = 0; i < 5;i++ )
                    //    { 
                    //        if (chkidproof.IsChecked == true)
                    //        {
                    //            maincked = "ID Proof";
                    //        }

                    //    if(chkaddressproof  .IsChecked ==true )
                    //    {
                    //        maincked = "Address Proof";
                    //    }
                    //        string concate += ","+item maincked;
                    //}
                    string checkList = string.Join(",", checkedStuff.ToArray());
                    if (checkList == null)
                    { bpreproc.Reg_Document = "No"; }
                    else if (checkList != null)
                    {
                        bpreproc.Reg_Document = checkList;
                    }

                    bpreproc.Have_Insurance = cmbPreInsurance.SelectedValue.ToString();
                    string a = (txtPreWarranty.Text) + " - " + (cmbPreWarrantyYM.SelectedItem.ToString());
                    bpreproc.Warranty = a;
                    bpreproc.re_ferb_cost = Convert.ToDouble(txtPreFerbcost.Text);
                    bpreproc.Follow_up = cmbPreFollowup.SelectedValue.ToString();
                    bpreproc.Narration = txtnarration.Text;
                    bpreproc.PendingPreProc = "Active";
                    bpreproc.S_Status = "Active";
                    bpreproc.C_Date = System.DateTime.Now.ToShortDateString();
                    dpreproc.Pre_Procurement_Save_Insert_Update_Delete(bpreproc);
                    //MessageBox.Show("Data Save Successfully");
                    frmValidationMessage obj = new frmValidationMessage();
                    obj.lblMessage.Content = "Data Save Successfully";
                    obj.ShowDialog();
                    txtP_Narration.Text = txtnarration.Text;
                    txtP_Price.Text = "";
                    clearallPreProcurement();
                    PREPROCUREMENTid();
                    Fetch_Pre_Domain();


                    //baddprd.Flag = 1;
                    //baddprd.Domain_Name = cmbP_domain.SelectedValue.ToString ();
                    //baddprd.Product_Name = cmbP_Product.SelectedValue.ToString();
                    //baddprd.Brand_Name = cmbP_Brand.SelectedValue.ToString();
                    //baddprd.Product_Category = cmbP_PCategory.SelectedValue.ToString();
                    //baddprd.Model_No = cmbP_ModelNo.SelectedValue.ToString();
                    //baddprd.Color = cmbP_Color.SelectedValue.ToString();
                    //baddprd.Narration = txtP_Narration.Text;
                    //baddprd.Price = Convert.ToDouble(txtP_Price.Text);
                    //baddprd.S_Status = "Active";
                    //baddprd.C_Date = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
                    //dalprd.Save_Insert_Update_Delete(baddprd);
                    //MessageBox.Show("Data Save Successfully");
                    //txtP_Narration.Text = "";
                    //txtP_Price.Text = "";
                    // Load_Domain();
                }
                catch (Exception)
                {

                    throw;
                }
        }
        public bool Followup_Validation()
        {
            bool result = false;
            if (cmbCEmployeename.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Employee Name";
                cmbCEmployeename.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (txtAdm_FollowupFirstName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Follow-up First Name";
                txtAdm_FollowupFirstName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (txtAdm_FollowupLastName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Follow-up Last Name";
                txtAdm_FollowupLastName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (dp_Dob.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Follow-up Date of Birth";
                dp_Dob.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (cmbCSourceofEnq.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Source of Enquiry";
                cmbCSourceofEnq.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbFollowup_Occupation.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Occupation";
                cmbFollowup_Occupation.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (txtCMobile.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Follow-up Mobile No.";
                txtCMobile.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (dp_Cdate.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Follow-up Date";
                dp_Cdate.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }            
            return result;
        }
        public bool Campaign_Validation()
        {
            bool result = false;
            if(txtCampaginName.Text == "")
            {
                result = true;

                frmValidationMessage obj = new frmValidationMessage()
                obj.lblMessage.Content = "Please Select Campanign Name";

                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Campanign Name";
                obj.ShowDialog();
                txtCampaginName.BorderBrush = Brushes.Red;
            }
            else if (cmbCampaignType.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Campanign Type";
                obj.ShowDialog();
                cmbCampaignType.BorderBrush = Brushes.Red;
            }
            else if (dp_CompStartDate.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Start Date";
                obj.ShowDialog();
            }
            else if (dp_CompEndDate.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select End Date";
                obj.ShowDialog();
            }
            else if (txtCampExpectedRevenue.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Expected Revenue";
                obj.ShowDialog();
                txtCampExpectedRevenue.BorderBrush = Brushes.Red;
            }
            return result;
        }
 private void btnMassCampUpdate_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bcrcamp.Flag = 1;
         bcrcamp.MassCampID = Convert.ToInt32(txtMassCampaignID.Text);
         bcrcamp.Status = cmbUPMassStatus.Text;
         bcrcamp.S_Status = "Active";
         bcrcamp.C_Date = System.DateTime.Now.ToShortDateString();
         dcrcamp.UpdateMassCreateLeadCampaign_Insert_Update_Delete(bcrcamp);
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Mass Campaign Status Updated Successfully";
         obj.ShowDialog();
     }
     catch
     {
         throw;
     }
     finally { con.Close(); }
     LeadMassCampaign_Details();
 }
        private void btnFinalProcurement_Click(object sender, RoutedEventArgs e)
        {
            if (FinalPro_Validation() == true)
                return;

            if (CheckProduct() == true)
            {
                try
                {
                    bstockDet.Flag = 1;
                    bstockDet.SID = Convert.ToInt32(txtAdm_StockID.Text);
                    //bstockDet.Products123 = lblProducts.Content.ToString();
                    bstockDet.NewQty = txtQuantityF.Text;
                    bstockDet.FinalPrice = Convert.ToDouble(txtPrice1.Text);
                    bstockDet.S_Status = "Active";
                    bstockDet.C_Date = Convert.ToString(System.DateTime.Now.ToShortDateString());
                    dstUpdate.AddStockDetailsUp_Insert_Update_Delete(bstockDet);
                    //MessageBox.Show("Data Save Successfully", caption, MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }

                AddQuantity_Check();
                AddQuantity();
                try
                {
                    bstockDet.Flag = 1;
                    bstockDet.SID = Convert.ToInt32(txtAdm_StockID.Text);
                    //bstockDet.Products123 = lblProducts.Content.ToString();
                    bstockDet.AvilableQty = Convert.ToString(add);
                    daddqty.AddQtyStockDetails_Insert_Update_Delete(bstockDet);
                    //MessageBox.Show("Quantity Save Succesfully...", caption, MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }


                try
                {
                    bstockDet.Flag = 1;
                    bstockDet.SID = Convert.ToInt32(txtAdm_StockID.Text);
                    //bstockDet.Products123 = lblProducts.Content.ToString();
                    bstockDet.AvilableQty = Convert.ToString(add);
                    daddqty.AddQtyStockDetails_Insert_Update_Delete(bstockDet);
                    //MessageBox.Show("Quantity Save Succesfully...", caption, MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }
            else
            {
                try
                {
                    bstockDet.Flag = 1;
                    bstockDet.DomainID = Convert.ToInt32(txtAdm_DomainID.Text);
                    bstockDet.ProductID = Convert.ToInt32(txtAdm_ProductID.Text);
                    bstockDet.BrandID = Convert.ToInt32(txtAdm_BrandID.Text);
                    bstockDet.ProductCatID = Convert.ToInt32(txtAdm_ProductCatID.Text);
                    bstockDet.ModelID = Convert.ToInt32(txtAdm_ModelID.Text);
                    bstockDet.ColorId = Convert.ToInt32(txtAdm_ColorID.Text);
                    bstockDet.Products1234 = lblProducts.Content.ToString();

                    // bstockDet.Products123= lblProducts.Content.ToString();


                    bstockDet.Products1234 = lblProducts.Content.ToString();
                    //bstockDet.Products123= lblProducts.Content.ToString();
                    bstockDet.AvilableQty = txtQuantityF.Text;
                    bstockDet.SaleQty = txtSaleQuantity.Text;
                    bstockDet.NewQty = txtQuantityF.Text;
                    bstockDet.FinalPrice = Convert.ToDouble(txtPrice1.Text);
                    bstockDet.Insurance = lblInsurance.Content.ToString();
                    bstockDet.Warranty = lblProceWarranty .Content.ToString();
                    bstockDet.S_Status = "Active";
                    bstockDet.C_Date = Convert.ToString(System.DateTime.Now.ToShortDateString());
                    dstockDet.AddStockDetails_Insert_Update_Delete(bstockDet);
                    //MessageBox.Show("Data Save Successfully", caption, MessageBoxButton.OK, MessageBoxImage.Information);

                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }

            string abc;

            if (chbDefault.IsChecked == true)
            {
                abc = "Default";
            }
            else
            {
                abc = "No";
            }

            //final dealer
            try
            {
                bfinaldealer1.Flag = 1;
                bfinaldealer1.FDealerID = Convert.ToInt32(txtAdm_DealerID.Text);
                bfinaldealer1.SalesID = lblSalesNo.Content.ToString();
                bfinaldealer1.Domain_ID = Convert.ToInt32(txtAdm_DomainID.Text);
                bfinaldealer1.Product_ID = Convert.ToInt32(txtAdm_ProductID.Text);
                bfinaldealer1.Brand_ID = Convert.ToInt32(txtAdm_BrandID.Text);
                bfinaldealer1.P_Category = Convert.ToInt32(txtAdm_ProductCatID.Text);
                bfinaldealer1.Model_No_ID = Convert.ToInt32(txtAdm_ModelID.Text);
                bfinaldealer1.Color_ID = Convert.ToInt32(txtAdm_ColorID.Text);
                bfinaldealer1.ProcNetAmt = Convert.ToDouble(lblProceNetAmt.Content.ToString());
                bfinaldealer1.ProcPrice = Convert.ToDouble(lblProcePrice.Content.ToString());
                bfinaldealer1.ProcQty = lblProceQty.Content.ToString();
                bfinaldealer1.FinalPrice = Convert.ToDouble(txtPrice1.Text);
                bfinaldealer1.FinalQty = txtQuantityF.Text;
                bfinaldealer1.SubTotal = Convert.ToDouble(txtTotalPrice1.Text);
                bfinaldealer1.RoundUp = Convert.ToDouble(txtpreroundoff1.Text);
                bfinaldealer1.NetAmt = Convert.ToDouble(txtNetAmount1.Text);
                //bfinaldealer.FinalDate = Convert.ToString(dtpFinalDate.Text);
                bfinaldealer1.SDefault = abc;
                bfinaldealer1.ServiceIntervalMonth = txtAdm_FinalMonths.Text;
                //bfinaldealer1.FMonths = lblFinal_Months.Content.ToString();
                bfinaldealer1.S_Status = "Active";
                bfinaldealer1.C_Date = Convert.ToString(System.DateTime.Now.ToShortDateString());
                dfinaldealer.FinalDealer_Insert_Update_Delete(bfinaldealer1);
                //MessageBox.Show("Data Save Successfully", caption, MessageBoxButton.OK, MessageBoxImage.Information);

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            //AddQuantity_Check();
            //AddQuantity();

            //try
            //{
            //    bstockDet.Flag = 1;
            //    bstockDet.SID = Convert.ToInt32(txtAdm_StockID.Text);
            //    //bstockDet.Products123 = lblProducts.Content.ToString();
            //    bstockDet.AvilableQty = Convert.ToString(add);
            //    daddqty.AddQtyStockDetails_Insert_Update_Delete(bstockDet);
            //    //MessageBox.Show("Quantity Save Succesfully...", caption, MessageBoxButton.OK, MessageBoxImage.Information);
            //}
            //catch (Exception)
            //{
            //    throw;
            //}
            //finally
            //{
            //    con.Close();
            //}


            //try
            //{
            //    bstockDet.Flag = 1;
            //    bstockDet.SID = Convert.ToInt32(txtAdm_StockID.Text);
            //    //bstockDet.Products123 = lblProducts.Content.ToString();
            //    bstockDet.AvilableQty = Convert.ToString(add);
            //    daddqty.AddQtyStockDetails_Insert_Update_Delete(bstockDet);
            //    //MessageBox.Show("Quantity Save Succesfully...", caption, MessageBoxButton.OK, MessageBoxImage.Information);
            //}
            //catch (Exception)
            //{
            //    throw;
            //}
            //finally
            //{
            //    con.Close();
            //}

            try
            {
                bfinaldealer1.Flag = 1;
                bfinaldealer1.FDealerID = Convert.ToInt32(txtAdm_DealerID.Text);
                bfinaldealer1.S_Status = "DeActive";
                dFup.FinalUpdateD_Insert_Update_Delete(bfinaldealer1);
                //MessageBox.Show("Update Final Dealer Succesfully...", caption, MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            frmValidationMessage obj = new frmValidationMessage();
            obj.lblMessage.Content = "Data Save Successfully";
            obj.ShowDialog();

          //  MessageBox.Show("Data Save Successfully", caption, MessageBoxButton.OK, MessageBoxImage.Information);

            //txtAdm_DomainID.Text = "";
            //txtAdm_ProductID.Text = "";
            txtAdm_StockID.Text = "";
            txtAdm_BrandID.Text = "";
            txtAdm_AvilableQty.Text = "";
            txtAdm_ColorID.Text = "";
            txtAdm_DomainID.Text = "";
            txtAdm_ProductCatID.Text = "";
            txtAdm_ProductID.Text = "";
            txtAdm_DealerID.Text = "";
            lblSalesNo.Content = "";
            lblProcDate.Content = "";
            lblProducts.Content = "";
            lblProceNetAmt.Content = "";
            lblProcePrice.Content = "";
            txtPrice1.Text = "";
            txtQuantityF.Text = "";
            dtpFinalDate.Text = "";
            txtTotalPrice1.Text = "";
            txtpreroundoff1.Text = "";
            txtNetAmount1.Text = "";

            Final_PreProcurement();

            Salesid();
        }
        private void btnFollowupSavePhoto(object sender, RoutedEventArgs e)
        {
            string imagepath = filepath.ToString();
            string picname = imagepath.Substring(imagepath.LastIndexOf('\\'));

            string path = AppDomain.CurrentDomain.BaseDirectory + '\\';
            if (!(System.IO.Directory.Exists(path)))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            string path1 = path + "\\images\\WalkIns\\" + picname + ".JPG";
            ///
            using (System.IO.FileStream filestream = new System.IO.FileStream(Convert.ToString(path1), System.IO.FileMode.Create))
            {
                JpegBitmapEncoder encoder = new JpegBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create(bmp));
                encoder.QualityLevel = 100;
                encoder.Save(filestream);
            }
            //MessageBox.Show("Image Successfully Saved :" + path + "'\'Image'\'" + picname);
            frmValidationMessage obj = new frmValidationMessage();
            obj.lblMessage.Content = "Image Save Successfully";
            obj.ShowDialog();


        }
        private void btnSavePhoto_Click(object sender, RoutedEventArgs e)
        {
            if (txtEmp_PhotoPath.Text.Trim() != string.Empty)
            {
                if (txtEmployeeID.Text.Trim() == string.Empty)
                {
                    GetMaxID();
                }
                try
                {
                    bemphpoto.Flag = 1;
                    bemphpoto.EmployeeID = Convert.ToInt32(txtEmployeeID.Text);
                    bemphpoto.PhotoPath = txtEmp_PhotoPath.Text;
                    bemphpoto.EmpPhoto = (byte[])(picture);
                    bemphpoto.S_Status = "Active";
                    bemphpoto.C_Date = System.DateTime.Now.ToShortDateString();
                    dempphoto.EmployeePhoto_Insert_Update_Delete(bemphpoto);

                    frmValidationMessage obj = new frmValidationMessage();
                    obj.lblMessage.Content = "Photo Save Successfully";
                    obj.ShowDialog();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }
            else
                MessageBox.Show("Browse Photo", "UniWeb Technocrats", MessageBoxButton.OK, MessageBoxImage.Information);
        }
        private void btnSave_Customer_Click(object sender, RoutedEventArgs e)
        {
            if (Customer_Validation() == true)
                return;

            try
            {
                bcustomer.Flag = 1;
                bcustomer.Cust_ID = lblCustomerID.Content.ToString();
                bcustomer.FirstName = txtCustomerFirstName.Text;
                bcustomer.LastName = txtCustomerLastName.Text;
                bcustomer.Date_Of_Birth = dtpCustomer_DOB.Text;
                bcustomer.Occupation = cmbCustomer_Occupation.Text;
                bcustomer.Mobile_No = txtCustomer_Mobile.Text;
                bcustomer.PhoneNo = txtCustomer_PhoneNo.Text;
                bcustomer.Email_ID = txtCustomer_Emailid.Text;
                bcustomer.Address = txtCustomer_Address.Text;
                bcustomer.City = cmbCustomer_City.Text;
                bcustomer.ZipNo = txtCustomer_Zip.Text;
                bcustomer.State = cmbCustomer_State.Text;
                bcustomer.Country = cmbCustomer_Country.Text;
                bcustomer.SourceOfEnquiry = cmbCustomer_SourceofEnq.Text;
                soe = cmbCustomer_SourceofEnq.SelectedValue.ToString();
                if (soe == "Newspaper")
                {
                    vsoe = 1;
                }
                else if (soe == "Poster")
                {
                    vsoe = 2;
                }
                else if (soe == "Friends / Colleagues")
                {
                    vsoe = 3;

                }
                else if (soe == "Net / Website")
                {
                    vsoe = 4;

                }
                else if (soe == "Non")
                {
                    vsoe = 5;
                }
                bcustomer.SourceEnquiryID = vsoe;
                bcustomer.S_Status = "Active";
                bcustomer.C_Date = System.DateTime.Now.ToString();
                dcustomer.Customer_Save_Insert_Update_Delete(bcustomer);
                //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                clearfunctionforCustomer();
                Customeriid();
            }
            catch
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            Load_Customer_City();
            Load_Customer_Country();
            Load_Customer_State();
            Load_Customer_Occupation();
            Customeriid();
        }
        //camp contact event
        #region CampContact Function
        #region CampContact Button Event
        private void btnCampContact_Save_Click(object sender, RoutedEventArgs e)
        {
            if (CampContact_Validation() == true)
                return;

            if (btnCampContact_Save.Content.ToString() == "Save")
            {
                try
                {
                    bcontcust.Flag = 1;
                    bcontcust.EmployeeID = cmbCampContactEmployeeName.SelectedValue.GetHashCode();
                    bcontcust.ContactID = lblCampContactID.Content.ToString();
                    bcontcust.CTitle = cmbCampContactTitle.Text;
                    bcontcust.FiratName = txtCampContactFirstName.Text;
                    bcontcust.LastName = txtCampContactLastName.Text;
                    bcontcust.DateOfBirth = dtpCampContactDOB.Text;
                    bcontcust.MobileNo = txtCampContactMobile.Text;
                    bcontcust.PhoneNo = txtCampContactPhoneNo.Text;
                    bcontcust.SourceOfEnquiry = cmbCampContactSourceofEnq.Text;
                    soe = cmbCampContactSourceofEnq.Text;
                    if (soe == "Newspaper")
                    {
                        vsoe = 1;
                    }
                    else if (soe == "Advertisement")
                    {
                        vsoe = 2;
                    }
                    else if (soe == "Friends / Colleagues")
                    {
                        vsoe = 3;

                    }
                    else if (soe == "External Referral")
                    {
                        vsoe = 4;

                    }
                    else if (soe == "Online Store")
                    {
                        vsoe = 5;
                    }
                    else if (soe == "Public Relation")
                    {
                        vsoe = 6;
                    }
                    else if (soe == "Sales Mail Alias")
                    {
                        vsoe = 7;
                    }
                    else if (soe == "Net / Website")
                    {
                        vsoe = 8;
                    }
                    else if (soe == "Other")
                    {
                        vsoe = 9;
                    }
                    bcontcust.SourceOfEnquiryID = vsoe;
                    bcontcust.Occupation = cmbCampContactOccupation.Text;
                    bcontcust.EmailID = txtCampContactEmailid.Text;
                    bcontcust.FaxNo = txtCampContactFaxNo.Text;
                    bcontcust.Wbsite = txtCampContactWebsite.Text;
                    bcontcust.MailingStreet = txtCampContactMailingAddress.Text;
                    bcontcust.MailingCity = cmbCampContactMailingCity.Text;
                    bcontcust.MailingState = cmbCampContactMailingState.Text;
                    bcontcust.MailingZipNo = txtCampContactMailingZip.Text;
                    bcontcust.MailingCountry = cmbCampContactMailingCountrty.Text;
                    bcontcust.OtherStreet = txtCampContactOtherAddress.Text;
                    bcontcust.OtherCity = cmbCampContactOtherCity.Text;
                    bcontcust.OtherState = cmbCampContactOtherState.Text;
                    bcontcust.OtherZipNo = txtCampContactOtherZip.Text;
                    bcontcust.OtherCountry = cmbCampContactOtherCountrty.Text;
                    bcontcust.Description = txtCampContactDescription.Text;
                    bcontcust.CustomerSystemPhotoPath = txtCampContactSystemPhotoPath.Text;
                    bcontcust.CustomerActualPhotoPath = txtCampContactActualPhotoPath.Text;
                    bcontcust.S_Status = "Active";
                    bcontcust.C_Date = System.DateTime.Now.ToString();
                    dcontcust.ContactCustomer_Save_Insert_Update_Delete(bcontcust);
                    //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                    frmValidationMessage obj = new frmValidationMessage();
                    obj.lblMessage.Content = "Data Save Successfully";
                    obj.ShowDialog();
                    //clearfunctionforfollowup();
                    txtLeadStatus.Text = lblCStatus.Content.ToString();
                    LeadGetMax_CreateContatID();
                    
                    try
                    {
                        bcontcust.Flag = 1;
                        bcontcust.CCampaignID = Convert.ToInt32(txtCampaignsViewID.Text);
                        bcontcust.ContactCustomerID = Convert.ToInt32(txtContactCustomerID.Text);
                        bcontcust.Status = txtLeadStatus.Text;
                        bcontcust.S_Status = "Active";
                        bcontcust.C_Date = System.DateTime.Now.ToString();
                        dcontcust.CreateContactCampaign_Save_Insert_Update_Delete(bcontcust);
                    }
                    catch
                    {
                        throw;
                    }
                    finally
                    {
                        con.Close();
                    }

                    grdCampCreateContact.Visibility = System.Windows.Visibility.Visible;
                    CreateContactCampaign_Details();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }
            else if (btnCampContact_Save.Content.ToString() == "Update")
            {
                try
                {
                    bcontcust.Flag = 2;
                    bcontcust.ID = Convert.ToInt32(tctCampCCCampainID.Text);
                    bcontcust.EmployeeID = cmbCampContactEmployeeName.SelectedValue.GetHashCode();
                    bcontcust.ContactID = lblCampContactID.Content.ToString();
                    bcontcust.CTitle = cmbCampContactTitle.Text;
                    bcontcust.FiratName = txtCampContactFirstName.Text;
                    bcontcust.LastName = txtCampContactLastName.Text;
                    bcontcust.DateOfBirth = dtpCampContactDOB.Text;
                    bcontcust.MobileNo = txtCampContactMobile.Text;
                    bcontcust.PhoneNo = txtCampContactPhoneNo.Text;
                    bcontcust.SourceOfEnquiry = cmbCampContactSourceofEnq.Text;
                    soe = cmbCampContactSourceofEnq.Text;
                    if (soe == "Newspaper")
                    {
                        vsoe = 1;
                    }
                    else if (soe == "Advertisement")
                    {
                        vsoe = 2;
                    }
                    else if (soe == "Friends / Colleagues")
                    {
                        vsoe = 3;

                    }
                    else if (soe == "External Referral")
                    {
                        vsoe = 4;

                    }
                    else if (soe == "Online Store")
                    {
                        vsoe = 5;
                    }
                    else if (soe == "Public Relation")
                    {
                        vsoe = 6;
                    }
                    else if (soe == "Sales Mail Alias")
                    {
                        vsoe = 7;
                    }
                    else if (soe == "Net / Website")
                    {
                        vsoe = 8;
                    }
                    else if (soe == "Other")
                    {
                        vsoe = 9;
                    }
                    bcontcust.SourceOfEnquiryID = vsoe;
                    bcontcust.Occupation = cmbCampContactOccupation.Text;
                    bcontcust.EmailID = txtCampContactEmailid.Text;
                    bcontcust.FaxNo = txtCampContactFaxNo.Text;
                    bcontcust.Wbsite = txtCampContactWebsite.Text;
                    bcontcust.MailingStreet = txtCampContactMailingAddress.Text;
                    bcontcust.MailingCity = cmbCampContactMailingCity.Text;
                    bcontcust.MailingState = cmbCampContactMailingState.Text;
                    bcontcust.MailingZipNo = txtCampContactMailingZip.Text;
                    bcontcust.MailingCountry = cmbCampContactMailingCountrty.Text;
                    bcontcust.OtherStreet = txtCampContactOtherAddress.Text;
                    bcontcust.OtherCity = cmbCampContactOtherCity.Text;
                    bcontcust.OtherState = cmbCampContactOtherState.Text;
                    bcontcust.OtherZipNo = txtCampContactOtherZip.Text;
                    bcontcust.OtherCountry = cmbCampContactOtherCountrty.Text;
                    bcontcust.Description = txtCampContactDescription.Text;
                    bcontcust.CustomerSystemPhotoPath = txtCampContactSystemPhotoPath.Text;
                    bcontcust.CustomerActualPhotoPath = txtCampContactActualPhotoPath.Text;
                    bcontcust.S_Status = "Active";
                    bcontcust.C_Date = System.DateTime.Now.ToString();
                    dcontcust.UpdateContactCustomer_Save_Insert_Update_Delete(bcontcust);
                    //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                    frmValidationMessage obj = new frmValidationMessage();
                    obj.lblMessage.Content = "Data Updated Successfully";
                    obj.ShowDialog();
                    //clearfunctionforfollowup();
                    //GetMax_FollowUpID();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }

            //FollowUp_FillData();
            //Load_Followup_City();
            //Load_Followup_Country();
            //Load_Followup_State();
            //Load_Followup_Occupation();
            //Load_Followup_Employee();
            //Folloupiid();
        }
        public bool CampContact_Validation()
        {
            bool result = false;
            if (cmbCampContactEmployeeName.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Employee Name";
                cmbCampContactEmployeeName.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (txtCampContactFirstName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer First Name";
                txtCampContactFirstName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (txtCampContactLastName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer Last Name";
                txtCampContactLastName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (dtpCampContactDOB.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Customer Date of Birth";
                dtpCampContactDOB.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (cmbCampContactSourceofEnq.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Source of Enquiry";
                cmbCampContactSourceofEnq.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbCampContactOccupation.Text == "-None-")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Occupation";
                cmbCampContactOccupation.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (txtCampContactMobile.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer Mobile No.";
                txtCampContactMobile.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            return result;
        }
        private void btnContactNotes_Save_Click(object sender, RoutedEventArgs e)
        {
            if (ContactNots_Validation() == true)
                return;

            try
            {
                bcontcust.Flag = 1;
                bcontcust.ContactCustomerID = Convert.ToInt32(txtCContactID.Text);
                bcontcust.ContactNotes = txtContactNotes.Text;
                bcontcust.S_Status = "Active";
                bcontcust.C_Date = System.DateTime.Now.ToString();
                dcontcust.ContactCustomerNotes_Save_Insert_Update_Delete(bcontcust);
                //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                //clearfunctionforfollowup();
                //GetMax_FollowUpID();
            }
            catch
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            ViewAllContactNots_Details();
        }
 public bool ContactCustPhoto_Validation()
 {
     bool result = false;
     if (txtCContactPhotoPath.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content= "Please Select Photo";
         obj.ShowDialog();
     }
     return result;
 }
        private void btnCContactPhoto_Save_Click(object sender, RoutedEventArgs e)
        {
            if(ContactCustPhoto_Validation() == true)
                return;

            string imagepath = filepath.ToString();
            string picname = imagepath.Substring(imagepath.LastIndexOf('\\'));

            string path = AppDomain.CurrentDomain.BaseDirectory + '\\';
            if (!(System.IO.Directory.Exists(path)))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            string path1 = path + "\\images\\ContactCustomer Img\\" + picname + ".JPG";
            ///
            using (System.IO.FileStream filestream = new System.IO.FileStream(Convert.ToString(path1), System.IO.FileMode.Create))
            {
                JpegBitmapEncoder encoder = new JpegBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create(bmp));
                encoder.QualityLevel = 100;
                encoder.Save(filestream);
            }
            //MessageBox.Show("Image Successfully Saved :" + path + "'\'Image'\'" + picname);

            try
            {
                bcontcust.Flag = 1;
                bcontcust.ID = Convert.ToInt32(txtCContactID.Text);
                bcontcust.CustomerSystemPhotoPath = txtCContactPhotoPath.Text;
                bcontcust.CustomerActualPhotoPath = path1;
                dcontcust.UpdateContactCustomerPhotoPath_Save_Insert_Update_Delete(bcontcust);
            }
            catch
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            frmValidationMessage obj = new frmValidationMessage();
            obj.lblMessage.Content = "Image Save Successfully";
            obj.ShowDialog();
        }
        private void btnFollowup_Save_Click(object sender, RoutedEventArgs e)
        {
            if (Followup_Validation() == true)
                return;

            try
            {
                balfollow.Flag = 1;
                balfollow.EmployeeID = cmbCEmployeename.SelectedValue.GetHashCode();
                balfollow.Followup_ID = lblwalkin.Content.ToString();
                balfollow.FTitle = cmbFollowpTitle.Text;
                balfollow.FiratName = txtAdm_FollowupFirstName.Text;
                balfollow.LastName = txtAdm_FollowupLastName.Text;
                balfollow.Date_Of_Birth = dp_Dob.Text;
                balfollow.Mobile_No = txtCMobile.Text;
                balfollow.PhoneNo = txtAdm_Followup_PhoneNo.Text;
                balfollow.SourceOfEnquiry = cmbCSourceofEnq.Text;
                soe = cmbCSourceofEnq.Text;
                if (soe == "Newspaper")
                {
                    vsoe = 1;
                }
                else if (soe == "Advertisement")
                {
                    vsoe = 2;
                }
                else if (soe == "Friends / Colleagues")
                {
                    vsoe = 3;

                }
                else if (soe == "External Referral")
                {
                    vsoe = 4;

                }
                else if (soe == "Online Store")
                {
                    vsoe = 5;
                }
                else if (soe == "Public Relation")
                {
                    vsoe = 6;
                }
                else if (soe == "Sales Mail Alias")
                {
                    vsoe = 7;
                }
                else if (soe == "Net / Website")
                {
                    vsoe = 8;
                }
                else if (soe == "Other")
                {
                    vsoe = 9;
                }
                balfollow.SourceOfEnquiryID = vsoe;
                balfollow.Occupation = cmbFollowup_Occupation.Text;
                balfollow.AnnualRevenue = Convert.ToDouble(txtFollowAnnualRevenue.Text);
                balfollow.Email_ID = txtCEmailid.Text;
                balfollow.FaxNo = txtFollowFaxNo.Text;
                balfollow.Wbsite = txtFollowWebsite.Text;
                balfollow.Street = txtCAddress.Text;
                balfollow.City = cmbFollowup_City.Text;
                balfollow.State = cmbEmp_State.Text;
                balfollow.ZipNo = txtFollowup_Zip.Text;
                balfollow.Country = cmbFollowup_Country.Text;
                balfollow.Description = txtFollowupDescription.Text;
                balfollow.F_Date = dp_Cdate.Text;
                balfollow.S_Status = "Active";
                balfollow.C_Date = System.DateTime.Now.ToString();
                dalfollow.Follwup_Save_Insert_Update_Delete(balfollow);
                //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                //clearfunctionforfollowup();
                GetMax_FollowUpID();
                try
                {
                    FollowupProduct_SaveDetails();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            FollowUp_FillData();
            //Load_Followup_City();
            //Load_Followup_Country();
            //Load_Followup_State();
            //Load_Followup_Occupation();
            //Load_Followup_Employee();
            //Folloupiid();
        }
        private void btnAdm_Dealer_Save_Click(object sender, RoutedEventArgs e)
        {
            if (Dealer_Validation() == true)
                return;

            try
            {
                bdealeretr.Flag = 1;
                bdealeretr.DealerEntryID = lblDealerID.Content.ToString();
                bdealeretr.CompanyName = txtAdm_CompanyName.Text;
                bdealeretr.DealerFirstName = txtAdm_DealerFirstName.Text;
                bdealeretr.DealerLastName = txtAdm_DealerLastName.Text;
                bdealeretr.DateOfBirth = dtpAdm_Dealer_DOB.Text;
                bdealeretr.MobileNo = txtAdm_Dealer_MobileNo.Text;
                bdealeretr.PhoneNo = txtAdm_Dealer_PhoneNo.Text;
                bdealeretr.DealerAddress = txtAdm_Dealer_Address.Text;
                bdealeretr.City = cmbDealer_City.Text;
                bdealeretr.Zip = txtAdm_Dealer_Zip.Text;
                bdealeretr.DState = cmbDealer_State.Text;
                bdealeretr.Country =cmbDealer_Country.Text;
                bdealeretr.S_Status = "Active";

                //string STRTODAYDATE = System.DateTime.Now.ToShortDateString();
                //string time = System.DateTime.Now.ToShortTimeString();
                //string[] STRVAL = STRTODAYDATE.Split('-');
                //string STR_DATE1 = STRVAL[0];
                //string STR_MONTH = STRVAL[1];
                //string STR_YEAR = STRVAL[2];
                //string DATE = STR_DATE1 + "-" + STR_MONTH + "-" + STR_YEAR;
                ////txtdate.Text = DATE;
                ////txttime.Text = time;

                //baddprd.C_Date =Convert .ToDateTime( DATE);
                bdealeretr.C_Date = System.DateTime.Now.ToShortDateString();
                ddealeretr.EmployeeEntry_Insert_Update_Delete(bdealeretr);
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                //MessageBox.Show("Data Save Successfully", caption, MessageBoxButton.OK, MessageBoxImage.Information);
                Dealer_ResetText();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            Dealerid();
            Load_Delaler_City();
            Load_Delaler_State();
            Load_Delaler_Country();
        }
        public bool Customer_Validation()
        {
            bool result = false;
            if (txtCustomerFirstName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer First Name";
                txtCustomerFirstName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (txtCustomerLastName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer Last Name";
                txtCustomerLastName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (dtpCustomer_DOB.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Customer Date of Birth";
                dtpCustomer_DOB.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (cmbCustomer_Occupation.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Customer Occupation";
                cmbCustomer_Occupation.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (txtCustomer_Mobile.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer Mobile No.";
                txtCustomer_Mobile.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (txtCustomer_Address.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Customer Address";
                txtCustomer_Address.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbCustomer_City.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select City";
                cmbCustomer_City.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbCustomer_State.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select State";
                cmbCustomer_State.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbCustomer_Country.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Country";
                cmbCustomer_Country.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbCustomer_SourceofEnq.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Source of Enquiry";
                cmbCustomer_SourceofEnq.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }

            return result;
        }
 public bool AddProducts_Validation()
 {
     bool result = false;
     if (cmbP_domain.SelectedItem == null)
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Domain Name";
         obj.ShowDialog();
         cmbP_domain.BorderBrush = Brushes.Red;
     }
     else if (cmbP_Product.SelectedItem == null)
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Product Name";
         obj.ShowDialog();
         cmbP_Product.BorderBrush = Brushes.Red;
     }
     else if (cmbP_Brand.SelectedItem == null)
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Brand Name";
         obj.ShowDialog();
         cmbP_Brand.BorderBrush = Brushes.Red;
     }
     else if (cmbP_PCategory.SelectedItem == null)
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Product Category";
         obj.ShowDialog();
         cmbP_PCategory.BorderBrush = Brushes.Red;
     }
     else if (cmbP_ModelNo.SelectedItem == null)
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Model No";
         obj.ShowDialog();
         cmbP_ModelNo.BorderBrush = Brushes.Red;
     }
     else if (cmbP_Color.SelectedItem == null)
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Color";
         obj.ShowDialog();
         cmbP_Color.BorderBrush = Brushes.Red;
     }
     else if (txtP_Price.Text == "")
     {
         result = true;
         lblColorErrorMsg.Foreground = Brushes.Red;
         lblColorErrorMsg.Visibility = System.Windows.Visibility.Visible;
         lblColorErrorMsg.Content = "Please Enter Product Price";
         txtP_Price.BorderBrush = Brushes.Red;
     }
     return result;
 }
 private bool FinalPro_Validation()
 {
     bool result = false;
     if (txtPrice1.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Price";
         obj.ShowDialog();
     }
     else if (txtQuantityF.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Quantity";
         obj.ShowDialog();
     }
     else if (dtpFinalDate.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Date";
         obj.ShowDialog();
     }
     return result;
 }
        private void btnSave_AddProduct_Click(object sender, RoutedEventArgs e)
        {
            if (AddProducts_Validation() == true)
                return;

            try
            {

                baddprd.Flag = 1;
                baddprd.Domain_ID = Convert.ToInt32(cmbP_domain.SelectedValue.GetHashCode());
                baddprd.Product_ID = Convert.ToInt32(cmbP_Product.SelectedValue.GetHashCode());
                baddprd.Brand_ID = Convert.ToInt32(cmbP_Brand.SelectedValue.GetHashCode());
                baddprd.P_Category = Convert.ToInt32(cmbP_PCategory.SelectedValue.GetHashCode());
                baddprd.Model_No_ID = Convert.ToInt32(cmbP_ModelNo.SelectedValue.GetHashCode());
                baddprd.Color_ID = Convert.ToInt32(cmbP_Color.SelectedValue.GetHashCode());
                baddprd.Narration = txtP_Narration.Text;
                baddprd.Price = Convert.ToDouble(txtP_Price.Text);
                baddprd.S_Status = "Active";
                baddprd.C_Date = System.DateTime.Now.ToShortDateString();
                daddprd.Save_Insert_Update_Delete(baddprd);
                //MessageBox.Show("Data Save Successfully");
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                txtP_Narration.Text = "";
                txtP_Price.Text = "";
                clearAllADDProducts();
                // Load_Domain();

            }
            catch (Exception)
            {

                throw;
            }
        }
        private void btnAdm_Emp_Save_Click(object sender, RoutedEventArgs e)
        {
            if (Employee_Validation() == true)
                return;

            try
            {
                bempetr.Flag = 1;
                bempetr.EmployeeID = lblEmployeeID.Content.ToString();
                bempetr.EmployeeFirstName = txtAdm_EmpFirstName.Text;
                bempetr.EmployeeLastName = txtAdm_EmpLastName.Text;
                bempetr.DateOfBirth = dtpAdm_Emp_DOB.Text;
                bempetr.MobileNo = txtAdm_Emp_MobileNo.Text;
                bempetr.PhoneNo = txtAdm_Emp_PhoneNo.Text;
                bempetr.EmpAddress = txtAdm_Emp_Address.Text;
                bempetr.EmpCity = cmbEmp_City.Text;
                bempetr.EmpZipNo = txtAdm_Emp_Zip.Text;
                bempetr.EmpState = cmbEmp_State.Text;
                bempetr.EmpCountry = cmbEmp_Country.Text;
                bempetr.Designation = txtAdm_Emp_Designation.Text;
                bempetr.DateOfJoining = dtpAdm_Emp_DOJ.Text;
                bempetr.NoOfYears = cmbAdm_Emp_YearExp.SelectedItem.ToString();
                bempetr.Years = lblYears.Content.ToString();
                bempetr.NoOfMonths = cmbAdm_Emp_Months.SelectedItem.ToString();
                bempetr.Months = lblMonths.Content.ToString();
                bempetr.Salary = Convert.ToDouble(txtAdm_Emp_Salary.Text);
                bempetr.S_Status = "Active";
                bempetr.C_Date = System.DateTime.Now.ToShortDateString();
                dempetr.EmployeeEntry_Insert_Update_Delete(bempetr);

                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }

            if(txtEmp_PhotoPath.Text.Trim() != string.Empty)
            {
                if(txtEmployeeID.Text.Trim() == string.Empty)
                {
                    GetMaxID();
                }
                try
                {
                    bemphpoto.Flag = 1;
                    bemphpoto.EmployeeID = Convert.ToInt32(txtEmployeeID.Text);
                    bemphpoto.PhotoPath = txtEmp_PhotoPath.Text;
                    bemphpoto.EmpPhoto = (byte[])(picture);
                    bemphpoto.S_Status = "Active";
                    bemphpoto.C_Date = System.DateTime.Now.ToShortDateString();
                    dempphoto.EmployeePhoto_Insert_Update_Delete(bemphpoto);

                    //frmValidationMessage obj = new frmValidationMessage();
                    //obj.lblMessage.Content = "Photo Save Successfully";
                    //obj.ShowDialog();
                }
                catch 
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }
            }

            Employee_ResetText();
            EEMPLOYEEid();
            Load_Employee_City();
            Load_Employee_State();
            Load_Employee_Country();
        }
 public bool Dealer_Validation()
 {
     bool result = false;
     if (txtAdm_DealerFirstName.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Dealer First Name";
         obj.ShowDialog();
         //MessageBox.Show("Please Enter Dealer First Name", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (txtAdm_DealerLastName.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Dealer Last Name";
         obj.ShowDialog();
         //MessageBox.Show("Please Enter Dealer Last Name", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (dtpAdm_Dealer_DOB.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Dealer Date Of Birth";
         obj.ShowDialog();
         //MessageBox.Show("Please Select Dealer Date Of Birth", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (txtAdm_CompanyName.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Company Name";
         obj.ShowDialog();
         //MessageBox.Show("Please Enter Company Name", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (txtAdm_Dealer_MobileNo.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Dealer Mobile No.";
         obj.ShowDialog();
         //MessageBox.Show("Please Enter Dealer Mobile No", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (txtAdm_Dealer_PhoneNo.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Dealer Phone  No.";
         obj.ShowDialog();
         //MessageBox.Show("Please Enter Dealer Phone No", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (txtAdm_Dealer_Address.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Dealer Address";
         obj.ShowDialog();
         //MessageBox.Show("Please Enter Dealer Address", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (cmbDealer_City.Text == "Select")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select City";
         obj.ShowDialog();
        // MessageBox.Show("Please Select City", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (cmbDealer_State.Text == "Select")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select State";
         obj.ShowDialog();
         //MessageBox.Show("Please Select State", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (cmbDealer_Country.Text == "Select")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Country";
         obj.ShowDialog();
         //MessageBox.Show("Please Select Country", caption, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     return result;
 }
 public bool Employee_Validation()
 {
     bool result = false;
     if (txtAdm_EmpFirstName.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee First Name";
         obj.ShowDialog();
         txtAdm_EmpFirstName.BorderBrush = Brushes.Red;
         
     }
     else if (txtAdm_EmpLastName.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Last Name";
         obj.ShowDialog();
         txtAdm_EmpLastName.BorderBrush = Brushes.Red;
         
     }
     else if (dtpAdm_Emp_DOB.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Date Of Birth";
         obj.ShowDialog();
         dtpAdm_Emp_DOB.BorderBrush = Brushes.Red;
         
     }
     else if (txtAdm_Emp_MobileNo.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Mobile No.";
         obj.ShowDialog();
         txtAdm_Emp_MobileNo.BorderBrush = Brushes.Red;
         
     }
     else if (txtAdm_Emp_Address.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Address";
         obj.ShowDialog();
         txtAdm_Emp_Address.BorderBrush = Brushes.Red;
         
     }
     else if (cmbEmp_City.Text == "Select")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Employee City";
         obj.ShowDialog();
         cmbEmp_City.BorderBrush = Brushes.Red;
         
     }
     else if (cmbEmp_State.Text == "Select")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Employee State";
         obj.ShowDialog();
         cmbEmp_State.BorderBrush = Brushes.Red;
         cmbEmp_State.Focus();
     }
     else if (cmbEmp_Country.Text == "Select")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Employee Country";
         obj.ShowDialog();
         cmbEmp_Country.BorderBrush = Brushes.Red;
         
     }
     else if (txtAdm_Emp_Designation.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Designation";
         obj.ShowDialog();
         txtAdm_Emp_Designation.BorderBrush = Brushes.Red;
         
     }
     else if (dtpAdm_Emp_DOJ.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Joining Date";
         obj.ShowDialog();
         dtpAdm_Emp_DOJ.BorderBrush = Brushes.Red;
         
     }
     else if (cmbAdm_Emp_YearExp.Text == "Select Year")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Employee Experience Year";
         obj.ShowDialog();
         cmbAdm_Emp_YearExp.BorderBrush = Brushes.Red;
         
         //MessageBox.Show("Please Select Employee Experience Year", caption, MessageBoxButton.OK);
     }
     else if (cmbAdm_Emp_Months.Text == "Select Months")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Select Employee Experience Month";
         obj.ShowDialog();
         cmbAdm_Emp_Months.BorderBrush = Brushes.Red;
         
     }
     else if (txtAdm_Emp_Salary.Text == "")
     {
         result = true;
         frmValidationMessage obj = new frmValidationMessage();
         obj.lblMessage.Content = "Please Enter Employee Salary";
         obj.ShowDialog();
         txtAdm_Emp_Salary.BorderBrush = Brushes.Red;
         
     }
     return result;
 }
        public bool PrePro_Validation()
        {
            bool result = false;
            if (cmbPre_Pro_Salename.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Dealer Name";
                cmbPre_Pro_Salename.BorderBrush = Brushes.Red;
                obj.ShowDialog();
                
            }
            else if (cmbPreDomain.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Domain Name";
                cmbPreDomain.BorderBrush = Brushes.Red;
                obj.ShowDialog();
                
            }
            else if (txtDealer_CompanyName.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Domain Name";
                txtDealer_CompanyName.BorderBrush = Brushes.Red;
                obj.ShowDialog();

            }
            else if (cmbPreProduct.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Product Name";
                cmbPreProduct.BorderBrush = Brushes.Red;
                obj.ShowDialog();                
            }
            else if (cmbPreBrand.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Brand";
                cmbPreBrand.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbPrePCategory.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Product Category";
                cmbPrePCategory.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbPreModel.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Model No";
                cmbPreModel.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmd_PreColor.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Color";
                cmd_PreColor.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (txtPrice.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Price";
                txtPrice.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (txtQuantity.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Quantity";
                txtQuantity.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbPreInsurance.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Insurance";
                cmbPreInsurance.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (txtPreWarranty.Text == "")
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Enter Product Warranty";
                txtPreWarranty.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            else if (cmbPreFollowup.SelectedItem == null)
            {
                result = true;
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Please Select Follow-Up";
                cmbPreFollowup.BorderBrush = Brushes.Red;
                obj.ShowDialog();
            }
            
            return result;
        }
        private void btnCamp_Save_Click(object sender, RoutedEventArgs e)
        {
            if (Campaign_Validation() == true)
                return;

            try
            {
                bcrcamp.Flag = 1;
                bcrcamp.CampaignName = txtCampaginName.Text;
                bcrcamp.CampaignType = cmbCampaignType.Text;
                bcrcamp.StartDate = dp_CompStartDate.Text;
                bcrcamp.EndDate = dp_CompEndDate.Text;
                bcrcamp.ExpectedRevenue = Convert.ToDouble(txtCampExpectedRevenue.Text);
                bcrcamp.BudgetedCost = Convert.ToDouble(txtCampBudgetedCost.Text);
                bcrcamp.Status = cmbCampaignStatus.Text;
                bcrcamp.ExpectedResponse = txtCampExpectedResponse.Text;
                bcrcamp.Description = txtCampDescription.Text;
                bcrcamp.S_Status = "Active";
                bcrcamp.C_Date = System.DateTime.Now.ToString();
                dcrcamp.CreateCampaign_Insert_Update_Delete(bcrcamp);
                //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                frmValidationMessage obj = new frmValidationMessage();
                obj.lblMessage.Content = "Data Save Successfully";
                obj.ShowDialog();
                Camp_ResetText();
            }
            catch
            {
                throw;
            }
            finally
            {
                con.Close();
            }
        }
        private void btnCamp_Save_Click(object sender, RoutedEventArgs e)
        {
            if (Campaign_Validation() == true)
                return;

            if(btnCamp_Save.Content.ToString() == "Save")
            {
                try
                {
                    bcrcamp.Flag = 1;
                    bcrcamp.CampaignName = txtCampaginName.Text;
                    bcrcamp.CampaignType = cmbCampaignType.Text;
                    bcrcamp.StartDate = dp_CompStartDate.Text;
                    bcrcamp.EndDate = dp_CompEndDate.Text;
                    bcrcamp.ExpectedRevenue = Convert.ToDouble(txtCampExpectedRevenue.Text);
                    bcrcamp.BudgetedCost = Convert.ToDouble(txtCampBudgetedCost.Text);
                    bcrcamp.Status = cmbCampaignStatus.Text;
                    bcrcamp.ExpectedResponse = txtCampExpectedResponse.Text;
                    bcrcamp.Description = txtCampDescription.Text;
                    bcrcamp.S_Status = "Active";
                    bcrcamp.C_Date = System.DateTime.Now.ToString();
                    dcrcamp.CreateCampaign_Insert_Update_Delete(bcrcamp);
                    //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                    frmValidationMessage obj = new frmValidationMessage();
                    obj.lblMessage.Content = "Data Save Successfully";
                    obj.ShowDialog();
                    //Camp_ResetText();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }

                GetMax_CampaignsID();
                grd_View_Campaigns.Visibility = System.Windows.Visibility.Visible;
                Campaigns_FillData();
            }
            else if(btnCamp_Save.Content.ToString() == "Update")
            {
                try
                {
                    bcrcamp.Flag = 2;
                    bcrcamp.ID = Convert.ToInt32(txtCampaignID.Text);
                    bcrcamp.CampaignName = txtCampaginName.Text;
                    bcrcamp.CampaignType = cmbCampaignType.Text;
                    bcrcamp.StartDate = dp_CompStartDate.Text;
                    bcrcamp.EndDate = dp_CompEndDate.Text;
                    bcrcamp.ExpectedRevenue = Convert.ToDouble(txtCampExpectedRevenue.Text);
                    bcrcamp.BudgetedCost = Convert.ToDouble(txtCampBudgetedCost.Text);
                    bcrcamp.Status = cmbCampaignStatus.Text;
                    bcrcamp.ExpectedResponse = txtCampExpectedResponse.Text;
                    bcrcamp.Description = txtCampDescription.Text;
                    bcrcamp.S_Status = "Active";
                    bcrcamp.C_Date = System.DateTime.Now.ToString();
                    dcrcamp.UpdateCreateCampaign_Insert_Update_Delete(bcrcamp);
                    //MessageBox.Show("Customer Added sucsessfully ", caption, MessageBoxButton.OK);
                    frmValidationMessage obj = new frmValidationMessage();
                    obj.lblMessage.Content = "Updated Data Save Successfully";
                    obj.ShowDialog();
                    //Camp_ResetText();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    con.Close();
                }

                //GetMax_CampaignsID();
                grd_View_Campaigns.Visibility = System.Windows.Visibility.Visible;
                Campaigns_FillData();
                ViewAllCampaignNots_Details();
                LeadCampaign_Details();
                //Campaign_Leads_Details();
            }
            
        }