コード例 #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (Validateform())
     {
         if (DuplicateUser(0))
         {
             ObjDAL.SetColumnData("CountryID", SqlDbType.Int, cmbCountry.SelectedValue);
             ObjDAL.SetColumnData("CurrencyCode", SqlDbType.NVarChar, txtCurrencyCode.Text);
             ObjDAL.SetColumnData("CurrencyName", SqlDbType.NVarChar, txtCurrencyName.Text);
             ObjDAL.SetColumnData("CurrencyRate", SqlDbType.Decimal, txtCurrencyRate.Text);
             ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
             if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.CurrencyRateSetting", true) > 0)
             {
                 ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                 clsUtility.ShowInfoMessage("Currency Rate for '" + cmbCountry.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                 ClearAll();
                 LoadData();
                 grpCurrencyValue.Enabled = false;
             }
             else
             {
                 clsUtility.ShowInfoMessage("Currency Rate for '" + cmbCountry.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
             }
         }
         else
         {
             clsUtility.ShowErrorMessage("Currency Rate for '" + cmbCountry.Text + "' is already exist..", clsUtility.strProjectTitle);
             cmbCountry.Focus();
         }
         ObjDAL.ResetData();
     }
 }
コード例 #2
0
ファイル: Category_Master.cs プロジェクト: khan89aamir/IMS
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (Validateform())
     {
         if (DuplicateUser(0))
         {
             ObjDAL.SetColumnData("CategoryName", SqlDbType.NVarChar, txtCategoryName.Text.Trim());
             ObjDAL.SetColumnData("CategoryDescription", SqlDbType.NVarChar, txtCategoryDescription.Text);
             ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, cmbActiveStatus.SelectedItem.ToString() == "Active" ? 1 : 0);
             ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
             if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.CategoryMaster", true) > 0)
             {
                 ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                 //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                 clsUtility.ShowInfoMessage("Category Name : '" + txtCategoryName.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                 ClearAll();
                 LoadData();
                 grpCategory.Enabled = false;
             }
             else
             {
                 clsUtility.ShowInfoMessage("Category Name : '" + txtCategoryName.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                 ObjDAL.ResetData();
             }
         }
         else
         {
             clsUtility.ShowErrorMessage("'" + txtCategoryName.Text + "' Category is already exist..", clsUtility.strProjectTitle);
             ObjDAL.ResetData();
             txtCategoryName.Focus();
         }
     }
 }
コード例 #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         int a = 0;
         for (int i = 0; i < dtSize.Rows.Count; i++)
         {
             ObjDAL.SetColumnData("Size", SqlDbType.VarChar, dtSize.Rows[i]["Size"].ToString());
             ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, Convert.ToInt32(dtSize.Rows[i]["ActiveStatus"]));
             ObjDAL.SetColumnData("SizeTypeID", SqlDbType.Int, Convert.ToInt32(dtSize.Rows[i]["SizeTypeID"]));
             ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
             a = ObjDAL.InsertData(clsUtility.DBName + ".dbo.SizeMaster", true);
         }
         if (a > 0)
         {
             //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
             ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
             clsUtility.ShowInfoMessage(clsUtility.MsgDataSaved, clsUtility.strProjectTitle);
             ClearAll();
             LoadData();
             grpSizeType.Enabled = false;
             btnAddMore.Enabled  = false;
         }
         else
         {
             clsUtility.ShowInfoMessage(clsUtility.MsgDatanotSaved, clsUtility.strProjectTitle);
             ObjDAL.ResetData();
         }
     }
 }
コード例 #4
0
 private void InsertComapnyMasterTable()
 {
     ObjDAL.SetColumnData("CompanyName", SqlDbType.NVarChar, txtOrganisation.Text.Trim());
     ObjDAL.SetColumnData("Address", SqlDbType.NVarChar, txtAddress.Text.Trim());
     ObjDAL.SetColumnData("MobileNo", SqlDbType.NVarChar, txtMobileNo.Text.Trim());
     ObjDAL.SetColumnData("EmailID", SqlDbType.NVarChar, txtEmail.Text.Trim());
     ObjDAL.InsertData(clsUtility.DBName + ".dbo.CompanyMaster", false);
     ObjDAL.ResetData();
 }
コード例 #5
0
ファイル: frmOtherSetting.cs プロジェクト: khan89aamir/IMS
        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;
            }
        }
コード例 #6
0
 //private void Insert_UpdateData(string ProductName, string CategoryID, string Rate, string ActiveStatus, string CreatedBy)
 private void Insert_UpdateData(string ProductName, string CategoryID, string ProductArabicName)
 {
     try
     {
         ObjDAL.SetColumnData("ProductName", SqlDbType.NVarChar, ProductName);
         ObjDAL.SetColumnData("CategoryID", SqlDbType.Int, CategoryID);
         ObjDAL.SetColumnData("ProductArabicName", SqlDbType.NVarChar, ProductArabicName);
         //ObjDAL.SetColumnData("Rate", SqlDbType.NVarChar, Rate);
         //ObjDAL.SetColumnData("ActiveStatus", SqlDbType.NVarChar, ActiveStatus);
         //ObjDAL.SetColumnData("CreatedBy", SqlDbType.NVarChar, 0);
         int a = ObjDAL.InsertData(clsUtility.DBName + ".dbo.ProductMaster", true);
     }
     catch (Exception ex)
     {
         clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle);
     }
 }
コード例 #7
0
 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); }
 }
コード例 #8
0
ファイル: Import_Data.cs プロジェクト: khan89aamir/IMS
 private void Inser_UpdateData(string ProductName, string CategoryID, string BrandID, string ActiveStatus)
 {
     //using (SqlConnection ObjCon = new SqlConnection(clsConnection_DAL.strConnectionString))
     // {
     try
     {
         ObjDAL.SetColumnData("ProductName", SqlDbType.VarChar, ProductName);
         ObjDAL.SetColumnData("CategoryID", SqlDbType.Int, CategoryID);
         ObjDAL.SetColumnData("BrandID", SqlDbType.Int, BrandID);
         ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, ActiveStatus);
         ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, 0);
         int a = ObjDAL.InsertData("ProductMaster", true);
     }
     catch (Exception ex)
     {
         clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle);
     }
     //}
 }
コード例 #9
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (clsFormRights.HasFormRight(clsFormRights.Forms.Size_Type_Master, clsFormRights.Operation.Save) || clsUtility.IsAdmin)
     {
         if (Validateform())
         {
             if (DuplicateUser(0))
             {
                 ObjDAL.SetColumnData("SizeTypeName", SqlDbType.NVarChar, txtSizeTypeName.Text.Trim());
                 //if (cmbDepartment.SelectedIndex >= 0)
                 //{
                 ObjDAL.SetColumnData("CategoryID", SqlDbType.Int, cmbDepartment.SelectedValue);
                 //}
                 ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, cmbActiveStatus.SelectedItem.ToString() == "Active" ? 1 : 0);
                 ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
                 if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.SizeTypeMaster", true) > 0)
                 {
                     //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                     ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                     clsUtility.ShowInfoMessage("Size Type Name : '" + txtSizeTypeName.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                     ClearAll();
                     LoadData();
                     grpSizeTypeDetails.Enabled = false;
                 }
                 else
                 {
                     clsUtility.ShowInfoMessage("Size Type Name : '" + txtSizeTypeName.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                 }
                 ObjDAL.ResetData();
             }
             else
             {
                 clsUtility.ShowErrorMessage("'" + txtSizeTypeName.Text + "' Size Type is already exist..", clsUtility.strProjectTitle);
                 txtSizeTypeName.Focus();
             }
         }
     }
     else
     {
         clsUtility.ShowInfoMessage("You have no rights to perform this task", clsUtility.strProjectTitle);
     }
 }
コード例 #10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (cmbGenerate.SelectedIndex == -1)
            {
                clsUtility.ShowInfoMessage("Please select the specification.", clsUtility.strProjectTitle);
                return;
            }

            else if (AnyRightCheck() == false)
            {
                CoreApp.clsUtility.ShowInfoMessage("Please select shop.", clsUtility.strProjectTitle);
                return;
            }

            StringBuilder bs = new StringBuilder();

            dgvShopeDetails.EndEdit();
            for (int i = 0; i < dgvShopeDetails.Rows.Count; i++)
            {
                if (Convert.ToBoolean(dgvShopeDetails.Rows[i].Cells["colCheck"].Value))
                {
                    string storeID = dgvShopeDetails.Rows[i].Cells["StoreID"].Value.ToString();
                    bs.Append(storeID);
                    bs.Append(",");
                }
            }

            string StoreID = bs.ToString().Remove(bs.ToString().Length - 1, 1);

            ObjDAL.ExecuteNonQuery("Delete " + clsUtility.DBName + ".dbo.tblDashBoard ");

            ObjDAL.SetColumnData("Shopes", SqlDbType.NVarChar, StoreID);
            ObjDAL.SetColumnData("FromDate", SqlDbType.Date, dtpFromDate.Value.ToString("yyyy-MM-dd"));
            ObjDAL.SetColumnData("ToDate", SqlDbType.Date, dtpToDate.Value.ToString("yyyy-MM-dd"));
            ObjDAL.SetColumnData("Specification", SqlDbType.Int, cmbGenerate.SelectedIndex);
            ObjDAL.SetColumnData("RefreshRate", SqlDbType.Int, Convert.ToInt32(numericUpDown1.Value));
            ObjDAL.InsertData("" + clsUtility.DBName + ".dbo.tblDashBoard", false);

            clsUtility.ShowInfoMessage("Dashboard settings has been saved.", clsUtility.strProjectTitle);
            this.Close();
        }
コード例 #11
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (clsFormRights.HasFormRight(clsFormRights.Forms.Brand_Master, clsFormRights.Operation.Save) || clsUtility.IsAdmin)
     {
         if (Validateform())
         {
             if (DuplicateUser(0))
             {
                 ObjDAL.SetColumnData("CashBand", SqlDbType.Decimal, txtCashBand.Text.Trim());
                 ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, cmbActiveStatus.SelectedItem.ToString() == "Active" ? 1 : 0);
                 ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
                 if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.tblCloseCashBandMaster", true) > 0)
                 {
                     //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                     ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                     clsUtility.ShowInfoMessage("CashBand : '" + txtCashBand.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                     ClearAll();
                     LoadData();
                     grpClosingBALMaster.Enabled = false;
                 }
                 else
                 {
                     clsUtility.ShowInfoMessage("CashBand Name : '" + txtCashBand.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                     ObjDAL.ResetData();
                 }
             }
             else
             {
                 clsUtility.ShowErrorMessage("'" + txtCashBand.Text + "' CashBand is already exist..", clsUtility.strProjectTitle);
                 ObjDAL.ResetData();
                 txtCashBand.Focus();
             }
         }
     }
     else
     {
         clsUtility.ShowInfoMessage("You have no rights to perform this task", clsUtility.strProjectTitle);
     }
 }
コード例 #12
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (clsFormRights.HasFormRight(clsFormRights.Forms.Supplier_Details, clsFormRights.Operation.Save) || clsUtility.IsAdmin)
     {
         if (Validateform())
         {
             if (DuplicateUser(0))
             {
                 ObjDAL.SetColumnData("SupplierName", SqlDbType.NVarChar, txtSupplierName.Text.Trim());
                 ObjDAL.SetColumnData("CountryID", SqlDbType.Int, cmbCountry.SelectedValue);
                 ObjDAL.SetColumnData("Phone", SqlDbType.VarChar, txtPhone.Text.Trim());
                 ObjDAL.SetColumnData("EmailID", SqlDbType.VarChar, txtEmail.Text.Trim());
                 ObjDAL.SetColumnData("BankName", SqlDbType.NVarChar, txtBankName.Text.Trim());
                 ObjDAL.SetColumnData("BankAccountNo", SqlDbType.VarChar, txtBankAccNo.Text.Trim());
                 ObjDAL.SetColumnData("BankAddress", SqlDbType.NVarChar, txtBankAdd.Text.Trim());
                 ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, cmbActiveStatus.SelectedItem.ToString() == "Active" ? 1 : 0);
                 ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
                 if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.SupplierMaster", true) > 0)
                 {
                     ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                     clsUtility.ShowInfoMessage("Supplier Name : '" + txtSupplierName.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                     ClearAll();
                     LoadData();
                     grpSupplier.Enabled = false;
                 }
                 else
                 {
                     clsUtility.ShowInfoMessage("Supplier : '" + txtSupplierName.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                 }
                 ObjDAL.ResetData();
             }
             else
             {
                 clsUtility.ShowErrorMessage("'" + txtSupplierName.Text + "' Supplier is already exist..", clsUtility.strProjectTitle);
                 txtSupplierName.Focus();
             }
         }
     }
     else
     {
         clsUtility.ShowInfoMessage("You have no rights to perform this task", clsUtility.strProjectTitle);
     }
 }
コード例 #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 + "'");
            }
        }
コード例 #14
0
        private void RestoreDataBase()
        {
            try
            {
                clsDMCommon.ObjCon.ConnectionString = "Server=" + clsDMCommon.strServerName + ";Database=master;uid="
                                                      + clsDMCommon.strUserID + ";pwd= " + clsDMCommon.strUserPassword + ";" + "Max Pool Size = 5004;Pooling=True";
                if (clsDMCommon.ObjCon.State == ConnectionState.Closed)
                {
                    clsDMCommon.ObjCon.Open();
                }
                string     sqlcmd = "RESTORE DATABASE " + strRDatabseName + " FROM DISK='" + strRestorePath + "' with replace";
                SqlCommand cmd    = new SqlCommand(sqlcmd, clsDMCommon.ObjCon);
                cmd.ExecuteNonQuery();
                clsDMCommon.ObjCon.Close();
                CloseLoading();

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

                clsDMCommon.ObjCon.ConnectionString = conn; //for loading connection string for frmCustomerRegister
                clsConnection_DAL ObjDAL = new clsConnection_DAL(true);
                ObjDAL.SetColumnData("PcName", SqlDbType.NVarChar, Environment.MachineName);
                ObjDAL.SetColumnData("StatusDate", SqlDbType.VarChar, ObjUtil.Encrypt(DateTime.Now.ToString("yyyy/MM/dd"), true));
                ObjDAL.SetColumnData("IsTrail", SqlDbType.Bit, 1);
                ObjDAL.SetColumnData("RegDate", SqlDbType.Date, DateTime.Now);
                ObjDAL.SetColumnData("ExpiryDate", SqlDbType.VarChar, ObjUtil.Encrypt(DateTime.Now.AddDays(7).ToString("yyyy/MM/dd"), true));
                ObjDAL.SetColumnData("IsKeyEnter", SqlDbType.Bit, 0);
                ObjDAL.SetColumnData("IsServer", SqlDbType.Bit, 1);

                if (ObjDAL.InsertData(strRDatabseName + ".dbo.RegistrationDetails", true) > 0)
                {
                    clsUtility.ShowInfoMessage("RESTORE DATABASE successfully.", clsUtility.strProjectTitle);
                }
            }
            catch (Exception ex)
            {
                clsDMCommon.ObjCon.Close();
                CloseLoading();
                clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle);
            }
            //RESTORE DATABASE database_name FROM backup_device WITH RECOVERY
        }
コード例 #15
0
        private void SaveUserRights()
        {
            ObjCon.ExecuteNonQuery("Delete " + clsUtility.DBName + ".dbo.[tblStoreUserRights] where UserID = " + txtUserID.Text);
            dgvShopeDetails.EndEdit();
            for (int i = 0; i < dgvShopeDetails.Rows.Count; i++)
            {
                if (Convert.ToBoolean(dgvShopeDetails.Rows[i].Cells["colCheck"].Value))
                {
                    string storeID = dgvShopeDetails.Rows[i].Cells["StoreID"].Value.ToString();
                    ObjCon.SetColumnData("UserID", SqlDbType.Int, txtUserID.Text);
                    ObjCon.SetColumnData("StoreID", SqlDbType.Int, storeID);
                    ObjCon.SetColumnData("CreatedOn", SqlDbType.DateTime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    ObjCon.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);

                    ObjCon.InsertData(clsUtility.DBName + ".dbo.tblStoreUserRights", false);
                }
            }
            Clear();
            clsUtility.ShowInfoMessage("User Shop rights have been saved.", clsUtility.strProjectTitle);
        }
コード例 #16
0
        private int InsertLoginHistory()
        {
            GetUserIPMacAddress();

            ObjDAL.SetColumnData("UserID", SqlDbType.Int, clsUtility.LoginID);
            ObjDAL.SetColumnData("UserName", SqlDbType.NVarChar, txtUserName.Text.Trim());
            ObjDAL.SetColumnData("PcName", SqlDbType.NVarChar, System.Environment.MachineName);
            ObjDAL.SetColumnData("MachineUserName", SqlDbType.NVarChar, System.Environment.UserName);
            ObjDAL.SetColumnData("UserIPAddress", SqlDbType.VarChar, UserIPAddress);
            ObjDAL.SetColumnData("UserMacAddress", SqlDbType.VarChar, UserMacAddress);

            return(ObjDAL.InsertData(clsUtility.DBName + ".dbo.Login_History", true));
        }
コード例 #17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Validateform())
            {
                if (DuplicateUser(0))
                {
                    string name = txtUserName.Text.Trim();
                    string pass = ObjUtil.Encrypt(txtPassword.Text, true);
                    ObjDAL.SetColumnData("UserName", SqlDbType.NVarChar, name);
                    ObjDAL.SetColumnData("Password", SqlDbType.NVarChar, pass);
                    ObjDAL.SetColumnData("EmailID", SqlDbType.VarChar, txtEmail.Text);
                    ObjDAL.SetColumnData("SecurityQuestion", SqlDbType.NVarChar, cmbSecurity.SelectedItem.ToString());
                    ObjDAL.SetColumnData("Answer", SqlDbType.NVarChar, ObjUtil.Encrypt(txtAsnwer.Text.Trim(), true));
                    ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, LogID); //if LogID=0 then Test Admin else user
                    ObjDAL.SetColumnData("IsAdmin", SqlDbType.Bit, rdAdmin.Checked == true ? 1 : 0);
                    ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, rdActive.Checked == true ? 1 : 0);
                    if (ObjDAL.InsertData(DBName + ".dbo.UserManagement", true) > 0)
                    {
                        ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, admin);
                        ClearAll();
                        LoadData();

                        EnableDisable(false);
                        clsUtility.ShowInfoMessage("User Name: '" + name + "' is Saved Successfully..", clsUtility.strProjectTitle);
                    }
                    else
                    {
                        clsUtility.ShowInfoMessage("User Name: '" + name + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                    }
                    ObjDAL.ResetData();
                }
                else
                {
                    clsUtility.ShowErrorMessage("'" + txtUserName.Text + "' UserName OR EmailID is already exist..", clsUtility.strProjectTitle);
                    txtUserName.Focus();
                }
            }
        }
コード例 #18
0
        private void InsertClientRegistration()
        {
            //clsConnection_DAL ObjDAL = new clsConnection_DAL(true);
            DataTable dt = ObjDAL.GetDataCol(ClientDBName + ".dbo.RegistrationDetails", "[SoftKey],[ExpiryDate],[StatusDate]", "ISNULL([IsServer],0) = 1 AND ISNULL([IsKeyEnter],0) = 1", null);

            if (ObjUtil.ValidateTable(dt))
            {
                ObjDAL.SetColumnData("PcName", SqlDbType.NVarChar, Environment.MachineName);
                ObjDAL.SetColumnData("StatusDate", SqlDbType.VarChar, dt.Rows[0]["StatusDate"].ToString());
                ObjDAL.SetColumnData("SoftKey", SqlDbType.VarChar, dt.Rows[0]["SoftKey"].ToString());
                ObjDAL.SetColumnData("IsTrail", SqlDbType.Bit, 0);
                ObjDAL.SetColumnData("RegDate", SqlDbType.Date, DateTime.Now);
                ObjDAL.SetColumnData("ExpiryDate", SqlDbType.VarChar, dt.Rows[0]["ExpiryDate"].ToString());
                ObjDAL.SetColumnData("IsKeyEnter", SqlDbType.Bit, 1);

                if (ObjDAL.InsertData(ClientDBName + ".dbo.RegistrationDetails", true) > 0)
                {
                    ObjDAL.ResetData();
                    clsUtility.ShowInfoMessage("Client Registration is successfully", clsUtility.strProjectTitle);
                    //System.Diagnostics.Process.Start(exeName + ".exe");
                    Application.Exit();
                }
            }
        }
コード例 #19
0
        //private int GetDefaultStoreID()
        //{
        //    return ObjDAL.ExecuteScalarInt("SELECT StoreID FROM " + clsUtility.DBName + ".dbo.DefaultStoreSetting WITH(NOLOCK) WHERE MachineName='" + Environment.MachineName + "'");
        //}
        private void OpenCashBox()
        {
            string NexCashNumber = GetCashNumber();
            int    pStoreID      = Home_StoreID;

            ObjDAL.SetColumnData("CashNo", SqlDbType.NVarChar, NexCashNumber);
            ObjDAL.SetColumnData("StoreID", SqlDbType.Int, pStoreID);
            ObjDAL.SetColumnData("CashBoxDate", SqlDbType.Date, DateTime.Now.ToString("yyyy-MM-dd"));
            ObjDAL.SetColumnData("EmployeeID", SqlDbType.Int, clsUtility.LoginID);
            ObjDAL.SetColumnData("CashStatus", SqlDbType.Bit, false);
            ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);

            int result = ObjDAL.InsertData(clsUtility.DBName + ".[dbo].tblMasterCashClosing", true);

            if (result > 0)
            {
                Home_MasterCashClosingID = result;
                clsUtility.ShowInfoMessage("Cash Box has been Opened !", clsUtility.strProjectTitle);
                btnOpenCash.Text = "View Details";
                LoadCashStatus();
            }
        }
コード例 #20
0
        private void CreateNewUser(int EmployeeID)
        {
            ObjDAL.SetColumnData("UserName", SqlDbType.NVarChar, txtUsername.Text.Trim());
            ObjDAL.SetColumnData("Password", SqlDbType.NVarChar, ObjUtil.Encrypt(txtPass.Text.Trim(), true));
            ObjDAL.SetColumnData("EmailID", SqlDbType.NVarChar, txtEmail.Text.Trim());
            ObjDAL.SetColumnData("IsAdmin", SqlDbType.Bit, false);
            ObjDAL.SetColumnData("IsBlock", SqlDbType.Bit, false);
            ObjDAL.SetColumnData("EmployeeID", SqlDbType.Int, EmployeeID);

            if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.UserManagement", true) > 0)
            {
                ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                clsUtility.ShowInfoMessage("User has been added Successfully.", clsUtility.strProjectTitle);
                ClearAll();
                LoadData();
                grpEmployee.Enabled = false;
            }
            else
            {
                clsUtility.ShowInfoMessage("Failed to add the User.", clsUtility.strProjectTitle);
                ObjDAL.ResetData();
            }
        }
コード例 #21
0
ファイル: SplashWindow.cs プロジェクト: khan89aamir/TAILORING
        private bool CheckReg()
        {
            DataTable dt = ObjDAL.GetData(clsUtility.DBName + ".dbo.RegistrationDetails", "PcName='" + Environment.MachineName + "'", "RegistrationID");

            if (dt != null && dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["IsKeyEnter"] != DBNull.Value && Convert.ToBoolean(dt.Rows[0]["IsKeyEnter"]) == false)
                {
                    return(false);
                }
                DateTime status  = Convert.ToDateTime(ObjUtil.Decrypt(dt.Rows[0]["StatusDate"].ToString(), true));
                DateTime ExpDate = Convert.ToDateTime(ObjUtil.Decrypt(dt.Rows[0]["ExpiryDate"].ToString(), true));
                if (status <= Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss tt")))  //checking wheather user is changed datetime or not
                {
                    if (dt.Rows[0]["SoftKey"] == DBNull.Value)
                    {
                        return(false);
                    }
                    else if (ExpDate > status) //checking wheather sotware is expire or not
                    {
                        return(true);
                    }
                    else //if software is expired than this condition will execute
                    {
                        timer1.Stop();
                        i = 1;
                        clsUtility.ShowInfoMessage("Trail Version is Over \nIf you want to buy this Product Contact to Admin", clsUtility.strProjectTitle);
                        Application.Exit();
                        return(false);
                    }
                }
                else if (status > Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss tt")))//if user has changed datetime than this condition will execute
                {
                    timer1.Stop();
                    i = 1;
                    clsUtility.ShowInfoMessage("Change the your System date & Time\n for accessing this Software", clsUtility.strProjectTitle);
                    Application.Exit();
                    return(false);
                }
                else if (Convert.ToBoolean(dt.Rows[0]["IsTrail"]) == false && ExpDate > status)
                {
                    return(true);
                }
                return(true);
            }
            else //first time this condition will execute
            {
                ObjDAL.SetColumnData("PcName", SqlDbType.NVarChar, Environment.MachineName);
                ObjDAL.SetColumnData("StatusDate", SqlDbType.VarChar, ObjUtil.Encrypt(DateTime.Now.ToString("yyyy/MM/dd"), true));
                ObjDAL.SetColumnData("IsTrail", SqlDbType.Bit, 1);
                ObjDAL.SetColumnData("RegDate", SqlDbType.Date, DateTime.Now);
                ObjDAL.SetColumnData("ExpiryDate", SqlDbType.VarChar, ObjUtil.Encrypt(DateTime.Now.AddDays(7).ToString("yyyy/MM/dd"), true));
                ObjDAL.SetColumnData("IsKeyEnter", SqlDbType.Bit, 0);

                if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.RegistrationDetails", true) > 0)
                {
                    return(false);
                }
                return(false);
            }
        }
コード例 #22
0
        private void SaveRightsData(bool isEditMode)
        {
            if (isEditMode)
            {
                ObjCon.ExecuteNonQuery("DELETE " + clsUtility.DBName + ".[dbo].[tblUserRights] WHERE UserID=" + txtUserID.Text);
            }

            foreach (DataGridViewRow row in dgvUserRIghts.Rows)
            {
                bool RightFoud = false;
                if (row.Cells["View"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["View"].Value))
                {
                    RightFoud = true;
                }
                else if (row.Cells["Save"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Save"].Value))
                {
                    RightFoud = true;
                }
                else if (row.Cells["Update"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Update"].Value))
                {
                    RightFoud = true;
                }
                else if (row.Cells["Delete"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Delete"].Value))
                {
                    RightFoud = true;
                }
                else if (row.Cells["Other"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Other"].Value))
                {
                    RightFoud = true;
                }
                // Only insert if right found.
                if (RightFoud)
                {
                    RightFoud = false;
                    bool IsView   = false;
                    bool IsSave   = false;
                    bool IsUpdate = false;
                    bool IsDelete = false;
                    bool IsOther  = false;

                    if (row.Cells["View"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["View"].Value))
                    {
                        IsView = true;
                    }
                    if (row.Cells["Save"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Save"].Value))
                    {
                        IsSave = true;
                    }
                    if (row.Cells["Update"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Update"].Value))
                    {
                        IsUpdate = true;
                    }
                    if (row.Cells["Delete"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Delete"].Value))
                    {
                        IsDelete = true;
                    }
                    if (row.Cells["Other"].Value != DBNull.Value && Convert.ToBoolean(row.Cells["Other"].Value))
                    {
                        IsOther = true;
                    }
                    ObjCon.SetColumnData("UserID", SqlDbType.Int, txtUserID.Text);
                    ObjCon.SetColumnData("FormID", SqlDbType.Int, row.Cells["FormID"].Value.ToString());
                    ObjCon.SetColumnData("IsView", SqlDbType.Bit, IsView);
                    ObjCon.SetColumnData("IsSave", SqlDbType.Bit, IsSave);
                    ObjCon.SetColumnData("IsUpdate", SqlDbType.Bit, IsUpdate);
                    ObjCon.SetColumnData("IsDelete", SqlDbType.Bit, IsDelete);
                    ObjCon.SetColumnData("IsOther", SqlDbType.Bit, IsOther);
                    ObjCon.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);
                    ObjCon.InsertData(clsUtility.DBName + ".dbo.tblUserRights", false);
                }
            }
            //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
            if (isEditMode)
            {
                ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterUpdate);
                clsUtility.ShowInfoMessage("User rights has been Updaetd Successfully.", clsUtility.strProjectTitle);
                isEdit = false;
            }
            else
            {
                ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                clsUtility.ShowInfoMessage("User rights has been Saved Successfully.", clsUtility.strProjectTitle);
            }
            ClearAll();
            grpUserName.Enabled = false;
            grpRights.Enabled   = false;
        }
コード例 #23
0
 private int DataSavedDeliveryPurchaseBill2(int ID)
 {
     ObjDAL.SetColumnData("DeliveryPurchaseID1", SqlDbType.Int, ID);
     for (int i = 3; i < dtPurchaseQTYColor.Columns.Count - 1; i++)
     {
         string    col  = dtPurchaseQTYColor.Columns[i].ColumnName.ToString();
         DataRow[] drow = dtSize.Select("Size = '" + col + "' AND SizeTypeID=" + cmbSizeType.SelectedValue);
         if (drow.Length > 0)
         {
             ObjDAL.SetColumnData("Col" + (i - 2), SqlDbType.Int, drow[0]["SizeID"].ToString());
         }
     }
     ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
     return(ObjDAL.InsertData(clsUtility.DBName + ".dbo.DeliveryPurchaseBill2", true));
 }
コード例 #24
0
        private void OpenCashBox()
        {
            string NexCashNumber = GetCashNumber();
            int    pStoreID      = frmHome.Home_StoreID;

            ObjDAL.SetColumnData("CashNo", SqlDbType.NVarChar, NexCashNumber);
            ObjDAL.SetColumnData("StoreID", SqlDbType.Int, pStoreID);
            ObjDAL.SetColumnData("CashBoxDate", SqlDbType.Date, DateTime.Now.ToString("yyyy-MM-dd"));
            ObjDAL.SetColumnData("EmployeeID", SqlDbType.Int, clsUtility.LoginID);
            ObjDAL.SetColumnData("CashStatus", SqlDbType.Bit, false);
            ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);

            pMasterCashClosingID = ObjDAL.InsertData(clsUtility.DBName + ".[dbo].tblMasterCashClosing", true);
            if (pMasterCashClosingID > 0)
            {
                clsUtility.ShowInfoMessage("Cash Box has been Opened !", clsUtility.strProjectTitle);
                ClearAll();
                LoadData();
                btnOpenCash.Enabled = false;
            }
        }
コード例 #25
0
        private void btnAdd_Click_1(object sender, EventArgs e)
        {
            if (SalesValidation())
            {
                dgvProductDetails.EndEdit();

                // Before sales invocing make sure you have available qty for particular store

                string InvoiceDateTime = dtpSalesDate.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss");

                GenerateInvoiceNumber();
                #region SalesInvoiceDetails
                ObjDAL.SetColumnData("InvoiceNumber", SqlDbType.NVarChar, txtInvoiceNumber.Text);
                ObjDAL.SetColumnData("InvoiceDate", SqlDbType.DateTime, InvoiceDateTime);
                ObjDAL.SetColumnData("SubTotal", SqlDbType.Decimal, txtSubTotal.Text);
                ObjDAL.SetColumnData("Discount", SqlDbType.Decimal, txtDiscount.Text);
                ObjDAL.SetColumnData("Tax", SqlDbType.Decimal, txtDeliveryCharges.Text);
                ObjDAL.SetColumnData("GrandTotal", SqlDbType.Decimal, txtGrandTotal.Text);
                ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);
                ObjDAL.SetColumnData("CustomerID", SqlDbType.Int, txtCustomerID.Text);
                ObjDAL.SetColumnData("SalesMan", SqlDbType.Int, txtEmpID.Text);
                ObjDAL.SetColumnData("ShopeID", SqlDbType.Int, cmbShop.SelectedValue.ToString());

                ObjDAL.SetColumnData("PaymentMode", SqlDbType.NVarChar, lblPMode.Text);
                ObjDAL.SetColumnData("PaymentAutoID", SqlDbType.Int, Other_Forms.frmPayment.strPaymentAutoID);

                int InvoiceID = ObjDAL.InsertData(clsUtility.DBName + ".dbo.SalesInvoiceDetails", true);
                #endregion

                for (int i = 0; i < dgvProductDetails.Rows.Count; i++)
                {
                    string Total     = dgvProductDetails.Rows[i].Cells["Total"].Value.ToString();
                    string ProductID = dgvProductDetails.Rows[i].Cells["ProductID"].Value.ToString();
                    string QTY       = dgvProductDetails.Rows[i].Cells["QTY"].Value.ToString();
                    string Rate      = dgvProductDetails.Rows[i].Cells["Rate"].Value.ToString();
                    string ColorID   = dgvProductDetails.Rows[i].Cells["ColorID"].Value.ToString();
                    string SizeID    = dgvProductDetails.Rows[i].Cells["SizeID"].Value.ToString();

                    ObjDAL.SetColumnData("InvoiceID", SqlDbType.Int, InvoiceID);
                    ObjDAL.SetColumnData("ProductID", SqlDbType.Int, ProductID);
                    ObjDAL.SetColumnData("QTY", SqlDbType.Decimal, QTY);
                    ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);
                    ObjDAL.SetColumnData("Rate", SqlDbType.Decimal, Rate);
                    ObjDAL.SetColumnData("ColorID", SqlDbType.Int, ColorID);
                    ObjDAL.SetColumnData("SizeID", SqlDbType.Int, SizeID);

                    ObjDAL.InsertData(clsUtility.DBName + ".dbo.SalesDetails", false);

                    ObjDAL.ExecuteNonQuery("UPDATE " + clsUtility.DBName + ".dbo.ProductStockColorSizeMaster " +
                                           "SET QTY=QTY-" + QTY + " WHERE ProductID=" + ProductID + " and StoreID=" + cmbShop.SelectedValue.ToString() + " AND ColorID=" + ColorID + " AND SizeID=" + SizeID);
                }
                clsUtility.ShowInfoMessage("Data has been saved successfully.", clsUtility.strProjectTitle);
                ClearAll();

                Button button = (Button)sender;
                if (button.Name == "btnPrint")
                {
                    Report.frmSalesInvoiceReport frmSalesInvoice = new Report.frmSalesInvoiceReport();
                    frmSalesInvoice.InvoiceID     = InvoiceID;
                    frmSalesInvoice.IsDirectPrint = true;
                    frmSalesInvoice.Show();
                }
                else
                {
                    Report.frmSalesInvoiceReport frmSalesInvoice = new Report.frmSalesInvoiceReport();
                    frmSalesInvoice.InvoiceID     = InvoiceID;
                    frmSalesInvoice.IsDirectPrint = false;
                    frmSalesInvoice.Show();
                }
            }
        }
コード例 #26
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (clsFormRights.HasFormRight(clsFormRights.Forms.frmOtherSetting, clsFormRights.Operation.Save) || clsUtility.IsAdmin)
            {
                //DataTable dtFooterNote = ObjDAL.ExecuteSelectStatement("SELECT COUNT(1) FROM " + clsUtility.DBName + ".[dbo].[DefaultStoreSetting] WITH(NOLOCK)");

                int a = ObjDAL.CountRecords(clsUtility.DBName + ".[dbo].[DefaultStoreSetting]");
                if (a > 0) // if data found for the PC thenupdate
                {
                    //ObjDAL.ExecuteNonQuery("UPDATE " + clsUtility.DBName + ".dbo.DefaultStoreSetting SET InvoiceFooterNote =N'" + txtFooterNote.Text + "', UserArabicNumbers='" + chkArabicPrice.Checked.ToString() + "', ImagePath='" + txtImagePath.Text + "', Extension='" + GetExtension() + "'");

                    ObjDAL.UpdateColumnData("InvoiceFooterNote", SqlDbType.NVarChar, "N" + txtFooterNote.Text);
                    ObjDAL.UpdateColumnData("UserArabicNumbers", SqlDbType.Bit, chkArabicPrice.Checked);
                    ObjDAL.UpdateColumnData("ImagePath", SqlDbType.NVarChar, txtImagePath.Text);
                    ObjDAL.UpdateColumnData("Extension", SqlDbType.NVarChar, GetExtension());
                    ObjDAL.UpdateColumnData("UpdatedBy", SqlDbType.Int, clsUtility.LoginID);
                    ObjDAL.UpdateColumnData("UpdatedOn", SqlDbType.DateTime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    ObjDAL.UpdateColumnData("SalesManIDMandatory ", SqlDbType.Bit, chkSalesManName.Checked);
                    ObjDAL.UpdateColumnData("CustMobileMandatory ", SqlDbType.Bit, chkCustomerMobile.Checked);
                    ObjDAL.UpdateData(clsUtility.DBName + ".dbo.DefaultStoreSetting", "1=1");

                    clsUtility.ShowInfoMessage("Settings has been updated.", clsUtility.strProjectTitle);
                }
                else
                {
                    // else insert.
                    ObjDAL.SetColumnData("InvoiceFooterNote", SqlDbType.NVarChar, "N" + txtFooterNote.Text);
                    ObjDAL.SetColumnData("UserArabicNumbers", SqlDbType.Bit, chkArabicPrice.Checked);
                    ObjDAL.SetColumnData("ImagePath", SqlDbType.NVarChar, txtImagePath.Text);
                    ObjDAL.SetColumnData("Extension", SqlDbType.NVarChar, GetExtension());
                    ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);
                    ObjDAL.SetColumnData("SalesManIDMandatory ", SqlDbType.Bit, chkSalesManName.Checked);
                    ObjDAL.SetColumnData("CustMobileMandatory ", SqlDbType.Bit, chkCustomerMobile.Checked);

                    int r = ObjDAL.InsertData(clsUtility.DBName + ".[dbo].[DefaultStoreSetting]", false);
                    if (r > 0)
                    {
                        clsUtility.ShowInfoMessage("Settings has been saved.", clsUtility.strProjectTitle);
                    }
                    lblmsg.Visible = false;
                }


                Sales_Invoice._Is_SalesManIDMandat     = chkSalesManName.Checked;
                Sales_Invoice._Is_CustomerMobileMandat = chkCustomerMobile.Checked;
            }
        }
コード例 #27
0
ファイル: Purchase_invoice .cs プロジェクト: khan89aamir/IMS
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (clsFormRights.HasFormRight(clsFormRights.Forms.Purchase_Invoice, clsFormRights.Operation.Save) || clsUtility.IsAdmin)
            {
                if (Validateform())
                {
                    if (DuplicateUser(0))
                    {
                        ObjDAL.SetColumnData("SupplierBillNo", SqlDbType.NVarChar, txtSupplierBillNo.Text.Trim());
                        ObjDAL.SetColumnData("ShipmentNo", SqlDbType.NVarChar, txtShipmentNo.Text.Trim());
                        ObjDAL.SetColumnData("BillValue", SqlDbType.Decimal, txtBillValue.Text.Trim());
                        ObjDAL.SetColumnData("TotalQTY", SqlDbType.Int, txtTotalQTY.Text.Trim());
                        ObjDAL.SetColumnData("SupplierID", SqlDbType.Int, cmbSupplier.SelectedValue);
                        ObjDAL.SetColumnData("BillDate", SqlDbType.Date, dtpBillDate.Value.ToString("yyyy-MM-dd"));
                        ObjDAL.SetColumnData("Discount", SqlDbType.Decimal, txtForeignDiscount.Text.Length > 0 ? Convert.ToDecimal(txtForeignDiscount.Text) : 0);
                        ObjDAL.SetColumnData("ForeignExp", SqlDbType.Decimal, txtForeignExp.Text.Length > 0 ? Convert.ToDecimal(txtForeignExp.Text) : 0);
                        ObjDAL.SetColumnData("GrandTotal", SqlDbType.Decimal, txtNetValue.Text.Trim());

                        ObjDAL.SetColumnData("LocalValue", SqlDbType.Decimal, txtLocalValue.Text.Trim());
                        ObjDAL.SetColumnData("LocalExp", SqlDbType.Decimal, txtLocalExp.Text.Length > 0 ? Convert.ToDecimal(txtLocalExp.Text) : 0);
                        ObjDAL.SetColumnData("LocalBillValue", SqlDbType.Decimal, txtLocalBillValue.Text.Trim());

                        ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
                        if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.PurchaseInvoice", true) > 0)
                        {
                            //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                            ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                            clsUtility.ShowInfoMessage("Purchase Invoice for '" + cmbSupplier.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                            ClearAll();
                            LoadData();
                            grpPurchaseInvoice.Enabled = false;
                            grpForeignCurrency.Enabled = false;
                            grpLocalCurrency.Enabled   = false;
                        }
                        else
                        {
                            clsUtility.ShowInfoMessage("Purchase Invoice for '" + cmbSupplier.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                        }
                    }
                    else
                    {
                        clsUtility.ShowErrorMessage("Purchase Invoice for '" + cmbSupplier.Text + "' is already exist..", clsUtility.strProjectTitle);
                        cmbSupplier.Focus();
                    }
                    ObjDAL.ResetData();
                }
            }
            else
            {
                clsUtility.ShowInfoMessage("You have no rights to perform this task", clsUtility.strProjectTitle);
            }
        }
コード例 #28
0
        private string TransferStock()
        {
            string _BillNumber = "";

            if (Bill_ID.Trim().Length == 0)
            {
                _BillNumber = GenerateBillNumber();

                ObjDAL.SetColumnData("BillNo", SqlDbType.NVarChar, _BillNumber);
                ObjDAL.SetColumnData("FromStore", SqlDbType.Int, cmdFrom.SelectedValue);
                ObjDAL.SetColumnData("ToStore", SqlDbType.Int, cmdTo.SelectedValue);
                ObjDAL.SetColumnData("BillStatus", SqlDbType.NVarChar, lblBillStatus.Text);
                ObjDAL.SetColumnData("TotalQTY", SqlDbType.Int, txtTotalQTY.Text);
                ObjDAL.SetColumnData("BillDate", SqlDbType.Date, dtpSalesDate.Value.ToString("yyyy-MM-dd"));
                ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);

                int TransferID = ObjDAL.InsertData(clsUtility.DBName + ".dbo.tblStoreTransferBillDetails", true);

                if (TransferID > 0)
                {
                    for (int i = 0; i < dgvProductDetails.Rows.Count; i++)
                    {
                        string Total        = dgvProductDetails.Rows[i].Cells["Total"].Value.ToString();
                        string ProductID    = dgvProductDetails.Rows[i].Cells["ProductID"].Value.ToString();
                        string QTY          = dgvProductDetails.Rows[i].Cells["BillQTY"].Value.ToString();
                        string Rate         = dgvProductDetails.Rows[i].Cells["Rate"].Value.ToString();
                        string ColorID      = dgvProductDetails.Rows[i].Cells["ColorID"].Value.ToString();
                        string SizeID       = dgvProductDetails.Rows[i].Cells["SizeID"].Value.ToString();
                        string BarcodeNo    = dgvProductDetails.Rows[i].Cells["BarcodeNo"].Value.ToString();
                        string SubProductID = dgvProductDetails.Rows[i].Cells["SubProductID"].Value.ToString();

                        ObjDAL.SetColumnData("StoreBillDetailsID", SqlDbType.Int, TransferID);

                        ObjDAL.SetColumnData("ProductID", SqlDbType.Int, ProductID);
                        ObjDAL.SetColumnData("Barcode", SqlDbType.NVarChar, BarcodeNo);
                        ObjDAL.SetColumnData("SubProductID", SqlDbType.Int, SubProductID);
                        ObjDAL.SetColumnData("Rate", SqlDbType.Decimal, Rate);
                        ObjDAL.SetColumnData("BillQTY", SqlDbType.Int, QTY);
                        ObjDAL.SetColumnData("ColorID", SqlDbType.Int, ColorID);
                        ObjDAL.SetColumnData("SizeID", SqlDbType.Int, SizeID);
                        ObjDAL.SetColumnData("Total", SqlDbType.Decimal, Total);
                        ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);

                        ObjDAL.InsertData(clsUtility.DBName + ".dbo.tblStoreTransferItemDetails", false);
                    }
                    clsUtility.ShowInfoMessage("Item has been transferd to selected store.", clsUtility.strProjectTitle);
                }
            }
            else
            {
                _BillNumber = txtInvoiceNumber.Text;
                ObjDAL.UpdateColumnData("UpdatedOn", SqlDbType.DateTime, DateTime.Now);
                ObjDAL.UpdateColumnData("UpdatedBy", SqlDbType.Int, clsUtility.LoginID);
                ObjDAL.UpdateData(clsUtility.DBName + ".dbo.tblStoreTransferBillDetails", "StoreTransferID='" + Bill_ID + "'");

                ObjDAL.ExecuteNonQuery("Delete " + clsUtility.DBName + ".dbo.tblStoreTransferItemDetails WHERE StoreBillDetailsID=" + Bill_ID);
                int pBillQTY = 0;
                for (int i = 0; i < dgvProductDetails.Rows.Count; i++)
                {
                    string Total     = dgvProductDetails.Rows[i].Cells["Total"].Value.ToString();
                    string ProductID = dgvProductDetails.Rows[i].Cells["ProductID"].Value.ToString();

                    string QTY = dgvProductDetails.Rows[i].Cells["BillQTY"].Value.ToString();
                    pBillQTY += Convert.ToInt32(QTY);

                    string Rate         = dgvProductDetails.Rows[i].Cells["Rate"].Value.ToString();
                    string ColorID      = dgvProductDetails.Rows[i].Cells["ColorID"].Value.ToString();
                    string SizeID       = dgvProductDetails.Rows[i].Cells["SizeID"].Value.ToString();
                    string BarcodeNo    = dgvProductDetails.Rows[i].Cells["BarcodeNo"].Value.ToString();
                    string SubProductID = dgvProductDetails.Rows[i].Cells["SubProductID"].Value.ToString();
                    ObjDAL.SetColumnData("StoreBillDetailsID", SqlDbType.Int, Bill_ID);

                    ObjDAL.SetColumnData("ProductID", SqlDbType.Int, ProductID);
                    ObjDAL.SetColumnData("Barcode", SqlDbType.NVarChar, BarcodeNo);
                    ObjDAL.SetColumnData("SubProductID", SqlDbType.Int, SubProductID);
                    ObjDAL.SetColumnData("Rate", SqlDbType.Decimal, Rate);
                    ObjDAL.SetColumnData("BillQTY", SqlDbType.Int, QTY);
                    ObjDAL.SetColumnData("ColorID", SqlDbType.Int, ColorID);
                    ObjDAL.SetColumnData("SizeID", SqlDbType.Int, SizeID);
                    ObjDAL.SetColumnData("Total", SqlDbType.Decimal, Total);
                    ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID);

                    ObjDAL.InsertData(clsUtility.DBName + ".dbo.tblStoreTransferItemDetails", false);
                }
                ObjDAL.UpdateColumnData("TotalQTY", SqlDbType.Int, pBillQTY);
                ObjDAL.UpdateColumnData("UpdatedOn", SqlDbType.DateTime, DateTime.Now);
                ObjDAL.UpdateColumnData("UpdatedBy", SqlDbType.Int, clsUtility.LoginID);
                ObjDAL.UpdateData(clsUtility.DBName + ".dbo.tblStoreTransferBillDetails", "StoreTransferID='" + Bill_ID + "'");

                clsUtility.ShowInfoMessage("Item has been transferd to selected store.", clsUtility.strProjectTitle);
            }

            return(_BillNumber);
        }
コード例 #29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (clsFormRights.HasFormRight(clsFormRights.Forms.Purchase_Bill_Details, clsFormRights.Operation.Save) || clsUtility.IsAdmin)
            {
                DataTable dtPurchaseInvoiceBill = (DataTable)dataGridView1.DataSource;
                if (ObjUtil.ValidateTable(dtPurchaseInvoiceBill))
                {
                    int  _ID = 0;
                    bool b   = false;
                    for (int i = 0; i < dtPurchaseInvoiceBill.Rows.Count; i++)
                    {
                        _ID = 0;
                        ObjDAL.SetColumnData("PurchaseInvoiceID", SqlDbType.Int, PurchaseInvoiceID);
                        ObjDAL.SetColumnData("SupplierBillNo", SqlDbType.NVarChar, txtSupplierBillNo.Text.Trim());
                        ObjDAL.SetColumnData("SupplierID", SqlDbType.Int, cmbSupplier.SelectedValue);
                        ObjDAL.SetColumnData("BillDate", SqlDbType.Date, dtpBillDate.Value.ToString("yyyy-MM-dd"));
                        ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
                        _ProductID = Convert.ToInt32(dtPurchaseInvoiceBill.Rows[i]["ProductID"]);
                        ObjDAL.SetColumnData("ProductID", SqlDbType.Int, _ProductID);
                        ObjDAL.SetColumnData("ModelNo", SqlDbType.NVarChar, dtPurchaseInvoiceBill.Rows[i]["ModelNo"].ToString());
                        ObjDAL.SetColumnData("BrandID", SqlDbType.Int, dtPurchaseInvoiceBill.Rows[i]["BrandID"].ToString());
                        _QTY = Convert.ToInt32(dtPurchaseInvoiceBill.Rows[i]["QTY"]);
                        ObjDAL.SetColumnData("QTY", SqlDbType.Int, _QTY);
                        ObjDAL.SetColumnData("Rate", SqlDbType.Decimal, dtPurchaseInvoiceBill.Rows[i]["Rate"].ToString());
                        ObjDAL.SetColumnData("Sales_Price", SqlDbType.Decimal, dtPurchaseInvoiceBill.Rows[i]["EndUser"].ToString());
                        ObjDAL.SetColumnData("AddedRatio", SqlDbType.Int, dtPurchaseInvoiceBill.Rows[i]["AddedRatio"].ToString());
                        ObjDAL.SetColumnData("SuppossedPrice", SqlDbType.Decimal, dtPurchaseInvoiceBill.Rows[i]["SuppossedPrice"].ToString());

                        _ID = ObjDAL.InsertData(clsUtility.DBName + ".dbo.PurchaseInvoiceDetails", true);

                        //Updating Sales price in Product Master table for sales window
                        ObjDAL.UpdateColumnData("Rate", SqlDbType.Decimal, dtPurchaseInvoiceBill.Rows[i]["EndUser"]);
                        ObjDAL.UpdateData(clsUtility.DBName + ".dbo.ProductMaster", "ProductID = " + _ProductID + "");
                    }

                    if (_ID > 0)
                    {
                        //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                        ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                        if (txtDiffQty.Text == "0" && txtDiffValue.Text == "0")
                        {
                            clsUtility.ShowInfoMessage("Purchase Invoice is Saved Successfully..", clsUtility.strProjectTitle);
                        }
                        ClearAll();
                        grpPurchaseBillDetail.Enabled = false;
                    }
                    else
                    {
                        clsUtility.ShowInfoMessage("Purchase Invoice is not Saved Successfully..", clsUtility.strProjectTitle);
                    }
                    ObjDAL.ResetData();
                }
                else
                {
                    //ObjDAL.UpdateColumnData("SupplierBillNo", SqlDbType.VarChar, txtSupplierBillNo.Text.Trim());
                    //ObjDAL.UpdateColumnData("ProductID", SqlDbType.Int, txtProductID.Text.Trim());
                    //ObjDAL.UpdateColumnData("ModelNo", SqlDbType.NVarChar, txtModelNo.Text.Trim());
                    //ObjDAL.UpdateColumnData("BrandID", SqlDbType.Int, cmbBrand.SelectedValue);
                    //ObjDAL.UpdateColumnData("QTY", SqlDbType.Int, txtQTY.Text);
                    //ObjDAL.UpdateColumnData("Rate", SqlDbType.Decimal, txtRate.Text.Trim());
                    //ObjDAL.UpdateColumnData("UpdatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test
                    //ObjDAL.UpdateColumnData("UpdatedOn", SqlDbType.DateTime, DateTime.Now);

                    //if (ObjDAL.UpdateData(clsUtility.DBName + ".dbo.PurchaseInvoiceDetails", "PurchaseInvoiceID = " + PurchaseInvoiceID + "") > 0)
                    //{
                    //    ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterUpdate, clsUtility.IsAdmin);
                    //    ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterUpdate);

                    //    clsUtility.ShowInfoMessage("Purchase Invoice for '" + cmbSupplier.SelectedItem + "' is Updated", clsUtility.strProjectTitle);
                    //    ClearAll();
                    //    grpPurchaseBillDetail.Enabled = false;
                    //    ObjDAL.ResetData();
                    //}
                    //else
                    //{
                    //    clsUtility.ShowInfoMessage("Purchase Invoice for '" + cmbSupplier.SelectedItem + "' is not Updated", clsUtility.strProjectTitle);
                    //    ObjDAL.ResetData();
                    //}
                }
            }
            else
            {
                clsUtility.ShowInfoMessage("You have no rights to perform this task", clsUtility.strProjectTitle);
            }
            dataGridView1.DataSource = dtPurchaseInvoice;
        }