예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtCustomerName.Text.Length == 0)
            {
                MessageBox.Show("Kindly enter customer name.");
                txtCustomerName.Focus();
                return;
            }
            if (cmbState.Text.Length == 0)
            {
                MessageBox.Show("Kindly select state.");
                cmbState.Focus();
                return;
            }
            if (mPkValue == 0)
            {
                CustomerMst objcust = new CustomerMst();

                objcust.CustomerName = txtCustomerName.Text;
                objcust.Address      = txtAddress.Text;
                objcust.State        = cmbState.Text;
                objcust.StateCode    = txtStatecode.Text;
                objcust.EmailId      = txtEmailid.Text;
                objcust.ContactNo    = txtContactNo.Text;
                objcust.TaxNo        = txtGSTinNo.Text;
                objcust.PANNo        = txtPanNo.Text;


                dbx.CustomerMsts.Add(objcust);
                dbx.SaveChanges();

                MessageBox.Show("Customer detail saved..");
            }
            else
            {
                var objcmp = dbx.CustomerMsts.Where(u => u.CustomerId == mPkValue).First();
                if (objcmp != null)
                {
                    objcmp.CustomerName = txtCustomerName.Text;
                    objcmp.Address      = txtAddress.Text;
                    objcmp.State        = cmbState.Text;
                    objcmp.StateCode    = txtStatecode.Text;
                    objcmp.EmailId      = txtEmailid.Text;
                    objcmp.ContactNo    = txtContactNo.Text;
                    objcmp.TaxNo        = txtGSTinNo.Text;
                    objcmp.PANNo        = txtPanNo.Text;

                    dbx.SaveChanges();

                    MessageBox.Show("Customer detail updated..");
                }
            }
            ClearControls();
        }
예제 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtOldPwd.Text.Length == 0)
                {
                    MessageBox.Show("Enter Old Password.");
                    txtOldPwd.Focus();
                    return;
                }
                if (txtNewPwd.Text.Length == 0)
                {
                    MessageBox.Show("Enter new Password.");
                    txtNewPwd.Focus();
                    return;
                }


                UserMst lqry = dbx.UserMsts.Where(u => u.UserId == AppInit.UserInfo.UserId && u.Password == txtOldPwd.Text).FirstOrDefault();
                if (lqry == null)
                {
                    MessageBox.Show("Old password dose not match.");
                    txtOldPwd.Focus();
                    return;
                }
                lqry.Password = txtNewPwd.Text;
                dbx.SaveChanges();
                this.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTaxName.Text.Length == 0)
            {
                MessageBox.Show("Kindly enter tax name.");
                txtTaxName.Focus();
                return;
            }

            if (mPkValue == 0)
            {
                TaxMst objtxm = new TaxMst();

                objtxm.TaxName = txtTaxName.Text;
                //objtxm.IGST = Convert.ToDecimal(Convert.ToDouble(txtIGST.Text));
                //objtxm.CGST = Convert.ToDecimal(Convert.ToDouble(txtCGST.Text));
                //objtxm.SGST = Convert.ToDecimal(Convert.ToDouble(txtSGST.Text));
                objtxm.IGST = AppFun.ToDecimal(txtIGST.Text);
                objtxm.CGST = AppFun.ToDecimal(txtCGST.Text);
                objtxm.SGST = AppFun.ToDecimal(txtSGST.Text);

                dbx.TaxMsts.Add(objtxm);
                dbx.SaveChanges();

                MessageBox.Show("Tax detail saved..");
            }
            else
            {
                var objtxm = dbx.TaxMsts.Where(u => u.TaxId == mPkValue).First();
                if (objtxm != null)
                {
                    objtxm.TaxName = txtTaxName.Text;
                    objtxm.IGST    = AppFun.ToDecimal(txtIGST.Text);
                    objtxm.CGST    = AppFun.ToDecimal(txtCGST.Text);
                    objtxm.SGST    = AppFun.ToDecimal(txtSGST.Text);

                    dbx.SaveChanges();
                    MessageBox.Show("Item detail updated..");
                }
            }
            ClearControls();
        }
예제 #4
0
        private void btnList_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Are your sure want to delete ?", "Delete", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    int lpkvalue = Convert.ToInt32(xListDetail.GetFocusedRowCellValue("CustomerId"));
                    var lqryd    = dbx.CustomerMsts.Where(u => u.CustomerId == lpkvalue).FirstOrDefault();

                    dbx.CustomerMsts.Remove(lqryd);

                    dbx.SaveChanges();
                    FillGrid();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_invoiceTaxonTotalLevel.ToString(), chkInvoiceTaxOnTotalLevel.Checked ? "1" : "0");
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_invoiceItemHelp.ToString(), chkItemHelp.Checked ? "1" : "0");
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_EnableShippingDetail.ToString(), chkShippingDetails.Checked ? "1" : "0");
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_EnablePrintChallan.ToString(), chkPrintChallanEnable.Checked ? "1" : "0");

            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_Enable_bf_freight.ToString(), chk_bf_freight.Checked ? "1" : "0");
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_Enable_bf_additional.ToString(), chk_bf_additional.Checked ? "1" : "0");
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_Enable_bf_discount.ToString(), chk_bf_discount.Checked ? "1" : "0");



            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_invoiceformate.ToString(), txtInvoiceFormat.Text);
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_challanformat.ToString(), txtChallanFormat.Text);
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_DefaultCopyTag.ToString(), cmbCopy.Text);
            AppInit.UpdateSoftwareSetting(AppInit.SoftwareSettings.SoftwareSettingCode.Inv_EnableOth1Add.ToString(), chlOtherAddField.Checked ? "1" : "0");
            AppInit.SoftwareSettings.IntiSetting();

            for (int i = 0; i < gvBook.Rows.Count; i++)
            {
                int lbookid = Convert.ToInt32(gvBook.Rows[i].Cells["BookId"].Value);
                var objitm  = dbx.BookMsts.Where(u => u.BookId == lbookid).First();
                if (objitm != null)
                {
                    objitm.BookTitle = gvBook.Rows[i].Cells["BookTitle"].Value.ToString();
                    objitm.InvNo     = Convert.ToInt32(gvBook.Rows[i].Cells["InvNo"].Value);
                    objitm.IsActive  = Convert.ToBoolean(gvBook.Rows[i].Cells["IsActive"].Value);
                    objitm.IsDefault = Convert.ToBoolean(gvBook.Rows[i].Cells["IsDefault"].Value);
                    objitm.Prefix    = Convert.ToString(gvBook.Rows[i].Cells["Prefix"].Value);
                    dbx.SaveChanges();
                }
            }

            MessageBox.Show("Software Setting updated..");
        }
예제 #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtItemName.Text.Length == 0)
            {
                MessageBox.Show("Kindly enter item name.");
                txtItemName.Focus();
                return;
            }
            if (cmbTax.Text.Length == 0)
            {
                MessageBox.Show("Kindly select tax.");
                cmbTax.Focus();
                return;
            }

            cmbTax.Tag = dbx.TaxMsts.Where(u => u.TaxName == cmbTax.Text.Trim()).Select(s => s.TaxId).FirstOrDefault();

            if (mPkValue == 0)
            {
                ItemMst objitm = new ItemMst();

                objitm.ItemName      = txtItemName.Text;
                objitm.ItemCode      = txtItemCode.Text;
                objitm.Unit          = cmbUnit.Text;
                objitm.ItemDesc      = txtItemDesc.Text;
                objitm.TaxId         = Convert.ToInt32(cmbTax.Tag);
                objitm.IGSTPer       = AppFun.ToDecimal(txtIGST.Text);
                objitm.CGSTPer       = AppFun.ToDecimal(txtCGST.Text);
                objitm.SGSTPer       = AppFun.ToDecimal(txtSGST.Text);
                objitm.PurchasePrice = AppFun.ToDecimal(txtPurchasePrice.Text);
                objitm.SalePrice     = AppFun.ToDecimal(txtSalePrice.Text);
                objitm.HSNCode       = txtHSNCode.Text;

                dbx.ItemMsts.Add(objitm);
                dbx.SaveChanges();

                MessageBox.Show("Item detail saved..");
            }
            else
            {
                var objitm = dbx.ItemMsts.Where(u => u.ItemId == mPkValue).First();
                if (objitm != null)
                {
                    objitm.ItemName      = txtItemName.Text;
                    objitm.ItemCode      = txtItemCode.Text;
                    objitm.Unit          = cmbUnit.Text;
                    objitm.ItemDesc      = txtItemDesc.Text;
                    objitm.TaxId         = Convert.ToInt32(cmbTax.Tag);
                    objitm.IGSTPer       = Convert.ToDecimal(txtIGST.Text);
                    objitm.CGSTPer       = Convert.ToDecimal(txtCGST.Text);
                    objitm.SGSTPer       = Convert.ToDecimal(txtSGST.Text);
                    objitm.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
                    objitm.SalePrice     = Convert.ToDecimal(txtSalePrice.Text);
                    objitm.HSNCode       = txtHSNCode.Text;

                    dbx.SaveChanges();
                    MessageBox.Show("Item detail updated..");
                }
            }

            var lqryu = dbx.UnitMsts.Where(u => u.UnitName == cmbUnit.Text.Trim());

            if (lqryu.Count() == 0)
            {
                UnitMst objumt = new UnitMst();
                objumt.UnitName = cmbUnit.Text;
                dbx.UnitMsts.Add(objumt);
                dbx.SaveChanges();
                HelperClass.bCombBox_Unit(cmbUnit);
            }
            ClearControls();
        }
예제 #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtComapanyName.Text.Length == 0)
            {
                MessageBox.Show("Kindly enter company name.");
                txtComapanyName.Focus();
                return;
            }
            if (cmbState.Text.Length == 0)
            {
                MessageBox.Show("Kindly select state.");
                cmbState.Focus();
                return;
            }
            if (CreateNewCompanyConfiguration() == false)
            {
                return;
            }
            if (mPkValue == 0)
            {
                CompanyMst objcmp = new CompanyMst();
                objcmp.CompanyName = txtComapanyName.Text;
                objcmp.Address     = txtAddress.Text;
                objcmp.State       = cmbState.Text;
                objcmp.StateCode   = txtStatecode.Text;
                objcmp.EmailId     = txtEmailid.Text;
                objcmp.ContactNo   = txtContactNo.Text;
                objcmp.TaxNo       = txtGSTinNo.Text;
                objcmp.PANNo       = txtPanNo.Text;
                objcmp.LogoImg     = imageToByteArray(pBox_Logo.Image);

                dbx.CompanyMsts.Add(objcmp);
                dbx.SaveChanges();

                if (isCompanyModeNew)
                {
                    MessageBox.Show("New Company Created\n You need to restart a software..");
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("Company detail saved..");
                }
            }
            else
            {
                var objcmp = dbx.CompanyMsts.Where(u => u.CompId == mPkValue).First();
                if (objcmp != null)
                {
                    objcmp.CompanyName = txtComapanyName.Text;
                    objcmp.Address     = txtAddress.Text;
                    objcmp.State       = cmbState.Text;
                    objcmp.StateCode   = txtStatecode.Text;
                    objcmp.EmailId     = txtEmailid.Text;
                    objcmp.ContactNo   = txtContactNo.Text;
                    objcmp.TaxNo       = txtGSTinNo.Text;
                    objcmp.PANNo       = txtPanNo.Text;
                    objcmp.LogoImg     = imageToByteArray(pBox_Logo.Image);
                    dbx.SaveChanges();

                    DataSet ldtst = new DataSet();
                    ldtst.ReadXml(Application.StartupPath + @"\Conn.xml");
                    foreach (DataRow dr in ldtst.Tables[0].Select("dbname =" + AppInit.CompanyInfo.DbName))
                    {
                        dr["compname"] = txtComapanyName.Text;
                    }
                    ldtst.WriteXml(Application.StartupPath + @"\Conn.xml");
                    MessageBox.Show("Company detail updated..");
                }
            }
        }