示例#1
0
        private void GenerateInvoiceNumber()
        {
            //SequenceInvoice : this is a sequance object created in SQL ( this is not a table)
            int    LastID        = ObjDAL.ExecuteScalarInt("SELECT NEXT VALUE FOR " + clsUtility.DBName + ".[dbo].SequenceInvoice");
            string InvoiceNumber = "INV-" + LastID;

            txtInvoiceNumber.Text = InvoiceNumber;
        }
示例#2
0
        private bool ValidateRights()
        {
            if (ObjUtil.IsControlTextEmpty(txtUserID))
            {
                clsUtility.ShowInfoMessage("Enter Valid User Name.", clsUtility.strProjectTitle);
                txtName.Focus();
                return(false);
            }

            if (!AnyRightCheck())
            {
                clsUtility.ShowInfoMessage("Please select any rights from rights grid.", clsUtility.strProjectTitle);
                grpRights.Focus();
                return(false);
            }

            int count = ObjCon.ExecuteScalarInt("SELECT COUNT(1) FROM " + clsUtility.DBName + ".[dbo].[tblUserRights] WITH(NOLOCK) WHERE UserID=" + txtUserID.Text);

            if (count > 0)
            {
                clsUtility.ShowInfoMessage("Rights for the user : "******" already exists. Please select new user or select existing user and update.", clsUtility.strProjectTitle);
                txtName.Focus();
                return(false);
            }
            return(true);
        }
示例#3
0
        private string GetBarcodeNumber()
        {
            //SequenceInvoice : this is a sequance object created in SQL ( this is not a table)
            int LastID = ObjCon.ExecuteScalarInt("SELECT NEXT VALUE FOR " + clsUtility.DBName + ".[dbo].Barcode_Sequance");

            return(LastID.ToString());
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (txtMobileNumber.Text.Trim().Length == 0)
            {
                clsUtility.ShowInfoMessage("Please enter mobile number.");
                return;
            }
            string strQ1 = "select CustomerID from CustomerMaster where PhoneNo='" + txtMobileNumber.Text + "'";

            int CustID = ObjCon.ExecuteScalarInt(strQ1);

            if (CustID == 0)
            {
                clsUtility.ShowInfoMessage("Can not find the given mobile number in the system.");
                return;
            }
            else
            {
                DataTable dataTable = ObjCon.ExecuteSelectStatement("select InvoiceNumber, InvoiceDate from SalesInvoiceDetails where CustomerID=" + CustID + " order by Id desc");
                if (dataTable.Rows.Count > 0)
                {
                    cmbInvoice.DataSource    = dataTable;
                    cmbInvoice.DisplayMember = "InvoiceNumber";
                    cmbInvoice.ValueMember   = "InvoiceDate";

                    cmbInvoice.SelectedIndex = -1;
                }

                pnlSelectInvoice.Visible = true;
            }
        }
示例#5
0
        private string GenerateReceiveBillNumber()
        {
            //SequenceInvoice : this is a sequance object created in SQL ( this is not a table)
            int    LastID        = ObjDAL.ExecuteScalarInt("SELECT NEXT VALUE FOR " + clsUtility.DBName + ".[dbo].Seq_StoreTransferReceiveBill");
            string InvoiceNumber = "RECEBILL-" + LastID;

            return(InvoiceNumber);
        }
 private void dgvQtycolor_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int pTotalEnteredQTY = 0;
         if (e.ColumnIndex == 0 && dgvQtycolor.Rows[e.RowIndex].Cells["Color"].Value.ToString() != string.Empty)
         {
             int a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.ColorMaster", "ColorName = '" + dgvQtycolor.Rows[e.RowIndex].Cells["Color"].Value + "' AND ISNULL(ActiveStatus,1) = 1");
             if (a <= 0)
             {
                 flag = 1;
                 clsUtility.ShowInfoMessage("Color Name " + dgvQtycolor.Rows[e.RowIndex].Cells["Color"].Value + " is not present in Color Master", clsUtility.strProjectTitle);
                 //dgvQtycolor.Rows[e.RowIndex].Cells["Color"].Value = OldColorName;
             }
             else
             {
                 int ColorID = ObjDAL.ExecuteScalarInt("SELECT ColorID FROM " + clsUtility.DBName + ".dbo.ColorMaster WITH(NOLOCK) WHERE ColorName = '" + dgvQtycolor.Rows[e.RowIndex].Cells["Color"].Value + "' AND ISNULL(ActiveStatus,1) = 1");
                 dtPurchaseQTYColor.Rows[e.RowIndex]["ColorID"] = ColorID;
                 flag = 0;
             }
         }
         else
         {
             for (int i = 3; i < dtPurchaseQTYColor.Columns.Count - 1; i++)
             {
                 pTotalEnteredQTY += dtPurchaseQTYColor.Rows[e.RowIndex][i] != DBNull.Value ?
                                     Convert.ToInt32(dtPurchaseQTYColor.Rows[e.RowIndex][i]) : 0;
             }
             dgvQtycolor.Rows[e.RowIndex].Cells["Total"].Value = pTotalEnteredQTY;
             txtTotalQTYEntered.Text = pTotalEnteredQTY.ToString();
             CalcTotalColorQTY();
             if (Convert.ToInt32(txtTotalQTYEntered.Text) > Convert.ToInt32(txtTotalQTYBill.Text))
             {
                 clsUtility.ShowInfoMessage("Entered QTY can't be greater then QTY Bill", clsUtility.strProjectTitle);
                 //dgvQtycolor.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = OldSize;
             }
             if (e.RowIndex + 1 == dgvQtycolor.Rows.Count)
             {
                 DataRow Row = dtPurchaseQTYColor.NewRow();
                 dtPurchaseQTYColor.Rows.Add(Row);
                 dtPurchaseQTYColor.AcceptChanges();
                 dgvQtycolor.DataSource = dtPurchaseQTYColor;
             }
         }
     }
     catch (InvalidOperationException)
     {
     }
     catch (IndexOutOfRangeException)
     {
     }
     catch (Exception ex)
     {
         clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle);
     }
 }
        private void cmbStoreName_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbStoreName.SelectedIndex != -1)
            {
                int    stroreID = cmbStoreName.SelectedValue == DBNull.Value ? 0 : Convert.ToInt32(cmbStoreName.SelectedValue);
                string str      = "SELECT StoreCategory FROM " + clsUtility.DBName + ".dbo.StoreMaster WITH(NOLOCK) WHERE StoreID=" + stroreID;

                int _stID = ObjDAL.ExecuteScalarInt(str);
                cmbStoreCategory.SelectedIndex = _stID;
            }
        }
示例#8
0
        private void cmbSupplier_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbSupplier.SelectedIndex >= 0)
            {
                object ob = ObjDAL.ExecuteScalarInt("SELECT CountryID FROM " + clsUtility.DBName + ".dbo.SupplierMaster WHERE SupplierID = " + cmbSupplier.SelectedValue);
                cmbCountry.SelectedValue = ob;
                cmbCountry_SelectionChangeCommitted(sender, e);

                grpCurrencyRate.Enabled    = true;
                grpForeignCurrency.Enabled = true;
                grpLocalCurrency.Enabled   = true;
            }
        }
        private bool IsArabicEnabled()
        {
            int count = ObjCon.ExecuteScalarInt("SELECT COUNT(1) FROM " + clsUtility.DBName + ".[dbo].[DefaultStoreSetting] WITH(NOLOCK) where ISNULL(UserArabicNumbers,0)=1 and MachineName='" + Environment.MachineName + "'");

            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtPCName.Text.Trim().Length == 0)
            {
                clsUtility.ShowInfoMessage("Please enter PC name.", clsUtility.strProjectTitle);
                txtPCName.Focus();
                return;
            }
            else if (cmbStoreCategory.SelectedIndex == -1)
            {
                clsUtility.ShowInfoMessage("Please Select Store Category.", clsUtility.strProjectTitle);
                cmbStoreCategory.Focus();
                return;
            }
            else if (cmbStoreName.SelectedIndex == -1)
            {
                clsUtility.ShowInfoMessage("Please Select Store Name.", clsUtility.strProjectTitle);
                cmbStoreName.Focus();
                return;
            }

            int result = ObjCon.ExecuteScalarInt("SELECT count(1) FROM " + clsUtility.DBName + ".[dbo].[DefaultStoreSetting] WITH(NOLOCK) WHERE MachineName='" + txtPCName.Text + "'");

            if (result > 0) // if data found for the PC thenupdate
            {
                ObjCon.UpdateColumnData("StoreID", SqlDbType.Int, cmbStoreName.SelectedValue);
                ObjCon.UpdateColumnData("MachineName", SqlDbType.NVarChar, txtPCName.Text);
                ObjCon.UpdateColumnData("StoreCategory", SqlDbType.Int, cmbStoreCategory.SelectedIndex);

                int r = ObjCon.UpdateData(clsUtility.DBName + ".[dbo].[DefaultStoreSetting]", "MachineName='" + txtPCName.Text + "'");
                if (r > 0)
                {
                    clsUtility.ShowInfoMessage("Default store settings has been updated.", clsUtility.strProjectTitle);
                }
            }
            else
            {
                // else insert.
                ObjCon.SetColumnData("StoreID", SqlDbType.Int, cmbStoreName.SelectedValue);
                ObjCon.SetColumnData("MachineName", SqlDbType.NVarChar, txtPCName.Text);
                ObjCon.SetColumnData("StoreCategory", SqlDbType.Int, cmbStoreCategory.SelectedIndex);

                int r = ObjCon.InsertData(clsUtility.DBName + ".[dbo].[DefaultStoreSetting]", false);
                if (r > 0)
                {
                    clsUtility.ShowInfoMessage("Default store settings has been saved.", clsUtility.strProjectTitle);
                }
                lblmsg.Visible = false;
            }
        }
示例#11
0
        private void cmbSupplier_SelectionChangeCommitted(object sender, EventArgs e)
        {
            int a = 0;

            if (cmbSupplier.SelectedIndex >= 0)
            {
                a = ObjDAL.ExecuteScalarInt("SELECT BrandID FROM " + clsUtility.DBName + ".[dbo].[BrandMaster] WITH(NOLOCK) WHERE SupplierID=" + cmbSupplier.SelectedValue);
            }
            if (a > 0)
            {
                cmbBrand.SelectedValue = a;
            }
            else
            {
                cmbBrand.SelectedIndex = -1;
            }
        }
示例#12
0
 private void cmbSupplier_SelectionChangeCommitted(object sender, EventArgs e)
 {
     try
     {
         int a = ObjDAL.ExecuteScalarInt("SELECT CountryID FROM " + clsUtility.DBName + ".[dbo].[SupplierMaster] WITH(NOLOCK) WHERE SupplierID=" + cmbSupplier.SelectedValue);
         if (a > 0)
         {
             cmbCountry.SelectedValue = a;
         }
         else
         {
             cmbCountry.SelectedIndex = -1;
         }
     }
     catch (Exception ex)
     {
         clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle);
     }
 }
示例#13
0
        private bool ValidateEmployee()
        {
            if (ObjUtil.IsControlTextEmpty(txtEmployeeCode))
            {
                clsUtility.ShowInfoMessage("Please Enter Employee Code.", clsUtility.strProjectTitle);
                txtEmployeeCode.Focus();
                return(false);
            }

            else if (ObjUtil.IsControlTextEmpty(txtName))
            {
                clsUtility.ShowInfoMessage("Please Enter Employee Name.", clsUtility.strProjectTitle);
                txtName.Focus();
                return(false);
            }

            else if (ObjUtil.IsControlTextEmpty(txtMobileNo))
            {
                clsUtility.ShowInfoMessage("Please Enter Employee Mobile No.", clsUtility.strProjectTitle);
                txtMobileNo.Focus();
                return(false);
            }

            else if (radFemale.Checked == false && radMale.Checked == false)
            {
                clsUtility.ShowInfoMessage("Please Select Gender.", clsUtility.strProjectTitle);
                radMale.Focus();
                radMale.Checked   = false;
                radFemale.Checked = false;


                return(false);
            }

            int result = ObjDAL.ExecuteScalarInt("SELECT COUNT(1) FROM " + clsUtility.DBName + ".dbo.EmployeeDetails WITH(NOLOCK) WHERE EmployeeCode='" + txtEmployeeCode.Text + "' AND EMPID<>" + EmployeeID);

            if (result > 0)
            {
                clsUtility.ShowInfoMessage("The Employee already exist with the given employee code. Please Enter different employee code.", clsUtility.strProjectTitle);
                txtEmployeeCode.Focus();
                return(false);
            }

            if (txtUsername.Text.Trim().Length > 0) // if user name is entered
            {
                if (ObjUtil.IsControlTextEmpty(txtPass))
                {
                    clsUtility.ShowInfoMessage("Please Enter Password.", clsUtility.strProjectTitle);
                    txtPass.Focus();
                    return(false);
                }

                int countuser = ObjDAL.ExecuteScalarInt("SELECT COUNT(1) FROM " + clsUtility.DBName + ".dbo.UserManagement WITH(NOLOCK) WHERE UserName='******' AND EmployeeID<>" + EmployeeID);
                if (countuser > 0)
                {
                    clsUtility.ShowInfoMessage("The user name already exist.Please enter different user name.", clsUtility.strProjectTitle);
                    txtUsername.Focus();
                    return(false);
                }
            }
            return(true);
        }