Example #1
0
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CountryMaster", "CountryName='" + txtCountryName.Text.Trim() + "'");
                if (a == 0)
                {
                    a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CountryMaster", "CountryCode='" + txtCountryCode.Text + "'");
                }
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CountryMaster", "CountryID !=" + i + " AND (CountryName ='" + txtCountryName.Text + "' OR CountryCode = '" + txtCountryCode.Text + "')");
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #2
0
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(DBName + ".dbo.UserManagement", "UserName='******'");
                if (a == 0)
                {
                    a = ObjDAL.CountRecords(DBName + ".dbo.UserManagement", "EmailID='" + txtEmail.Text + "'");
                }
            }
            else
            {
                a = ObjDAL.CountRecords(DBName + ".dbo.UserManagement", "UserID !=" + i + " AND (UserName = '******' OR EmailID = '" + txtEmail.Text + "')");
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
 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 bool IsDataExist()
        {
            //bool result = false;
            //int count = ObjDAL.ExecuteScalarInt("SELECT COUNT(1) FROM " + clsUtility.DBName + ".[dbo].[tblPC_Store_Mapping] WHERE  MachineName='" + cmbSelectPC.Text.ToString() + "' AND StoreID=" + cmbStoreName.SelectedValue.ToString() + " AND StoreID <>" + ID);

            int count = ObjDAL.CountRecords(clsUtility.DBName + ".[dbo].[tblPC_Store_Mapping]", "MachineName='" + cmbSelectPC.Text.ToString() + "' " +
                                            "AND PC_Store_ID <>" + ID);

            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        private void cboAuthenticationType_SelectionChangeCommitted(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            if (cboAuthenticationType.SelectedIndex == 0)
            {
                clsDMCommon.ObjCon.ConnectionString = "Server=" + clsDMCommon.strServerName + ";Database=" + ClientDBName + ";uid=" + clsDMCommon.strUserID
                                                      + ";pwd= " + clsDMCommon.strUserPassword + ";" + "Max Pool Size = 5004;Pooling=True";

                clsConnection_DAL ObjDAL = new clsConnection_DAL();
                ObjDAL.SetConnectionString(clsDMCommon.ObjCon.ConnectionString);
                if (ObjDAL.IsDatabaseExist(ClientDBName))
                {
                    if (!System.IO.Directory.Exists("AppConfig"))
                    {
                        System.IO.Directory.CreateDirectory("AppConfig");
                        File.WriteAllText("AppConfig\\ServerConfig.sc", ObjUtil.Encrypt(clsDMCommon.ObjCon.ConnectionString, true));
                    }
                    clsUtility.ShowInfoMessage("Database is already exist.\n please select client", clsUtility.strProjectTitle);
                    IsConnect = false;
                }
                else
                {
                    grpDBRestore.Enabled = true;
                    txtDabasePath.Focus();
                }
            }
            else if (cboAuthenticationType.SelectedIndex == 1)
            {
                grpDBRestore.Enabled = false;
                ConnectToDB(clsDMCommon.strServerName, clsDMCommon.strUserID, clsDMCommon.strUserPassword, ClientDBName);

                String conn = "Server=" + clsDMCommon.strServerName + ";Database=" + ClientDBName + ";uid=" + clsDMCommon.strUserID
                              + ";pwd= " + clsDMCommon.strUserPassword + ";" + "Max Pool Size = 5004;Pooling=True";
                String EncrConn = ObjUtil.Encrypt(conn, true);
                if (!System.IO.Directory.Exists("AppConfig"))
                {
                    System.IO.Directory.CreateDirectory("AppConfig");
                    File.WriteAllText("AppConfig\\ServerConfig.sc", EncrConn);
                }

                ObjDAL = new clsConnection_DAL(true);
                //DataTable dt = ObjDAL.GetDataCol(ClientDBName + ".dbo.RegistrationDetails", "RegistrationID", "PcName = '"+ Environment.MachineName+"'", null);
                int a = ObjDAL.CountRecords(ClientDBName + ".dbo.RegistrationDetails", "PcName = '" + Environment.MachineName + "'");
                //if (dt == null || dt.Rows.Count == 0)
                if (a == 0)
                {
                    InsertClientRegistration();
                }
                else
                {
                    clsUtility.ShowInfoMessage("Client is already Registered.", clsUtility.strProjectTitle);
                    Application.Exit();
                }
            }
            this.Cursor = Cursors.Default;
        }
Example #6
0
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.StoreMaster", "StoreName='" + txtStoreName.Text.Trim() + "'");
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.StoreMaster", "StoreName='" + txtStoreName.Text + "' AND StoreID !=" + i);
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #7
0
        private bool DuplicateColor(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.ColorMaster", "ColorName='" + txtColorName.Text.Trim() + "'");
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.ColorMaster", "ColorName='" + txtColorName.Text + "' AND ColorID !=" + i);
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #8
0
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CustomerMaster", "PhoneNo='" + txtCustomerMobileNo.Text.Trim() + "'");
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CustomerMaster", "PhoneNo='" + txtCustomerMobileNo.Text + "' AND CustomerID !=" + i);
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #9
0
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.tblCloseCashBandMaster", "CashBand='" + txtCashBand.Text.Trim() + "'");
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.tblCloseCashBandMaster", "CashBand='" + txtCashBand.Text + "' AND CashBandID !=" + i);
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CurrencyRateSetting", "CountryID=" + cmbCountry.SelectedValue);
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.CurrencyRateSetting", "CurrencyRateID !=" + i + " AND CountryID=" + cmbCountry.SelectedValue + " AND (CurrencyCode ='" + txtCurrencyCode.Text + "' OR CurrencyName = '" + txtCurrencyName.Text + "')");
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #11
0
        private bool DuplicateColor(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.SizeMaster", "SizeTypeID = " + cmbSizeType.SelectedValue + " AND Size='" + txtSize.Text.Trim() + "'");
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.SizeMaster", "SizeTypeID = " + cmbSizeType.SelectedValue + " AND Size='" + txtSize.Text.Trim() + "' AND SizeID!=" + i + "");
            }
            if (a > 0)
            {
                clsUtility.ShowInfoMessage("Size is already exist for Size Type " + cmbSizeType.Text, clsUtility.strProjectTitle);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #12
0
        private bool DuplicateUser(int i)
        {
            int a = 0;

            if (i == 0)
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.PurchaseInvoice", "SupplierID=" + cmbSupplier.SelectedValue + " AND SupplierBillNo='" + txtSupplierBillNo.Text + "'");
            }
            else
            {
                a = ObjDAL.CountRecords(clsUtility.DBName + ".dbo.PurchaseInvoice", "SupplierID=" + cmbSupplier.SelectedValue + " AND SupplierBillNo='" + txtSupplierBillNo.Text + "'" +
                                        " AND PurchaseInvoiceID !=" + i);
            }
            if (a > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #13
0
        private void SaveBarCodeSettings(string BarCodeData)
        {
            int count = ObjCon.CountRecords(clsUtility.DBName + ".dbo.tblBarCodeSettings");

            if (count == 0)
            {
                ObjCon.SetColumnData("BarCodeSetting", SqlDbType.NVarChar, BarCodeData);
                ObjCon.InsertData(clsUtility.DBName + ".dbo.tblBarCodeSettings", false);
            }
            else
            {
                int r = ObjCon.ExecuteNonQuery("Update " + clsUtility.DBName + ".dbo.tblBarCodeSettings set BarCodeSetting='" + BarCodeData + "'");
            }
        }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         KillbackupDatabase();//closing auto database backup service
         if (Directory.Exists(txtBacupPath.Text))
         {
             if (ObjDAL.CountRecords(clsUtility.DBName + ".dbo.BackupConfig  ") > 0)
             {
                 ObjDAL.UpdateColumnData("Path", SqlDbType.NVarChar, txtBacupPath.Text.Trim());
                 //ObjDAL.UpdateColumnData("Date", SqlDbType.Date, dateTimePicker1.Value);
                 ObjDAL.UpdateColumnData("Date", SqlDbType.Date, dateTimePicker2.Value);
                 ObjDAL.UpdateColumnData("Time", SqlDbType.DateTime, dateTimePicker2.Value);
                 int a = ObjDAL.UpdateData(clsUtility.DBName + ".dbo.BackupConfig", "BackupID=1");
                 if (a > 0)
                 {
                     clsUtility.ShowInfoMessage("Backup Configure Successfully.", clsUtility.strProjectTitle);
                 }
             }
             else
             {
                 ObjDAL.SetColumnData("Path", SqlDbType.NVarChar, txtBacupPath.Text.Trim());
                 ObjDAL.SetColumnData("Date", SqlDbType.Date, dateTimePicker1.Value);
                 ObjDAL.SetColumnData("Time", SqlDbType.DateTime, dateTimePicker2.Value);
                 ObjDAL.SetColumnData("IsAutoBackup", SqlDbType.Bit, 1);
                 int a = ObjDAL.InsertData(clsUtility.DBName + ".dbo.BackupConfig", false);
                 if (a > 0)
                 {
                     clsUtility.ShowInfoMessage("Backup Configure Successfully.", clsUtility.strProjectTitle);
                 }
             }
         }
         else
         {
             clsUtility.ShowErrorMessage("Path is not exist", clsUtility.strProjectTitle);
             return;
         }
         inc++;
         this.Size          = new Size(364, 446);
         btnAutoBackup.Text = "Configure Auto Backup >>";
         StartBackupService();
     }
     catch (Exception ex) { clsUtility.ShowInfoMessage(ex.ToString(), clsUtility.strProjectTitle); }
 }