Beispiel #1
0
        private void btnPOReceiving_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand("Check_User", parentForm.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@empLoginID", SqlDbType.NVarChar).Value = parentForm.employeeID.ToUpper().ToString();
            SqlParameter UserName_Param = cmd.Parameters.Add("@empFirstName", SqlDbType.NVarChar, 50);

            UserName_Param.Direction = ParameterDirection.Output;

            parentForm.conn.Open();
            cmd.ExecuteNonQuery();
            parentForm.conn.Close();

            if (cmd.Parameters["@empFirstName"].Value == DBNull.Value)
            {
                if (parentForm.employeeID == parentForm.SystemMasterUserName)
                {
                    if (parentForm.StoreCode == "B4UWH")
                    {
                        POandReceivingForWarehouse POandReceivingForWarehouseForm = new POandReceivingForWarehouse();
                        POandReceivingForWarehouseForm.parentForm = this.parentForm;
                        POandReceivingForWarehouseForm.Show();
                    }
                    else
                    {
                        POandReceiving POandReceivingForm = new POandReceiving();
                        POandReceivingForm.parentForm = this.parentForm;
                        POandReceivingForm.Show();
                    }
                }
                else
                {
                    MessageBox.Show("NOT AUTHORIZED", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                if (parentForm.userLevel >= parentForm.btnManagementPOReceiving)
                {
                    if (parentForm.StoreCode == "B4UWH")
                    {
                        POandReceivingForWarehouse POandReceivingForWarehouseForm = new POandReceivingForWarehouse();
                        POandReceivingForWarehouseForm.parentForm = this.parentForm;
                        POandReceivingForWarehouseForm.Show();
                    }
                    else
                    {
                        POandReceiving POandReceivingForm = new POandReceiving();
                        POandReceivingForm.parentForm = this.parentForm;
                        POandReceivingForm.Show();
                    }
                }
                else
                {
                    MessageBox.Show("NOT AUTHORIZED", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }