using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Swash.BusinessLayer;
using Swash.Frameworks;
using Swash.Objects;
using Barcodes.Properties;
namespace Barcodes
{
public partial class frmHome : Form
{
#region Header
private void btnCommon_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "common_hover.png", btnCommon);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelCommon.Visible = true;
}
private void btnItem_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "item_hover.png", btnItem);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelItem.Visible = true;
}
private void btnStock_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "stock_hover.png", btnStock);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelStock.Visible = true;
}
private void btnKitting_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "kitting_hover.png", btnKitting);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelKitting.Visible = true;
}
private void btnSetup_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "setup_hover.png", btnSetup);
pnlBody.Controls.Clear();
ToggleVisiblePanel();
PanelSetup.Visible = true;
//frmSetup objPage = new frmSetup();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
private void btnTools_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "tools_hover.png", btnTools);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelTools.Visible = true;
}
#endregion
#region Common
public void btnCategory_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "category_hover.png", btnCategory);
frmCategories objPage = new frmCategories();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnBrand_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "brand_hover.png", btnBrand);
frmBrand objPage = new frmBrand();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnColour_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "color_hover.png", btnColour);
frmColor objPage = new frmColor();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnClarity_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "clarity_hover.png", btnClarity);
frmClarity objPage = new frmClarity();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnDesign_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "design_hover.png", btnDesign);
frmDesign objPage = new frmDesign();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnStone_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "stone_hover.png", btnStone);
frmStone objPage = new frmStone();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnStoneCut_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "stone_cut_hover.png", btnStoneCut);
frmStoneCut objPage = new frmStoneCut();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnGrade_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "grade_hover.png", btnGrade);
frmGrade objPage = new frmGrade();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnPurity_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "purity_hover.png", btnPurity);
frmPurity objPage = new frmPurity();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnItemMatrix_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "matrix_field_hover.png", btnItemMatrix);
frmMatrixFields objPage = new frmMatrixFields();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnItemType_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "item_type_hover.png", BtnItemType);
frmItemType objPage = new frmItemType();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnStore_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "store_hover.png", BtnStore);
frmManageStore objPage = new frmManageStore();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Item
void Setup()
{
BtnBarcode.Location = BtnItemDetails.Location;
BtnItemDetails.Location = BtnManageMatrix.Location;
BtnManageMatrix.Visible = false;
BtnManageItem.Visible = false;
}
private void BtnManageMatrix_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "manage_matrix_hover.png", BtnManageMatrix);
//frmMatrixDisplay objPage = new frmMatrixDisplay();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
private void BtnManageItem_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "manage_item_hover.png", BtnManageItem);
//frmMatrixDataEntry objPage = new frmMatrixDataEntry();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
private void BtnItemDetails_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "item_details_hover.png", BtnItemDetails);
frmItems objPage = new frmItems();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnBarcode_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "barcode_hover.png", BtnBarcode);
frmPrintBarcode objPage = new frmPrintBarcode();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Stock
private void BtnManageStock_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "manage_stock_hover.png", BtnManageStock);
frmStock objPage = new frmStock();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnIssueToQC_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "issue_qc_hover.png", BtnIssueToQC);
frmIssueToQualityControl objPage = new frmIssueToQualityControl();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnApproveQC_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "approve_qc_hover.png", BtnApproveQC);
}
private void BtnReceiveFromQC_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "rcv_qc_hover.png", BtnReceiveFromQC);
frmReceivedFromQC objPage = new frmReceivedFromQC();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnPurchaseOrder_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "purchase_order_hover.png", BtnPurchaseOrder);
frmPurchaseOrder objPage = new frmPurchaseOrder();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Kitting
private void BtnKitSetup_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "kit_setup_hover.png", BtnKitSetup);
frmKitSetUp objPage = new frmKitSetUp();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnApproveKit_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "approve_kit_hover.png", BtnApproveKit);
frmKittingApproval objPage = new frmKittingApproval();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnIssueKit_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "issue_kit_hover.png", BtnIssueKit);
frmIssueForPackingAndKitting1 objPage = new frmIssueForPackingAndKitting1();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnReceiveKit_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "receive_kit_hover.png", BtnReceiveKit);
frmReceiveFromPackingAndKitting objPage = new frmReceiveFromPackingAndKitting();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Setup
private void BtnUser_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "approve_kit_hover.png", BtnApproveKit);
frmUser objPage = new frmUser();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnUserPrivillages_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "barcode_type_hover.png", BtnBarcodeType);
frmDynamiMenu objPage = new frmDynamiMenu();
// objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
objPage.ShowDialog();
}
private void BtnBarcodeType_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "barcode_type_hover.png", BtnBarcodeType);
frmBarcodeType objPage = new frmBarcodeType();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Tools
private void BtnBackup_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "backup_hover.png", BtnBackup);
frmBackup objPage = new frmBackup();
//frmPrintBarcode objPage = new frmPrintBarcode();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnRestore_Click(object sender, EventArgs e)
{
frmMenu objPage = new frmMenu();
//frmPrintBarcode objPage = new frmPrintBarcode();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
//ImageChange("click", "body", "restore_hover.png", BtnRestore);
//frmItems objPage = new frmItems();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
#endregion
#region Other Event And Methods
public frmHome()
{
InitializeComponent();
}
private void frmHome_Load(object sender, EventArgs e)
{
btnCommon_Click(sender, e); // Check it according to user previllage
DateTime dt = DateTime.Now.Date;
lblTime.Text = DateTime.Now.ToString("dd MMMM yyyy");
//lblTime.Text = String.Format("{0:F}", dt);
ManagePanel();
Setup();
if (frmLogin.username != null && frmLogin.username != "")
{
LblUserName.Visible = true;
LblWelcome.Visible = true;
LblUserName.Text = frmLogin.username;
}
BtnApproveQC.Visible = false;
}
private void btnTax_Click(object sender, EventArgs e)
{
//============Bank===========
//ImageChange("click", "body", "tax_hover.png", btnTax);
//frmBank objPage = new frmBank();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
//============Bank===========
ImageChange("click", "body", "tax_hover.png", btnTax);
frmVendor objPage = new frmVendor();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
//Image Manipulation for Controls
private void btnAll_MouseHover(object sender, EventArgs e)
{
Button btn = (Button)sender;
//-----------Header--------------
if (btn.Name == "btnSetup")
ImageChange("hover", "top", "setup_hover.png", btn);
if (btn.Name == "btnItem")
ImageChange("hover", "top", "item_hover.png", btn);
if (btn.Name == "btnStock")
ImageChange("hover", "top", "stock_hover.png", btn);
if (btn.Name == "btnKitting")
ImageChange("hover", "top", "kitting_hover.png", btn);
if (btn.Name == "btnCommon")
ImageChange("hover", "top", "common_hover.png", btn);
if (btn.Name == "btnTools")
ImageChange("hover", "top", "tools_hover.png", btn);
//-----------Common--------------
if (btn.Name == "btnStone")
ImageChange("hover", "body", "stone_hover.png", btn);
if (btn.Name == "btnColour")
ImageChange("color_hover", "body", "color_hover.png", btn);
if (btn.Name == "btnClarity")
ImageChange("hover", "body", "clarity_hover.png", btn);
if (btn.Name == "btnStoneCut")
ImageChange("hover", "body", "stone_cut_hover.png", btn);
if (btn.Name == "btnDesign")
ImageChange("hover", "body", "design_hover.png", btn);
if (btn.Name == "btnBrand")
ImageChange("brand_hover", "body", "brand_hover.png", btn);
if (btn.Name == "btnGrade")
ImageChange("hover", "body", "grade_hover.png", btn);
if (btn.Name == "btnPurity")
ImageChange("hover", "body", "purity_hover.png", btn);
if (btn.Name == "btnItemMatrix")
ImageChange("hover", "body", "matrix_field_hover.png", btn);
if (btn.Name == "btnTax")
ImageChange("hover", "body", "tax_hover.png", btn);
if (btn.Name == "btnCategory")
ImageChange("hover", "body", "category_hover.png", btn);
if (btn.Name == "BtnItemType")
ImageChange("hover", "body", "item_type_hover.png", btn);
if (btn.Name == "BtnStore")
ImageChange("hover", "body", "store_hover.png", btn);
//-----------Item--------------
if (btn.Name == "BtnManageMatrix")
ImageChange("hover", "body", "manage_matrix_hover.png", btn);
if (btn.Name == "BtnManageItem")
ImageChange("hover", "body", "manage_item_hover.png", btn);
if (btn.Name == "BtnItemDetails")
ImageChange("hover", "body", "item_details_hover.png", btn);
if (btn.Name == "BtnBarcode")
ImageChange("hover", "body", "barcode_hover.png", btn);
//-----------Stock--------------
if (btn.Name == "BtnManageStock")
ImageChange("hover", "body", "manage_stock_hover.png", btn);
if (btn.Name == "BtnIssueToQC")
ImageChange("hover", "body", "issue_qc_hover.png", btn);
if (btn.Name == "BtnApproveQC")
ImageChange("hover", "body", "approve_qc_hover.png", btn);
if (btn.Name == "BtnReceiveFromQC")
ImageChange("hover", "body", "rcv_qc_hover.png", btn);
//if (btn.Name == "BtnPurchaseOrder")
// ImageChange("hover", "body", "purchase_order_hover.png", btn);
//-----------Kitting--------------
if (btn.Name == "BtnKitSetup")
ImageChange("hover", "body", "kit_setup_hover.png", btn);
if (btn.Name == "BtnApproveKit")
ImageChange("hover", "body", "approve_kit_hover.png", btn);
if (btn.Name == "BtnIssueKit")
ImageChange("hover", "body", "issue_kit_hover.png", btn);
if (btn.Name == "BtnReceiveKit")
ImageChange("hover", "body", "receive_kit_hover.png", btn);
//-----------Setup--------------
if (btn.Name == "BtnUser")
ImageChange("hover", "body", "user_hover.png", btn);
if (btn.Name == "BtnUserPrivillages")
ImageChange("hover", "body", "user_privileges_hover.png", btn);
if (btn.Name == "BtnBarcodeType")
ImageChange("hover", "body", "barcode_type_hover.png", btn);
//-----------Tools--------------
if (btn.Name == "BtnBackup")
ImageChange("hover", "body", "backup_hover.png", btn);
if (btn.Name == "BtnRestore")
ImageChange("hover", "body", "restore_hover.png", btn);
}
private void btnAll_MouseLeave(object sender, EventArgs e)
{
Button btn = (Button)sender;
//-----------Header--------------
if (btn.Name == "btnSetup")
ImageChange("hover", "top", "setup.png", btn);
if (btn.Name == "btnItem")
ImageChange("hover", "top", "item.png", btn);
if (btn.Name == "btnStock")
ImageChange("hover", "top", "stock.png", btn);
if (btn.Name == "btnKitting")
ImageChange("hover", "top", "kitting.png", btn);
if (btn.Name == "btnCommon")
ImageChange("hover", "top", "common.png", btn);
if (btn.Name == "btnTools")
ImageChange("hover", "top", "tools.png", btn);
//-----------Common--------------
if (btn.Name == "btnStone")
ImageChange("hover", "body", "stone.png", btn);
if (btn.Name == "btnColour")
ImageChange("color", "body", "color.png", btn);
if (btn.Name == "btnClarity")
ImageChange("hover", "body", "clarity.png", btn);
if (btn.Name == "btnStoneCut")
ImageChange("hover", "body", "stone_cut.png", btn);
if (btn.Name == "btnDesign")
ImageChange("hover", "body", "design.png", btn);
if (btn.Name == "btnBrand")
ImageChange("brand", "body", "brand.png", btn);
if (btn.Name == "btnGrade")
ImageChange("hover", "body", "grade.png", btn);
if (btn.Name == "btnPurity")
ImageChange("hover", "body", "purity.png", btn);
if (btn.Name == "btnItemMatrix")
ImageChange("hover", "body", "matrix_field.png", btn);
if (btn.Name == "btnTax")
ImageChange("hover", "body", "tax.png", btn);
if (btn.Name == "btnCategory")
ImageChange("hover", "body", "category.png", btn);
if (btn.Name == "BtnItemType")
ImageChange("hover", "body", "item_type.png", btn);
if (btn.Name == "BtnStore")
ImageChange("hover", "body", "store.png", btn);
//-----------Item--------------
if (btn.Name == "BtnManageMatrix")
ImageChange("hover", "body", "manage_matrix.png", btn);
if (btn.Name == "BtnManageItem")
ImageChange("hover", "body", "manage_item.png", btn);
if (btn.Name == "BtnItemDetails")
ImageChange("hover", "body", "item_details.png", btn);
if (btn.Name == "BtnBarcode")
ImageChange("hover", "body", "barcode.png", btn);
//-----------Stock--------------
if (btn.Name == "BtnManageStock")
ImageChange("hover", "body", "manage_stock.png", btn);
if (btn.Name == "BtnIssueToQC")
ImageChange("hover", "body", "issue_qc.png", btn);
if (btn.Name == "BtnApproveQC")
ImageChange("hover", "body", "approve_qc.png", btn);
if (btn.Name == "BtnReceiveFromQC")
ImageChange("hover", "body", "rcv_qc.png", btn);
//if (btn.Name == "BtnPurchaseOrder")
// ImageChange("hover", "body", "purchase_order.png", btn);
//-----------Kitting--------------
if (btn.Name == "BtnKitSetup")
ImageChange("hover", "body", "kit_setup.png", btn);
if (btn.Name == "BtnApproveKit")
ImageChange("hover", "body", "approve_kit.png", btn);
if (btn.Name == "BtnIssueKit")
ImageChange("hover", "body", "issue_kit.png", btn);
if (btn.Name == "BtnReceiveKit")
ImageChange("hover", "body", "receive_kit.png", btn);
//-----------Setup--------------
if (btn.Name == "BtnUser")
ImageChange("hover", "body", "user.png", btn);
if (btn.Name == "BtnUserPrivillages")
ImageChange("hover", "body", "user_privileges.png", btn);
if (btn.Name == "BtnBarcodeType")
ImageChange("hover", "body", "barcode_type.png", btn);
//-----------Tools--------------
if (btn.Name == "BtnBackup")
ImageChange("hover", "body", "backup.png", btn);
if (btn.Name == "BtnRestore")
ImageChange("hover", "body", "restore.png", btn);
}
Button ButtonTop = null; string ImageTop = null;
Button ButtonBody = null; string ImageBody = null;
protected void ImageChange(string type, string level, string imagename, Button btn) //Type for hover, click ---- and level for top or body
{
if (type == "click")
{
Button btnPrev = null; string ImagePrev = null;
if (level == "top") { btnPrev = ButtonTop; ImagePrev = ImageTop; ButtonTop = btn; ImageTop = imagename; }
else { btnPrev = ButtonBody; ImagePrev = ImageBody; ButtonBody = btn; ImageBody = imagename; }
if (btnPrev != null)
{
ImagePrev = ImagePrev.Substring(0, ImagePrev.Length - ImagePrev.StartsWith("_").ToString().Length - 5) + ".png";
ImageChange("hover", level, ImagePrev, btnPrev);
}
ImageLoad(imagename, btn);
}
else
{
if (level == "top") { if (ButtonTop != btn)ImageLoad(imagename, btn); }
else { if (ButtonBody != btn) ImageLoad(imagename, btn); }
}
}
//void ImageLoad(string imagename, Button btn)
//{
// string ImagePath = (System.Environment.CurrentDirectory);
// ImagePath = ImagePath.Substring(0, ImagePath.Length - ImagePath.StartsWith("bin").ToString().Length - 4);
// btn.BackgroundImage = Image.FromFile("" + ImagePath + "Resources/" + imagename);
//}
void ImageLoad(string imagename, Button btn)
{
btn.BackgroundImage = GetImage(imagename);
}
Bitmap GetImage(string imagename)
{
Bitmap btImage = null;
switch (imagename)
{
case "common.png": btImage = Resources.common; break;
case "common_hover.png": btImage = Resources.common_hover; break;
case "item.png": btImage = Resources.item; break;
case "item_hover.png": btImage = Resources.item_hover; break;
case "stock.png": btImage = Resources.stock; break;
case "stock_hover.png": btImage = Resources.stock_hover; break;
case "kitting.png": btImage = Resources.kitting; break;
case "kitting_hover.png": btImage = Resources.kitting_hover; break;
case "setup.png": btImage = Resources.setup; break;
case "setup_hover.png": btImage = Resources.setup_hover; break;
case "tools.png": btImage = Resources.tools; break;
case "tools_hover.png": btImage = Resources.tools_hover; break;
case "category.png": btImage = Resources.category; break;
case "category_hover.png": btImage = Resources.category_hover; break;
case "brand.png": btImage = Resources.brand; break;
case "brand_hover.png": btImage = Resources.brand_hover; break;
case "color.png": btImage = Resources.color; break;
case "color_hover.png": btImage = Resources.color_hover; break;
case "clarity.png": btImage = Resources.clarity; break;
case "clarity_hover.png": btImage = Resources.clarity_hover; break;
case "design.png": btImage = Resources.design; break;
case "design_hover.png": btImage = Resources.design_hover; break;
case "stone.png": btImage = Resources.stone; break;
case "stone_hover.png": btImage = Resources.stone_hover; break;
case "stone_cut.png": btImage = Resources.stone_cut; break;
case "stone_cut_hover.png": btImage = Resources.stone_cut_hover; break;
case "grade.png": btImage = Resources.grade; break;
case "grade_hover.png": btImage = Resources.grade_hover; break;
case "purity.png": btImage = Resources.purity; break;
case "purity_hover.png": btImage = Resources.purity_hover; break;
case "item_type.png": btImage = Resources.item_type; break;
case "item_type_hover.png": btImage = Resources.item_type_hover; break;
case "store.png": btImage = Resources.store; break;
case "store_hover.png": btImage = Resources.store_hover; break;
case "matrix_field.png": btImage = Resources.matrix_field; break;
case "matrix_field_hover.png": btImage = Resources.matrix_field_hover; break;
//-----------Stock--------------
case "manage_stock_hover.png": btImage = Resources.manage_stock_hover; break;
case "issue_qc_hover.png": btImage = Resources.issue_qc_hover; break;
case "approve_qc_hover.png": btImage = Resources.approve_qc_hover; break;
case "rcv_qc_hover.png": btImage = Resources.rcv_qc_hover; break;
case "manage_stock.png": btImage = Resources.manage_stock; break;
case "issue_qc.png": btImage = Resources.issue_qc; break;
case "approve_qc.png": btImage = Resources.approve_qc; break;
case "rcv_qc.png": btImage = Resources.rcv_qc; break;
//-----------Kitting--------------
case "kit_setup_hover.png": btImage = Resources.kit_setup_hover; break;
case "approve_kit_hover.png": btImage = Resources.approve_kit_hover; break;
case "issue_kit_hover.png": btImage = Resources.issue_kit_hover; break;
case "receive_kit_hover.png": btImage = Resources.receive_kit_hover; break;
case "kit_setup.png": btImage = Resources.kit_setup; break;
case "approve_kit.png": btImage = Resources.approve_kit; break;
case "issue_kit.png": btImage = Resources.issue_kit; break;
case "receive_kit.png": btImage = Resources.receive_kit; break;
//-----------Setup--------------
case "user_hover.png": btImage = Resources.user_hover; break;
case "user_privileges_hover.png": btImage = Resources.user_privileges_hover; break;
case "barcode_type_hover.png": btImage = Resources.barcode_type_hover; break;
case "user.png": btImage = Resources.user; break;
case "user_privileges.png": btImage = Resources.user_privileges; break;
case "barcode_type.png": btImage = Resources.barcode_type; break;
//-----------Tools--------------
case "backup_hover.png": btImage = Resources.backup_hover; break;
case "restore_hover.png": btImage = Resources.restore_hover; break;
case "backup.png": btImage = Resources.backup; break;
case "restore.png": btImage = Resources.restore; break;
//-----------Item--------------
case "manage_matrix.png": btImage = Resources.manage_matrix; break;
case "manage_item.png": btImage = Resources.manage_item; break;
case "item_details.png": btImage = Resources.item_details; break;
case "barcode.png": btImage = Resources.barcode; break;
case "manage_matrix_hover.png": btImage = Resources.manage_matrix_hover; break;
case "manage_item_hover.png": btImage = Resources.manage_item_hover; break;
case "item_details_hover.png": btImage = Resources.item_details_hover; break;
case "barcode_hover.png": btImage = Resources.barcode_hover; break;
}
return btImage;
}
private void timer1_Tick(object sender, EventArgs e)
{
DateTime dt = DateTime.Now;
lblTime.Text = String.Format("{0:F}", dt);
}
private void button1_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "tax_hover.png", btnTax);
}
void ManagePanel()
{
//PanelSetup.Location = new Point(2, 103);
PanelSetup.Location = PanelCommon.Location;
PanelSetup.Height = PanelCommon.Height;
PanelSetup.Width = PanelCommon.Width;
PanelSetup.Visible = false;
//=========================================
PanelItem.Location = PanelCommon.Location;
PanelItem.Height = PanelCommon.Height;
PanelItem.Width = PanelCommon.Width;
PanelItem.Visible = false;
//=========================================
PanelStock.Location = PanelCommon.Location;
PanelStock.Height = PanelCommon.Height;
PanelStock.Width = PanelCommon.Width;
PanelStock.Visible = false;
//=========================================
PanelKitting.Location = PanelCommon.Location;
PanelKitting.Height = PanelCommon.Height;
PanelKitting.Width = PanelCommon.Width;
PanelKitting.Visible = false;
//=========================================
PanelTools.Location = PanelCommon.Location;
PanelTools.Height = PanelCommon.Height;
PanelTools.Width = PanelCommon.Width;
PanelTools.Visible = false;
//=========================================
}
void ToggleVisiblePanel()
{
PanelCommon.Visible = false;
PanelSetup.Visible = false;
PanelItem.Visible = false;
PanelStock.Visible = false;
PanelKitting.Visible = false;
PanelTools.Visible = false;
}
#endregion
private void frmHome_FormClosing(object sender, FormClosingEventArgs e)
{
//if (MessageBox.Show("Are you sure to Close this Application..?", "Ken Cloud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
//{
// Application.Exit();
//}
//else
//{
// this.Show();
//}
}
private void btnLogout_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure to logout?", "Ken Cloud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
frmLogin obj = new frmLogin();
obj.Show();
this.Hide();
}
//{
// Application.Exit();
//}
}
private void frmHome_FormClosed(object sender, FormClosedEventArgs e)
{
//if (MessageBox.Show("Are you sure to Close this Application..?", "Ken Cloud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
//{
Application.Exit();
//}
//else
//{
// this.Show();
//}
}
private void QCRejectStockRegister_Click(object sender, EventArgs e)
{
frmRptQCRejectStockRegister objPage = new frmRptQCRejectStockRegister();
objPage.Show();
}
private void BtnUserRole_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "approve_kit_hover.png", BtnApproveKit);
frmUserRole objPage = new frmUserRole();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Swash.BusinessLayer;
using Swash.Frameworks;
using Swash.Objects;
using Barcodes.Properties;
namespace Barcodes
{
public partial class frmHome : Form
{
#region Header
private void btnCommon_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "common_hover.png", btnCommon);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelCommon.Visible = true;
}
private void btnItem_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "item_hover.png", btnItem);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelItem.Visible = true;
}
private void btnStock_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "stock_hover.png", btnStock);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelStock.Visible = true;
}
private void btnKitting_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "kitting_hover.png", btnKitting);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelKitting.Visible = true;
}
private void btnSetup_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "setup_hover.png", btnSetup);
pnlBody.Controls.Clear();
ToggleVisiblePanel();
PanelSetup.Visible = true;
//frmSetup objPage = new frmSetup();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
private void btnTools_Click(object sender, EventArgs e)
{
ImageChange("click", "top", "tools_hover.png", btnTools);
pnlBody.Controls.Clear();
ManagePanel();
ToggleVisiblePanel();
PanelTools.Visible = true;
}
#endregion
#region Common
public void btnCategory_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "category_hover.png", btnCategory);
frmCategories objPage = new frmCategories();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnBrand_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "brand_hover.png", btnBrand);
frmBrand objPage = new frmBrand();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnColour_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "color_hover.png", btnColour);
frmColor objPage = new frmColor();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnClarity_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "clarity_hover.png", btnClarity);
frmClarity objPage = new frmClarity();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnDesign_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "design_hover.png", btnDesign);
frmDesign objPage = new frmDesign();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnStone_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "stone_hover.png", btnStone);
frmStone objPage = new frmStone();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnStoneCut_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "stone_cut_hover.png", btnStoneCut);
frmStoneCut objPage = new frmStoneCut();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnGrade_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "grade_hover.png", btnGrade);
frmGrade objPage = new frmGrade();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnPurity_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "purity_hover.png", btnPurity);
frmPurity objPage = new frmPurity();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void btnItemMatrix_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "matrix_field_hover.png", btnItemMatrix);
frmMatrixFields objPage = new frmMatrixFields();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnItemType_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "item_type_hover.png", BtnItemType);
frmItemType objPage = new frmItemType();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnStore_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "store_hover.png", BtnStore);
frmManageStore objPage = new frmManageStore();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Item
void Setup()
{
BtnBarcode.Location = BtnItemDetails.Location;
BtnItemDetails.Location = BtnManageMatrix.Location;
BtnManageMatrix.Visible = false;
BtnManageItem.Visible = false;
}
private void BtnManageMatrix_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "manage_matrix_hover.png", BtnManageMatrix);
//frmMatrixDisplay objPage = new frmMatrixDisplay();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
private void BtnManageItem_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "manage_item_hover.png", BtnManageItem);
//frmMatrixDataEntry objPage = new frmMatrixDataEntry();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
private void BtnItemDetails_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "item_details_hover.png", BtnItemDetails);
frmItems objPage = new frmItems();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnBarcode_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "barcode_hover.png", BtnBarcode);
frmPrintBarcode objPage = new frmPrintBarcode();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Stock
private void BtnManageStock_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "manage_stock_hover.png", BtnManageStock);
frmStock objPage = new frmStock();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnIssueToQC_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "issue_qc_hover.png", BtnIssueToQC);
frmIssueToQualityControl objPage = new frmIssueToQualityControl();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnApproveQC_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "approve_qc_hover.png", BtnApproveQC);
}
private void BtnReceiveFromQC_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "rcv_qc_hover.png", BtnReceiveFromQC);
frmReceivedFromQC objPage = new frmReceivedFromQC();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnPurchaseOrder_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "purchase_order_hover.png", BtnPurchaseOrder);
frmPurchaseOrder objPage = new frmPurchaseOrder();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Kitting
private void BtnKitSetup_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "kit_setup_hover.png", BtnKitSetup);
frmKitSetUp objPage = new frmKitSetUp();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnApproveKit_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "approve_kit_hover.png", BtnApproveKit);
frmKittingApproval objPage = new frmKittingApproval();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnIssueKit_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "issue_kit_hover.png", BtnIssueKit);
frmIssueForPackingAndKitting1 objPage = new frmIssueForPackingAndKitting1();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnReceiveKit_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "receive_kit_hover.png", BtnReceiveKit);
frmReceiveFromPackingAndKitting objPage = new frmReceiveFromPackingAndKitting();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Setup
private void BtnUser_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "approve_kit_hover.png", BtnApproveKit);
frmUser objPage = new frmUser();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnUserPrivillages_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "barcode_type_hover.png", BtnBarcodeType);
frmDynamiMenu objPage = new frmDynamiMenu();
// objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
objPage.ShowDialog();
}
private void BtnBarcodeType_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "barcode_type_hover.png", BtnBarcodeType);
frmBarcodeType objPage = new frmBarcodeType();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
#endregion
#region Tools
private void BtnBackup_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "backup_hover.png", BtnBackup);
frmBackup objPage = new frmBackup();
//frmPrintBarcode objPage = new frmPrintBarcode();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
private void BtnRestore_Click(object sender, EventArgs e)
{
frmMenu objPage = new frmMenu();
//frmPrintBarcode objPage = new frmPrintBarcode();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
//ImageChange("click", "body", "restore_hover.png", BtnRestore);
//frmItems objPage = new frmItems();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
}
#endregion
#region Other Event And Methods
public frmHome()
{
InitializeComponent();
}
private void frmHome_Load(object sender, EventArgs e)
{
btnCommon_Click(sender, e); // Check it according to user previllage
DateTime dt = DateTime.Now.Date;
lblTime.Text = DateTime.Now.ToString("dd MMMM yyyy");
//lblTime.Text = String.Format("{0:F}", dt);
ManagePanel();
Setup();
if (frmLogin.username != null && frmLogin.username != "")
{
LblUserName.Visible = true;
LblWelcome.Visible = true;
LblUserName.Text = frmLogin.username;
}
BtnApproveQC.Visible = false;
}
private void btnTax_Click(object sender, EventArgs e)
{
//============Bank===========
//ImageChange("click", "body", "tax_hover.png", btnTax);
//frmBank objPage = new frmBank();
//objPage.TopLevel = false;
//objPage.Visible = true;
//pnlBody.Controls.Clear();
//pnlBody.Controls.Add(objPage);
//============Bank===========
ImageChange("click", "body", "tax_hover.png", btnTax);
frmVendor objPage = new frmVendor();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
//Image Manipulation for Controls
private void btnAll_MouseHover(object sender, EventArgs e)
{
Button btn = (Button)sender;
//-----------Header--------------
if (btn.Name == "btnSetup")
ImageChange("hover", "top", "setup_hover.png", btn);
if (btn.Name == "btnItem")
ImageChange("hover", "top", "item_hover.png", btn);
if (btn.Name == "btnStock")
ImageChange("hover", "top", "stock_hover.png", btn);
if (btn.Name == "btnKitting")
ImageChange("hover", "top", "kitting_hover.png", btn);
if (btn.Name == "btnCommon")
ImageChange("hover", "top", "common_hover.png", btn);
if (btn.Name == "btnTools")
ImageChange("hover", "top", "tools_hover.png", btn);
//-----------Common--------------
if (btn.Name == "btnStone")
ImageChange("hover", "body", "stone_hover.png", btn);
if (btn.Name == "btnColour")
ImageChange("color_hover", "body", "color_hover.png", btn);
if (btn.Name == "btnClarity")
ImageChange("hover", "body", "clarity_hover.png", btn);
if (btn.Name == "btnStoneCut")
ImageChange("hover", "body", "stone_cut_hover.png", btn);
if (btn.Name == "btnDesign")
ImageChange("hover", "body", "design_hover.png", btn);
if (btn.Name == "btnBrand")
ImageChange("brand_hover", "body", "brand_hover.png", btn);
if (btn.Name == "btnGrade")
ImageChange("hover", "body", "grade_hover.png", btn);
if (btn.Name == "btnPurity")
ImageChange("hover", "body", "purity_hover.png", btn);
if (btn.Name == "btnItemMatrix")
ImageChange("hover", "body", "matrix_field_hover.png", btn);
if (btn.Name == "btnTax")
ImageChange("hover", "body", "tax_hover.png", btn);
if (btn.Name == "btnCategory")
ImageChange("hover", "body", "category_hover.png", btn);
if (btn.Name == "BtnItemType")
ImageChange("hover", "body", "item_type_hover.png", btn);
if (btn.Name == "BtnStore")
ImageChange("hover", "body", "store_hover.png", btn);
//-----------Item--------------
if (btn.Name == "BtnManageMatrix")
ImageChange("hover", "body", "manage_matrix_hover.png", btn);
if (btn.Name == "BtnManageItem")
ImageChange("hover", "body", "manage_item_hover.png", btn);
if (btn.Name == "BtnItemDetails")
ImageChange("hover", "body", "item_details_hover.png", btn);
if (btn.Name == "BtnBarcode")
ImageChange("hover", "body", "barcode_hover.png", btn);
//-----------Stock--------------
if (btn.Name == "BtnManageStock")
ImageChange("hover", "body", "manage_stock_hover.png", btn);
if (btn.Name == "BtnIssueToQC")
ImageChange("hover", "body", "issue_qc_hover.png", btn);
if (btn.Name == "BtnApproveQC")
ImageChange("hover", "body", "approve_qc_hover.png", btn);
if (btn.Name == "BtnReceiveFromQC")
ImageChange("hover", "body", "rcv_qc_hover.png", btn);
//if (btn.Name == "BtnPurchaseOrder")
// ImageChange("hover", "body", "purchase_order_hover.png", btn);
//-----------Kitting--------------
if (btn.Name == "BtnKitSetup")
ImageChange("hover", "body", "kit_setup_hover.png", btn);
if (btn.Name == "BtnApproveKit")
ImageChange("hover", "body", "approve_kit_hover.png", btn);
if (btn.Name == "BtnIssueKit")
ImageChange("hover", "body", "issue_kit_hover.png", btn);
if (btn.Name == "BtnReceiveKit")
ImageChange("hover", "body", "receive_kit_hover.png", btn);
//-----------Setup--------------
if (btn.Name == "BtnUser")
ImageChange("hover", "body", "user_hover.png", btn);
if (btn.Name == "BtnUserPrivillages")
ImageChange("hover", "body", "user_privileges_hover.png", btn);
if (btn.Name == "BtnBarcodeType")
ImageChange("hover", "body", "barcode_type_hover.png", btn);
//-----------Tools--------------
if (btn.Name == "BtnBackup")
ImageChange("hover", "body", "backup_hover.png", btn);
if (btn.Name == "BtnRestore")
ImageChange("hover", "body", "restore_hover.png", btn);
}
private void btnAll_MouseLeave(object sender, EventArgs e)
{
Button btn = (Button)sender;
//-----------Header--------------
if (btn.Name == "btnSetup")
ImageChange("hover", "top", "setup.png", btn);
if (btn.Name == "btnItem")
ImageChange("hover", "top", "item.png", btn);
if (btn.Name == "btnStock")
ImageChange("hover", "top", "stock.png", btn);
if (btn.Name == "btnKitting")
ImageChange("hover", "top", "kitting.png", btn);
if (btn.Name == "btnCommon")
ImageChange("hover", "top", "common.png", btn);
if (btn.Name == "btnTools")
ImageChange("hover", "top", "tools.png", btn);
//-----------Common--------------
if (btn.Name == "btnStone")
ImageChange("hover", "body", "stone.png", btn);
if (btn.Name == "btnColour")
ImageChange("color", "body", "color.png", btn);
if (btn.Name == "btnClarity")
ImageChange("hover", "body", "clarity.png", btn);
if (btn.Name == "btnStoneCut")
ImageChange("hover", "body", "stone_cut.png", btn);
if (btn.Name == "btnDesign")
ImageChange("hover", "body", "design.png", btn);
if (btn.Name == "btnBrand")
ImageChange("brand", "body", "brand.png", btn);
if (btn.Name == "btnGrade")
ImageChange("hover", "body", "grade.png", btn);
if (btn.Name == "btnPurity")
ImageChange("hover", "body", "purity.png", btn);
if (btn.Name == "btnItemMatrix")
ImageChange("hover", "body", "matrix_field.png", btn);
if (btn.Name == "btnTax")
ImageChange("hover", "body", "tax.png", btn);
if (btn.Name == "btnCategory")
ImageChange("hover", "body", "category.png", btn);
if (btn.Name == "BtnItemType")
ImageChange("hover", "body", "item_type.png", btn);
if (btn.Name == "BtnStore")
ImageChange("hover", "body", "store.png", btn);
//-----------Item--------------
if (btn.Name == "BtnManageMatrix")
ImageChange("hover", "body", "manage_matrix.png", btn);
if (btn.Name == "BtnManageItem")
ImageChange("hover", "body", "manage_item.png", btn);
if (btn.Name == "BtnItemDetails")
ImageChange("hover", "body", "item_details.png", btn);
if (btn.Name == "BtnBarcode")
ImageChange("hover", "body", "barcode.png", btn);
//-----------Stock--------------
if (btn.Name == "BtnManageStock")
ImageChange("hover", "body", "manage_stock.png", btn);
if (btn.Name == "BtnIssueToQC")
ImageChange("hover", "body", "issue_qc.png", btn);
if (btn.Name == "BtnApproveQC")
ImageChange("hover", "body", "approve_qc.png", btn);
if (btn.Name == "BtnReceiveFromQC")
ImageChange("hover", "body", "rcv_qc.png", btn);
//if (btn.Name == "BtnPurchaseOrder")
// ImageChange("hover", "body", "purchase_order.png", btn);
//-----------Kitting--------------
if (btn.Name == "BtnKitSetup")
ImageChange("hover", "body", "kit_setup.png", btn);
if (btn.Name == "BtnApproveKit")
ImageChange("hover", "body", "approve_kit.png", btn);
if (btn.Name == "BtnIssueKit")
ImageChange("hover", "body", "issue_kit.png", btn);
if (btn.Name == "BtnReceiveKit")
ImageChange("hover", "body", "receive_kit.png", btn);
//-----------Setup--------------
if (btn.Name == "BtnUser")
ImageChange("hover", "body", "user.png", btn);
if (btn.Name == "BtnUserPrivillages")
ImageChange("hover", "body", "user_privileges.png", btn);
if (btn.Name == "BtnBarcodeType")
ImageChange("hover", "body", "barcode_type.png", btn);
//-----------Tools--------------
if (btn.Name == "BtnBackup")
ImageChange("hover", "body", "backup.png", btn);
if (btn.Name == "BtnRestore")
ImageChange("hover", "body", "restore.png", btn);
}
Button ButtonTop = null; string ImageTop = null;
Button ButtonBody = null; string ImageBody = null;
protected void ImageChange(string type, string level, string imagename, Button btn) //Type for hover, click ---- and level for top or body
{
if (type == "click")
{
Button btnPrev = null; string ImagePrev = null;
if (level == "top") { btnPrev = ButtonTop; ImagePrev = ImageTop; ButtonTop = btn; ImageTop = imagename; }
else { btnPrev = ButtonBody; ImagePrev = ImageBody; ButtonBody = btn; ImageBody = imagename; }
if (btnPrev != null)
{
ImagePrev = ImagePrev.Substring(0, ImagePrev.Length - ImagePrev.StartsWith("_").ToString().Length - 5) + ".png";
ImageChange("hover", level, ImagePrev, btnPrev);
}
ImageLoad(imagename, btn);
}
else
{
if (level == "top") { if (ButtonTop != btn)ImageLoad(imagename, btn); }
else { if (ButtonBody != btn) ImageLoad(imagename, btn); }
}
}
//void ImageLoad(string imagename, Button btn)
//{
// string ImagePath = (System.Environment.CurrentDirectory);
// ImagePath = ImagePath.Substring(0, ImagePath.Length - ImagePath.StartsWith("bin").ToString().Length - 4);
// btn.BackgroundImage = Image.FromFile("" + ImagePath + "Resources/" + imagename);
//}
void ImageLoad(string imagename, Button btn)
{
btn.BackgroundImage = GetImage(imagename);
}
Bitmap GetImage(string imagename)
{
Bitmap btImage = null;
switch (imagename)
{
case "common.png": btImage = Resources.common; break;
case "common_hover.png": btImage = Resources.common_hover; break;
case "item.png": btImage = Resources.item; break;
case "item_hover.png": btImage = Resources.item_hover; break;
case "stock.png": btImage = Resources.stock; break;
case "stock_hover.png": btImage = Resources.stock_hover; break;
case "kitting.png": btImage = Resources.kitting; break;
case "kitting_hover.png": btImage = Resources.kitting_hover; break;
case "setup.png": btImage = Resources.setup; break;
case "setup_hover.png": btImage = Resources.setup_hover; break;
case "tools.png": btImage = Resources.tools; break;
case "tools_hover.png": btImage = Resources.tools_hover; break;
case "category.png": btImage = Resources.category; break;
case "category_hover.png": btImage = Resources.category_hover; break;
case "brand.png": btImage = Resources.brand; break;
case "brand_hover.png": btImage = Resources.brand_hover; break;
case "color.png": btImage = Resources.color; break;
case "color_hover.png": btImage = Resources.color_hover; break;
case "clarity.png": btImage = Resources.clarity; break;
case "clarity_hover.png": btImage = Resources.clarity_hover; break;
case "design.png": btImage = Resources.design; break;
case "design_hover.png": btImage = Resources.design_hover; break;
case "stone.png": btImage = Resources.stone; break;
case "stone_hover.png": btImage = Resources.stone_hover; break;
case "stone_cut.png": btImage = Resources.stone_cut; break;
case "stone_cut_hover.png": btImage = Resources.stone_cut_hover; break;
case "grade.png": btImage = Resources.grade; break;
case "grade_hover.png": btImage = Resources.grade_hover; break;
case "purity.png": btImage = Resources.purity; break;
case "purity_hover.png": btImage = Resources.purity_hover; break;
case "item_type.png": btImage = Resources.item_type; break;
case "item_type_hover.png": btImage = Resources.item_type_hover; break;
case "store.png": btImage = Resources.store; break;
case "store_hover.png": btImage = Resources.store_hover; break;
case "matrix_field.png": btImage = Resources.matrix_field; break;
case "matrix_field_hover.png": btImage = Resources.matrix_field_hover; break;
//-----------Stock--------------
case "manage_stock_hover.png": btImage = Resources.manage_stock_hover; break;
case "issue_qc_hover.png": btImage = Resources.issue_qc_hover; break;
case "approve_qc_hover.png": btImage = Resources.approve_qc_hover; break;
case "rcv_qc_hover.png": btImage = Resources.rcv_qc_hover; break;
case "manage_stock.png": btImage = Resources.manage_stock; break;
case "issue_qc.png": btImage = Resources.issue_qc; break;
case "approve_qc.png": btImage = Resources.approve_qc; break;
case "rcv_qc.png": btImage = Resources.rcv_qc; break;
//-----------Kitting--------------
case "kit_setup_hover.png": btImage = Resources.kit_setup_hover; break;
case "approve_kit_hover.png": btImage = Resources.approve_kit_hover; break;
case "issue_kit_hover.png": btImage = Resources.issue_kit_hover; break;
case "receive_kit_hover.png": btImage = Resources.receive_kit_hover; break;
case "kit_setup.png": btImage = Resources.kit_setup; break;
case "approve_kit.png": btImage = Resources.approve_kit; break;
case "issue_kit.png": btImage = Resources.issue_kit; break;
case "receive_kit.png": btImage = Resources.receive_kit; break;
//-----------Setup--------------
case "user_hover.png": btImage = Resources.user_hover; break;
case "user_privileges_hover.png": btImage = Resources.user_privileges_hover; break;
case "barcode_type_hover.png": btImage = Resources.barcode_type_hover; break;
case "user.png": btImage = Resources.user; break;
case "user_privileges.png": btImage = Resources.user_privileges; break;
case "barcode_type.png": btImage = Resources.barcode_type; break;
//-----------Tools--------------
case "backup_hover.png": btImage = Resources.backup_hover; break;
case "restore_hover.png": btImage = Resources.restore_hover; break;
case "backup.png": btImage = Resources.backup; break;
case "restore.png": btImage = Resources.restore; break;
//-----------Item--------------
case "manage_matrix.png": btImage = Resources.manage_matrix; break;
case "manage_item.png": btImage = Resources.manage_item; break;
case "item_details.png": btImage = Resources.item_details; break;
case "barcode.png": btImage = Resources.barcode; break;
case "manage_matrix_hover.png": btImage = Resources.manage_matrix_hover; break;
case "manage_item_hover.png": btImage = Resources.manage_item_hover; break;
case "item_details_hover.png": btImage = Resources.item_details_hover; break;
case "barcode_hover.png": btImage = Resources.barcode_hover; break;
}
return btImage;
}
private void timer1_Tick(object sender, EventArgs e)
{
DateTime dt = DateTime.Now;
lblTime.Text = String.Format("{0:F}", dt);
}
private void button1_Click(object sender, EventArgs e)
{
ImageChange("click", "body", "tax_hover.png", btnTax);
}
void ManagePanel()
{
//PanelSetup.Location = new Point(2, 103);
PanelSetup.Location = PanelCommon.Location;
PanelSetup.Height = PanelCommon.Height;
PanelSetup.Width = PanelCommon.Width;
PanelSetup.Visible = false;
//=========================================
PanelItem.Location = PanelCommon.Location;
PanelItem.Height = PanelCommon.Height;
PanelItem.Width = PanelCommon.Width;
PanelItem.Visible = false;
//=========================================
PanelStock.Location = PanelCommon.Location;
PanelStock.Height = PanelCommon.Height;
PanelStock.Width = PanelCommon.Width;
PanelStock.Visible = false;
//=========================================
PanelKitting.Location = PanelCommon.Location;
PanelKitting.Height = PanelCommon.Height;
PanelKitting.Width = PanelCommon.Width;
PanelKitting.Visible = false;
//=========================================
PanelTools.Location = PanelCommon.Location;
PanelTools.Height = PanelCommon.Height;
PanelTools.Width = PanelCommon.Width;
PanelTools.Visible = false;
//=========================================
}
void ToggleVisiblePanel()
{
PanelCommon.Visible = false;
PanelSetup.Visible = false;
PanelItem.Visible = false;
PanelStock.Visible = false;
PanelKitting.Visible = false;
PanelTools.Visible = false;
}
#endregion
private void frmHome_FormClosing(object sender, FormClosingEventArgs e)
{
//if (MessageBox.Show("Are you sure to Close this Application..?", "Ken Cloud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
//{
// Application.Exit();
//}
//else
//{
// this.Show();
//}
}
private void btnLogout_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure to logout?", "Ken Cloud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
frmLogin obj = new frmLogin();
obj.Show();
this.Hide();
}
//{
// Application.Exit();
//}
}
private void frmHome_FormClosed(object sender, FormClosedEventArgs e)
{
//if (MessageBox.Show("Are you sure to Close this Application..?", "Ken Cloud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
//{
Application.Exit();
//}
//else
//{
// this.Show();
//}
}
private void QCRejectStockRegister_Click(object sender, EventArgs e)
{
frmRptQCRejectStockRegister objPage = new frmRptQCRejectStockRegister();
objPage.Show();
}
private void BtnUserRole_Click(object sender, EventArgs e)
{
//ImageChange("click", "body", "approve_kit_hover.png", BtnApproveKit);
frmUserRole objPage = new frmUserRole();
objPage.TopLevel = false;
objPage.Visible = true;
pnlBody.Controls.Clear();
pnlBody.Controls.Add(objPage);
}
}
}
No comments:
Post a Comment